Shelly 2.5 delay device's turn off action

Hi guys,
question concerns Shelly 2.5 configured in Home Assistant using https://github.com/StyraHem/ShellyForHASS (both are up to date installed recently).

I’ve got double rocker switch for 2 lamps connected to Shelly 2.5 on my staircase - what I want to achieve is when I turn off the light, it actually switches off after few seconds delay and allows to climb the stairs with lights on (doesn’t matter if it’s triggered using physical rocker switch or via home assistant). I cannot find a way to replace automation with a device turn off action or another way to accomplish this.

Edit: this is obviously important in case of manual turn off, if turned off via the app, then I can do it easily few seconds later, but requires to have a phone in hand and an app turned on.

It can be done but you have to switch the device’s relay type to detached switch.
Then you can intercept any input changes by HA, and execute relay turn off after some delay/
Unfortunately it has one but crucial disadvantage. In case of HA unavailability (ie Wifi network issues or so) you will not be able to control the light at all.

Other idea is to use some other firmware. Maybe tasmota has a feature you are asking for.

1 Like

Thank you, what I have done as of now is switch button in shelly dashboard to detached and create such 2 following automations (need to think how to merge it):

- id: 'XXX'
  alias: Turn off with delay
  description: ''
  trigger:
  - entity_id: switch.shelly_shsw_25_bcddc27xxxxx_2
    platform: state
  condition:
  - condition: and
    conditions:
    - condition: template
      value_template: '{{ trigger.to_state.attributes.switch != trigger.from_state.attributes.switch
        }}'
    - condition: template
      value_template: '{{ trigger.from_state.state == "on" }}'
  action:
  - delay: 00:00:20
  - device_id: 69540036a79f443082e683b2axxxxxx
    domain: switch
    entity_id: switch.shelly_shsw_25_bcddc27xxxxx_2
    type: turn_off
- id: 'XXX'
  alias: Turn on without delay
  description: ''
  trigger:
  - entity_id: switch.shelly_shsw_25_bcddc27xxxxx_2
    platform: state
  condition:
  - condition: and
    conditions:
    - condition: template
      value_template: '{{ trigger.to_state.attributes.switch != trigger.from_state.attributes.switch
        }}'
    - condition: template
      value_template: '{{ trigger.from_state.state == "off" }}'
  action:
  - device_id: 69540036a79f443082e683xxxxxxxxx
    domain: switch
    entity_id: switch.shelly_shsw_25_bcddc27xxxxx_2
    type: turn_on