Hey,
I’m using several Shelly 1 Mini Gen3 as detached switchs to switch on and off my zigbee lights without cutting their power supply.
To do so I’m using the “status” of the Shellys to toggle the lights when I toggle my switch. So it doesn’t matter if I open oder close the switch or if the lights are currently on or off.
Everything works as expected, but with one exception:
The Shellys become occasionally “unavailable”, preferable the one in my bedroom during the night. This unavilability changes the “status” and this toggles my lights.
I tried to workaraound these unintended toggles with a condition, that cheks that the shelly is not unavailable. (checking if the shelly is available didn’t work at all)
Attached you can see a screenshot of the visual editor and the yaml code:
The screenshot of the automation:
The code:
alias: Lichtschalter Schlafzimmer
description: ""
triggers:
- type: opened
device_id: 6981dc6bdc65b4795cbd06adbdf02849
entity_id: 69954f6ccc669fd9fa49a29a5443b68e
domain: binary_sensor
trigger: device
- type: not_opened
device_id: 6981dc6bdc65b4795cbd06adbdf02849
entity_id: 69954f6ccc669fd9fa49a29a5443b68e
domain: binary_sensor
trigger: device
conditions:
- condition: not
conditions:
- condition: state
entity_id: binary_sensor.shelly_schlafzimmer_status
state: unavailable
actions:
- choose:
- conditions:
- condition: device
type: is_off
device_id: e418671b88493dbb0598e89f0f36f16b
entity_id: 36a3d8463f94351d9ebff1c52f6fef47
domain: light
sequence:
- type: turn_on
device_id: e418671b88493dbb0598e89f0f36f16b
entity_id: 36a3d8463f94351d9ebff1c52f6fef47
domain: light
- conditions:
- condition: device
type: is_on
device_id: e418671b88493dbb0598e89f0f36f16b
entity_id: 36a3d8463f94351d9ebff1c52f6fef47
domain: light
sequence:
- type: turn_off
device_id: e418671b88493dbb0598e89f0f36f16b
entity_id: 36a3d8463f94351d9ebff1c52f6fef47
domain: light
mode: single
And a screenshot of the log: