Hey all,
With Shelly’s recent firmware v2 for the Shelly 2PM Gen4, they now fire an event for switch input changes when you have it in ‘detached switch mode’ and joined to Zigbee.
While it’s not an actual status (is that the right word?) that can be polled, this is better than nothing.
I purchased a couple to try out last week after I saw that v2 Firmware was being rolled out. I’m using the ZBT-1 for Zigbee with ZHA. Literally got the Shelly module connected today.
I’ve got a helper virtual device input boolean thing that tries to represent the physical switch state, however there is a chance this can get out of sync if HA misses the events from the 2PM.
Ideally it would be a state that HA can poll from the 2PM, but until that happens, here is my automation that updates the helper virtual device when ever I flick the switch. There might be a smarter/faster way to do this, if there is, I’m always happy to learn. Anyway, I have additional automations that fire when the virtual device is changed by this.
alias: Physical Light Switch - Switch 1
description: ""
triggers:
- event_type: zha_event
event_data:
device_id: number_taken_from_event_listener
endpoint_id: 3
cluster_id: 6
command: attribute_updated
context: {}
trigger: event
conditions: null
actions:
- choose:
- conditions:
- condition: template
value_template: "{{ trigger.event.data.args.value == 1 }}"
sequence:
- action: input_boolean.turn_on
metadata: {}
target:
entity_id: input_boolean.room_light_virtual_switch
data: {}
- conditions:
- condition: template
value_template: "{{ trigger.event.data.args.value == 0 }}"
sequence:
- action: input_boolean.turn_off
metadata: {}
target:
entity_id: input_boolean.room_light_virtual_switch
data: {}
mode: single
When I was watching the events, Cluster ID and Endpoint ID were different for Switch Input 2. But same data.
I can’t comment on the reliability of this thing yet, its only been in for a few hours. But these seem like a good value way to retrofit existing light switches for smart lights that must be always on. This room didn’t have neutral at the switch, so the module itself is in the roof.
One thing I learnt while testing this - make sure you disable the factory reset capability on the switch input before you go flicking it like crazy ![]()