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

Hue Smart Button for deCONZ #226

Closed
xaviml opened this issue Jan 20, 2021 · 11 comments
Closed

Hue Smart Button for deCONZ #226

xaviml opened this issue Jan 20, 2021 · 11 comments
Assignees
Labels
new-device New device

Comments

@xaviml
Copy link
Owner

xaviml commented Jan 20, 2021

New Device Support

Device Information

  • Device Model: 8718699693985
  • Device Description: HueSmartButton Philips
  • Device Manufacturer: Philips

Integrations

If possible, provide the event mappings for the different actions that can be performed on the controller. Specify the integration.

If you can provide mappings for multiple integrations, copy the section below as many times as needed.

Integration: deconz

Actions

  • 1000: Initial press
  • 1001: Hold
  • 1002: Short release
  • 1003: Long release
@xaviml xaviml added the new-device New device label Jan 20, 2021
@xaviml xaviml self-assigned this Jan 20, 2021
xaviml added a commit that referenced this issue Jan 23, 2021
@xaviml
Copy link
Owner Author

xaviml commented Jan 24, 2021

Device added in ControllerX v4.5.0.

@xaviml xaviml closed this as completed Jan 24, 2021
@civarson
Copy link

Will you be adding z2m support for the Hue Smart Button?

@xaviml
Copy link
Owner Author

xaviml commented Jan 24, 2021

Hi @blueturtleshells,

Yes, not a problem for me. I do not possess this controller, so I don't know the mapping for Z2M. I got the deCONZ mapping from someone in the forum that requested it.

If you let me know the following events, I will add the Z2M mapping:

  • Click
  • Hold
  • Release

Ideally, you could open a new issue of type "new device", otherwise I will do myself with the information you provide.

Regards,
Xavi M.

@civarson
Copy link

civarson commented Jan 24, 2021

Sorry, I'm not 100% sure how to get the information you're asking (kinda new here) but this is what shows in the Z2M logs when I push the button:

INFO: MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"press","linkquality":88,"update":{"state":"idle"},"update_available":false}'
INFO: MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"","linkquality":88,"update":{"state":"idle"},"update_available":false}'
INFO: MQTT publish: topic 'zigbee2mqtt/Smart Button/action', payload 'press'
INFO: MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"release","linkquality":88,"update":{"state":"idle"},"update_available":false}'
INFO: MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"","linkquality":88,"update":{"state":"idle"},"update_available":false}'
INFO: MQTT publish: topic 'zigbee2mqtt/Smart Button/action', payload 'release'
INFO: MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"off","linkquality":88,"update":{"state":"idle"},"update_available":false}'
INFO: MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"","linkquality":88,"update":{"state":"idle"},"update_available":false}'
INFO: MQTT publish: topic 'zigbee2mqtt/Smart Button/action', payload 'off'

and when I click and hold it:

INFO: MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"press","linkquality":88,"update":{"state":"idle"},"update_available":false}'
INFO: MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"","linkquality":88,"update":{"state":"idle"},"update_available":false}'
INFO: MQTT publish: topic 'zigbee2mqtt/Smart Button/action', payload 'press'
INFO: MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"skip_backward","linkquality":88,"step_size":30,"transition_time":9,"update":{"state":"idle"},"update_available":false}'
INFO: MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"","linkquality":88,"update":{"state":"idle"},"update_available":false}'
INFO: MQTT publish: topic 'zigbee2mqtt/Smart Button/action', payload 'skip_backward'
INFO: MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"hold","linkquality":88,"update":{"state":"idle"},"update_available":false}'
INFO: MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"","linkquality":88,"update":{"state":"idle"},"update_available":false}'
INFO: MQTT publish: topic 'zigbee2mqtt/Smart Button/action', payload 'hold'
INFO: MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"skip_backward","linkquality":88,"step_size":56,"transition_time":9,"update":{"state":"idle"},"update_available":false}'
INFO: MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"","linkquality":88,"update":{"state":"idle"},"update_available":false}'
INFO: MQTT publish: topic 'zigbee2mqtt/Smart Button/action', payload 'skip_backward'
INFO: MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"hold","linkquality":88,"update":{"state":"idle"},"update_available":false}'
INFO: MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"","linkquality":88,"update":{"state":"idle"},"update_available":false}'
INFO: MQTT publish: topic 'zigbee2mqtt/Smart Button/action', payload 'hold'
INFO: MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"skip_backward","linkquality":88,"step_size":56,"transition_time":9,"update":{"state":"idle"},"update_available":false}'
INFO: MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"","linkquality":88,"update":{"state":"idle"},"update_available":false}'
INFO: MQTT publish: topic 'zigbee2mqtt/Smart Button/action', payload 'skip_backward'
INFO: MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"hold","linkquality":88,"update":{"state":"idle"},"update_available":false}'
INFO: MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"","linkquality":88,"update":{"state":"idle"},"update_available":false}'
INFO: MQTT publish: topic 'zigbee2mqtt/Smart Button/action', payload 'hold'
INFO: MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"release","linkquality":88,"update":{"state":"idle"},"update_available":false}'
INFO: MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"","linkquality":88,"update":{"state":"idle"},"update_available":false}'
INFO: MQTT publish: topic 'zigbee2mqtt/Smart Button/action', payload 'release'

