Koenkk / zigbee-herdsman-converters

Collection of device converters to be used with zigbee-herdsman
MIT License
882 stars 2.93k forks source link

Lutron Connected bulb remote control (LZL4BWHL01) exposing incorrect actions #5634

Closed dkerr64 closed 1 year ago

dkerr64 commented 1 year ago

The convertor for Lutron connected remote LZL4BWHL01 exposes the actions...

exposes: [e.action(['down', 'up', 'stop'])],

However when I look at the logs the actual messages sent for each button press are...

Zigbee2MQTT:info  2023-04-05 20:01:48: MQTT publish: topic 'zigbee2mqtt/Family Remote', payload '{"action":"brightness_move_to_level","action_group":8124,"action_level":254,"action_transition_time":0.04,"linkquality":96}'
Zigbee2MQTT:info  2023-04-05 20:01:50: MQTT publish: topic 'zigbee2mqtt/Family Remote', payload '{"action":"brightness_step_up","action_group":8124,"action_step_size":30,"action_transition_time":0.06,"linkquality":96}'
Zigbee2MQTT:info  2023-04-05 20:01:50: MQTT publish: topic 'zigbee2mqtt/Family Remote', payload '{"action":"brightness_stop","action_group":8124,"linkquality":96}'
Zigbee2MQTT:info  2023-04-05 20:01:52: MQTT publish: topic 'zigbee2mqtt/Family Remote', payload '{"action":"brightness_step_down","action_group":8124,"action_step_size":30,"action_transition_time":0.06,"linkquality":92}'
Zigbee2MQTT:info  2023-04-05 20:01:53: MQTT publish: topic 'zigbee2mqtt/Family Remote', payload '{"action":"brightness_stop","action_group":8124,"linkquality":96}'
Zigbee2MQTT:info  2023-04-05 20:01:55: MQTT publish: topic 'zigbee2mqtt/Family Remote', payload '{"action":"brightness_move_to_level","action_group":8124,"action_level":0,"action_transition_time":0.04,"linkquality":96}'

So given the actual action messages sent, shouldn't the exposed actions be defined as...

exposes: [e.action(['brightness_step_down', 'brightness_step_up', 'brightness_stop', 'brightness_move_to_level'])],

These actions are published when a device is registered with a MQTT listener, so if they do not match what is actually sent, then they are likely not properly handled. I am trying to get the a Homebridge plugin to work with this remote and this is the first fix I'll need to get this working... The other being that these do not match directly to each button, brightness_move_to_level is sent on pressing both the on and off button (with different move-to-levels) and that will need special handling on the Homebridge side.

Thanks

Koenkk commented 1 year ago

Fixed!

Changes will be available in the dev branch in a few hours from now. (https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html)

dkerr64 commented 1 year ago

Awesome, thank you @Koenkk

Something else I just noticed is that the homebridge plugin seems to be sensitive to the order that the actions are listed... assigning the first to button 1, second to button 2, etc. (The plugin creates multiple Apple HomeKit stateless switch accessories that are linked together). I had hoped that it would key off the order that I listed the actions in its config file, but apparently not. Which means that the best thing to do would be to order as...

exposes: [e.action(['brightness_move_to_level', 'brightness_step_up', 'brightness_step_down', 'brightness_stop'])],

But that of course doesn't really solve the problem at the homebridge side which I am going to start working on soon... ideally the configuration for it should allow you to assign actions to specific buttons in whatever order you want. And it will have to ignore brightness_stop and instead assign brightness_move_to_level with action_level zero to button 4. If I solve that, I might as well allow for button assignment order to be based on its configuration and not the order in the MQTT message.

THANK YOU!! David.

dkerr64 commented 1 year ago

@itavero tagging you into this discussion for awareness. I'll let you know when I figure out how to handle this in your plugin.

itavero commented 1 year ago

Not sure what you need from homebridge-z2m, but currently the action values are sorted to assign numbers to them (with some additional logic in case the values already contain some numbered values). This is done so that changing the order in the exposes information will not result in different behavior in the plugin.

Do note that if you are looking to do something specific just for this device model, I would suggest having a look at the homebridge-mqttthing plugin instead.

dkerr64 commented 1 year ago

@itavero thanks for the pointer, I will look at mqttthing. The main issue I am trying to solve is that this particular device send the same action for two buttons, the "on" and "off" buttons on the remote (two of the four buttons).

The on button sends:

{"action":"brightness_move_to_level","action_group":8124,"action_level":254,"action_transition_time":0.04,"linkquality":96}

and the off button sends:

{"action":"brightness_move_to_level","action_group":8124,"action_level":0,"action_transition_time":0.04,"linkquality":96}

I need to assign those two mqtt messages to two separate stateless switches based only on the difference in action_level.

Thanks David

itavero commented 1 year ago

I see. Well, in that case I would definitely recommend looking at MQTT thing to create this specific mapping.

dkerr64 commented 1 year ago

@itavero Thank you for the pointer MQTT-Thing is exactly what I need. It lets me parse the JSON that comes back.