-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added action for on/off switches (new device option switch_action, default false) #5276
Conversation
Such feature is not specific to this device, it can apply to every wall switch, right? |
Basically yes, but problem is with naming - single switches actions can be named on and off always, but multi button switches endpoints are sometimes named like left, center, right, sometimes l1, l2, others just 1, 2, etc. I ddon't know well z2m code, so don't know if I can get endpoint name in fromZigbee converter (I wasn't able to find such example) |
My point is that this is basically duplicate information. It's the switch state but then just in another form. Can't this be easily solved with an HA automation? |
In HA yes - there are device events like switched on / off or I can use trigger based on entity state - HA have logic do detect state changes, but I don't have HA in mind. Any other software that want to run something based on switch event needs to remeber current state to detect event - there is no possibility to make stateless software now to handle switch events |
Since this functionality is not specific to these TuYa devices, it should also be added to all other switches. (mainly the zigbee-herdsman-converters/lib/utils.js Line 131 in 47828fb
|
OK, should I add action by defaut for all extend.switch() or like in this PR as option ? |
Not by default, this should be an option as not everyone will be interested in this. e.g. |
Changed PR topic, and commited publishing action topic for all on_off converters when new switch_action device option is set to true |
Thanks, I've renamed it to |
Those wall switches (not switch modules) can be installed without wiring all buttons to lamp and used in automations to control lights wirelessly. Or even if wired it can be used to control other related lights in automations. Action topic is preferred to be used as trigger, rather than state (state topic changes also when last_seen, linkquality or other property changes, so it must be filtered)