@xaviml
Copy link
Owner Author

xaviml commented Jan 27, 2021

Hi @blueturtleshells,

Thank you for your response, I am interested in the zigbee2mqtt/Smart Button/action topic payload on each type of event. So I recognize from your logs the following actions:

  • press
  • release
  • off
  • skip_backward
  • hold

I would need to understand when each of those actions are fired. According to your comment, these actions are fired when pressing:

  • press
  • release
  • off

And the following when click&holding:

  • press
  • hold
  • skip_backward
  • release

Is this still true? If so, I don't see an easy way of distinguishing the actions.

Regards,
Xavi M.

@civarson
Copy link

Hi @xaviml, Appreciate your patience here as I'm learning as I go.

I'm with you in judging by the logs it's difficult to distinguish a click and a click+hold. release and skip_backward are the only difference I can see.

FWIW I set my logs to show debug level and here it is again (not sure if it's helpful). Perhaps implementing simple click and release is sufficient for now - I know it is for me.

click-release only

Debug Received Zigbee message from 'Smart Button', type 'commandHueNotification', cluster 'manuSpecificPhilips', data '{"button":1,"time":0,"type":0,"unknown1":3145728,"unknown2":0}' from endpoint 1 with groupID null
Info MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"press","battery":100,"linkquality":246,"update":{"state":"idle"},"update_available":false}'
Info MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"","battery":100,"linkquality":246,"update":{"state":"idle"},"update_available":false}'
Info MQTT publish: topic 'zigbee2mqtt/Smart Button/action', payload 'press'
Debug Received Zigbee message from 'Smart Button', type 'commandHueNotification', cluster 'manuSpecificPhilips', data '{"button":1,"time":0,"type":2,"unknown1":3145728,"unknown2":0}' from endpoint 1 with groupID null
Info MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"release","battery":100,"linkquality":246,"update":{"state":"idle"},"update_available":false}'
Info MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"","battery":100,"linkquality":246,"update":{"state":"idle"},"update_available":false}'
Info MQTT publish: topic 'zigbee2mqtt/Smart Button/action', payload 'release'

click-hold(3 sec)-release:

