Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 106323

Help with automation - sonnoff switch

$
0
0

This is my first post so please forgive me if this is not the right forum for this.
I was hoping someone could look over the first automation that I created using the GUI and let me know if they see any problems with it or perhaps a more efficient way to create the same automation.

The switch controls towel warmers in our bathrooms.
I was wondering what the best way to handle the case if one of the off triggers doesn’t fire (to turn the switch off) for some reason, such as HA goes off line for a minute or two but then comes back online a few minutes later. Should I add some sort of automation that when HA starts it makes sure the Towel warmer switch gets turned off if its state is “on”?

Any help or comments/improvements on the below automation yaml would be appreciated:

alias: 'Towel Warmers automation '
description: Turn on and off towel warmers based on time and day.
trigger:
  - platform: time
    at: '05:30:00'
    id: tw_turn_on_weekday
  - platform: time
    at: '07:30:00'
    id: tw_turn_off_weekday
  - platform: time
    at: '08:00:00'
    id: tw_turn_on_weekend
  - platform: time
    at: '10:00:00'
    id: tw_turn_off_weekend
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: tw_turn_on_weekday
          - condition: time
            weekday:
              - mon
              - tue
              - wed
              - thu
              - fri
        sequence:
          - service: switch.turn_on
            target:
              entity_id: switch.1000539b1b
      - conditions:
          - condition: trigger
            id: tw_turn_off_weekday
          - condition: time
            weekday:
              - mon
              - tue
              - wed
              - thu
              - fri
        sequence:
          - service: switch.turn_off
            target:
              entity_id: switch.1000539b1b
      - conditions:
          - condition: trigger
            id: tw_turn_on_weekend
          - condition: time
            weekday:
              - sat
              - sun
        sequence:
          - service: switch.turn_on
            target:
              entity_id: switch.1000539b1b
      - conditions:
          - condition: trigger
            id: tw_turn_off_weekend
          - condition: time
            weekday:
              - sat
              - sun
        sequence:
          - service: switch.turn_off
            target:
              entity_id: switch.1000539b1b
    default: []
mode: single

4 posts - 4 participants

Read full topic


Viewing all articles
Browse latest Browse all 106323

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>