Light switch to provide automation override

Thank you! Me too. Packages make things so much easier. I’ll have a gander over the weekend. Thanks for sharing.

no worries, always happy to share. A lot of my code would never have happened without the brains of others from this forum

Agreed! I ended up taken a simpler approach (??) as I’m a hardware guy and getting the family to use a new button with multiple push options was always going to be a hard sell.

I replaced my Z-Wave switch with a Shelly1 that has MQTT support and since firmware version 1.4.3, has the ability to publish a command when the button is pressed. Here is my light switch sensor:

#### Status of Shelly switch for Garage light ####
  - platform: mqtt
    name: "Garage Light Switch Status"
    state_topic: "shellies/shelly1-4FFDFE/input/0"

So, now I know if someone wants the light on, they simply turn the switch on and it overrides the auto-off timer. Family seems very happy with the solution after a technology briefing last night. :slight_smile:

### Garage Light Auto ###
  - alias: 'Turn on Garage light on motion and dark'
    hide_entity: true
    trigger:
        platform: state
        entity_id: binary_sensor.motion_sensor_garage
        to: 'on'
    condition:
      condition: and
      conditions:
      - condition: numeric_state
        entity_id: sensor.illumination_garage
        below: 80
      - condition: state
        entity_id: light.garage_light_main
        state: 'off'
    action:
      - service: light.turn_on
        entity_id: light.garage_light_main

  - alias: 'Turn off Garage light when sensor resets' ## 2 min sensor default ##
    hide_entity: true
    trigger:
        platform: state
        entity_id: binary_sensor.motion_sensor_garage
        to: 'off'
    condition:
      - condition: state
        entity_id: light.garage_light_main
        state: 'on'
      - condition: state
        entity_id: sensor.garage_light_switch_status
        state: '0'
    action:
      - service: light.turn_off
        entity_id: light.garage_light_main

I guess the reason I wanted an OFF position (which your code doesn’t have) is so that if I’m watching a movie or something, I can go into the kitchen without having the light come on automatically. From what I can see in your example you only have ON and AUTO, which is fine for a garage since who wants to go in there and stumble in the dark!