Skip to content
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

Ubisys S1/2 commandToggle #1850

Closed
sjorge opened this issue Dec 4, 2020 · 4 comments · Fixed by #1900
Closed

Ubisys S1/2 commandToggle #1850

sjorge opened this issue Dec 4, 2020 · 4 comments · Fixed by #1900

Comments

@sjorge
Copy link
Contributor

sjorge commented Dec 4, 2020

cc @felixstorm

Zigbee2MQTT:debug 2020-12-04 19:19:46: No converter available for 'S1' with cluster 'genOnOff' and type 'commandToggle' and data '{}'

Just noticed, we can probably also add an action to the Ubisys devices. Say you have the client genOnOff/genlevelCtrl unbound from the server side. If we expose this we could use them in hass for example to control server side automatons.

Not sure it's worth it though, thoughts on this? the actual command may vary based on the configuration. Mine are momentum switches so commandToggle makes sense here.

So would this be worth adding? If so I could have a go at this.

@felixstorm
Copy link
Contributor

Yes, why not? But you might also want to test if actions will also be emitted by Z2M in the standard binding configuration (with inputs bound to outputs) and if they have any negative impact on the average user.

And as for the the converters, you could probably rename ubisys_c4_onoff etc. to just be ubisys_onoff and use them for all devices (but not every device can emit all ZigBee commands, e.g. the J1 can probably not emit toggle or on/off commands). This way the action topic would not start at 1 for the first input but at the respective endpoint number of each input, but it would probably still be good enough to be used and not be too much effort to implement.

@sjorge
Copy link
Contributor Author

sjorge commented Dec 13, 2020

I did some testing, I repaired a switch that was on on/off mode with the default bindings, it does not emit any commandXXX.

Unbinding and binding it to either the coordinator or to a group seems to work though. I'll play with adding ubisys_c4_onoff to my S1 to see if that is enough. Looking at the S1 and S2's endpoints I think those would only have onoff, level, and scenes as there are no endpoints for anything else. Should not be to hard to figure out which device support what by looking at the endpoints.

@sjorge
Copy link
Contributor Author

sjorge commented Dec 13, 2020

Zigbee2MQTT:info  2020-12-13 12:43:07: MQTT publish: topic 'zigbee2mqtt/pantry/lights/switch', payload '{"action":"2_toggle","linkquality":107,"power":3,"state":"ON","update":{"state":"idle"}}'
Zigbee2MQTT:info  2020-12-13 12:43:12: MQTT publish: topic 'zigbee2mqtt/pantry/lights/switch', payload '{"action":"2_toggle","linkquality":102,"power":0,"state":"ON","update":{"state":"idle"}}'
Zigbee2MQTT:info  2020-12-13 12:43:15: MQTT publish: topic 'zigbee2mqtt/livingroom/lights/switch', payload '{"action":"3_toggle","linkquality":63,"power":6,"state_l1":"ON","state_l2":"ON","update":{"state":"idle"}}'
Zigbee2MQTT:info  2020-12-13 12:43:23: MQTT publish: topic 'zigbee2mqtt/livingroom/lights/switch', payload '{"action":"3_toggle","linkquality":49,"power":0,"state_l1":"ON","state_l2":"ON","update":{"state":"idle"}}'
Zigbee2MQTT:info  2020-12-13 12:43:25: MQTT publish: topic 'zigbee2mqtt/livingroom/lights/switch', payload '{"action":"4_toggle","linkquality":44,"power":0,"state_l1":"ON","state_l2":"ON","update":{"state":"idle"}}'
Zigbee2MQTT:info  2020-12-13 12:43:31: MQTT publish: topic 'zigbee2mqtt/livingroom/lights/switch', payload '{"action":"4_toggle","linkquality":81,"power":3,"state_l1":"ON","state_l2":"ON","update":{"state":"idle"}}'
Zigbee2MQTT:info  2020-12-13 12:43:39: MQTT publish: topic 'zigbee2mqtt/office/lights/switch', payload '{"action":"2_toggle","linkquality":68,"power":1,"state":"ON","update":{"state":"idle"}}'

This was with jus the converter added without looking at the ep mappings, for a S1 and S2

Also looks like we missed a few:

Zigbee2MQTT:debug 2020-12-13 12:30:27: No converter available for 'S1' with cluster 'genLevelCtrl' and type 'commandMove' and data '{"movemode":1,"rate":50}'
Zigbee2MQTT:debug 2020-12-13 12:30:29: No converter available for 'S1' with cluster 'genLevelCtrl' and type 'commandStop' and data '{}'
Zigbee2MQTT:debug 2020-12-13 12:30:51: No converter available for 'S1' with cluster 'genLevelCtrl' and type 'commandMove' and data '{"movemode":0,"rate":50}'

It might also be possible to just leverage

const postfixWithEndpointName = (name, msg, definition) => {
and the normal convertors
command_toggle command_on command_off command_recall command_cover_open command_cover_close command_cover_stop command_move command_stop

For S1 and S2 they will provide all the info and with same naming as other devices.

@sjorge
Copy link
Contributor Author

sjorge commented Dec 13, 2020

That seems to give nice results:

  • S1:
Zigbee2MQTT:info  2020-12-13 13:02:20: MQTT publish: topic 'zigbee2mqtt/office/lights/switch', payload '{"action":"toggle","action_group":10110,"linkquality":92,"power":75,"state":"ON","update":{"state":"idle"}}'
Zigbee2MQTT:info  2020-12-13 13:02:43: MQTT publish: topic 'zigbee2mqtt/office/lights/switch', payload '{"action":"brightness_move_up","action_group":10110,"action_rate":50,"linkquality":94,"power":58,"state":"ON","update":{"state":"idle"}}'
Zigbee2MQTT:info  2020-12-13 13:02:46: MQTT publish: topic 'zigbee2mqtt/office/lights/switch', payload '{"action":"brightness_stop","action_group":10110,"linkquality":65,"power":58,"state":"ON","update":{"state":"idle"}}'
Zigbee2MQTT:info  2020-12-13 13:02:53: MQTT publish: topic 'zigbee2mqtt/office/lights/switch', payload '{"action":"toggle","action_group":10110,"linkquality":65,"power":75,"state":"ON","update":{"state":"idle"}}'
  • S2:
Zigbee2MQTT:info  2020-12-13 13:07:46: MQTT publish: topic 'zigbee2mqtt/livingroom/lights/switch', payload '{"action":"toggle_l4","action_group":10104,"linkquality":78,"power":0,"state_l1":"ON","state_l2":"ON","update":{"state":"idle"}}'

Koenkk pushed a commit that referenced this issue Dec 13, 2020
* Ubisys S1/S2 can support action

When the control endpoints of a S1 (only 1 endpoint) or an S2 (2 endpoints) are bound to a group they emit commands.
Before they were only captured for Ubisys C4, we now capture them for S1 and S2 too.

I don't have access to other devices to add them. I've decided to go with the standard way of implementing this instead of extending ubisys_c4_* fromZigbee converters.
As the default way of handling this works nicely.

* Ubisys S1/S2 update exposes with action
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants