Timer examples

Thanks for your replies, I think the light bulb above my head is slowly sparking to life :slight_smile: My first thought was that the above solution would be much more readable/elegant if written as below:

automation:
  - id: timergaragelightsoff
    alias: atoff
    trigger:
      platform: state
      entity_id: switch.garage_interior_switch
      to: 'on'
      for:
        minutes: 8
    action:
      - service: homeassistant.turn_off
        entity_id: switch.garage_interior_switch        
  - id: garagedooropen
    alias: "garage door opened"
    trigger:
      - platform: state
        entity_id: sensor.garage_door_west_alarm_level
        from: '255'
        to: '0'
    action:
      - service: homeassistant.turn_on
        entity_id: switch.garage_interior_switch

But that would give a problem if I manually switched on the light via say a wall switch. With your example I could cancel the timer to leave the lights on after switching them manually.

1 Like