Debug Received Zigbee message from 'Smart Button', type 'commandHueNotification', cluster 'manuSpecificPhilips', data '{"button":1,"time":0,"type":0,"unknown1":3145728,"unknown2":0}' from endpoint 1 with groupID null
Info MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"press","battery":100,"linkquality":246,"update":{"state":"idle"},"update_available":false}'
Info MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"","battery":100,"linkquality":246,"update":{"state":"idle"},"update_available":false}'
Info MQTT publish: topic 'zigbee2mqtt/Smart Button/action', payload 'press'
Debug Received Zigbee message from 'Smart Button', type 'commandStep', cluster 'genLevelCtrl', data '{"stepmode":1,"stepsize":30,"transtime":9}' from endpoint 1 with groupID null
Info MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"skip_backward","battery":100,"linkquality":246,"step_size":30,"transition_time":9,"update":{"state":"idle"},"update_available":false}'
Info MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"","battery":100,"linkquality":246,"update":{"state":"idle"},"update_available":false}'
Info MQTT publish: topic 'zigbee2mqtt/Smart Button/action', payload 'skip_backward'
Debug Received Zigbee message from 'Smart Button', type 'commandHueNotification', cluster 'manuSpecificPhilips', data '{"button":1,"time":8,"type":1,"unknown1":3145728,"unknown2":0}' from endpoint 1 with groupID null
Info MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"hold","battery":100,"linkquality":246,"update":{"state":"idle"},"update_available":false}'
Info MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"","battery":100,"linkquality":246,"update":{"state":"idle"},"update_available":false}'
Info MQTT publish: topic 'zigbee2mqtt/Smart Button/action', payload 'hold'
Debug Received Zigbee message from 'Smart Button', type 'commandStep', cluster 'genLevelCtrl', data '{"stepmode":1,"stepsize":56,"transtime":9}' from endpoint 1 with groupID null
Info MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"skip_backward","battery":100,"linkquality":246,"step_size":56,"transition_time":9,"update":{"state":"idle"},"update_available":false}'
Info MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"","battery":100,"linkquality":246,"update":{"state":"idle"},"update_available":false}'
Info MQTT publish: topic 'zigbee2mqtt/Smart Button/action', payload 'skip_backward'
Debug Received Zigbee message from 'Smart Button', type 'commandHueNotification', cluster 'manuSpecificPhilips', data '{"button":1,"time":16,"type":1,"unknown1":3145728,"unknown2":0}' from endpoint 1 with groupID null
Info MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"hold","battery":100,"linkquality":246,"update":{"state":"idle"},"update_available":false}'
Info MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"","battery":100,"linkquality":246,"update":{"state":"idle"},"update_available":false}'
Info MQTT publish: topic 'zigbee2mqtt/Smart Button/action', payload 'hold'
Debug Received Zigbee message from 'Smart Button', type 'commandHueNotification', cluster 'manuSpecificPhilips', data '{"button":1,"time":17,"type":3,"unknown1":3145728,"unknown2":0}' from endpoint 1 with groupID null
Info MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"release","battery":100,"linkquality":246,"update":{"state":"idle"},"update_available":false}'
Info MQTT publish: topic 'zigbee2mqtt/Smart Button', payload '{"action":"","battery":100,"linkquality":246,"update":{"state":"idle"},"update_available":false}'
Info MQTT publish: topic 'zigbee2mqtt/Smart Button/action', payload 'release'

@xaviml
Copy link
Owner Author

xaviml commented Jan 27, 2021

Hi @blueturtleshells,

Thank you again for your response. I see that press is present in both type of events, so there is no way of distinguishing between click and hold-release. Therefore, I will not add a default mapping for this controller. This does not mean that you cannot leverage ControllerX and use it with your controller. You can use custom mapping to create your own mapping for this controller. You can use press for a click action, but take into account that it will be also fired when holding for example. Happy to help to create a custom configuration for you :)

Regards,
Xavi M.

@civarson
Copy link

civarson commented Jan 27, 2021

Thanks, this is what I came up with but can't seem to get it working:

 smart_button_controller:
   module: controllerx
   class: HueSmartButtonLightController
   controller: sensor.smart_button_action
   integration: z2m
   mapping:
     "press":
       - service: light.toggle
       - entity_id: light.master_bedroom

Can you see what's wrong? Thanks again.

Edit: Logs say ValueError: HueSmartButtonLightController class needs the 'light' attribute

@xaviml
Copy link
Owner Author

xaviml commented Jan 27, 2021

Hi @blueturtleshells,

My recommendation is to use LightController which is a generic controller for any device and you just need to define the mapping, so configuration would look like:

smart_button_controller:
   module: controllerx
   class: LightController
   controller: sensor.smart_button_action
   integration: z2m
   light: light.master_bedroom
   mapping:
     press: toggle

Also, as you can see, you don't need to define the service toggle, since toggle is a predefined action that already does that.

Hope it helps :)

Regards,
Xavi M.

@civarson
Copy link

That helped - it works! You're awesome :)

@xaviml
Copy link
Owner Author

xaviml commented Jan 28, 2021

I'm glad you got it working :) and thank you for your support!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-device New device
Projects
None yet
Development

No branches or pull requests

2 participants