Philips Hue smart buttons as triggers for automations

Just thought I’d mention this in case anyone is having similar problems…

I’ve been experimenting with a Philips Hue smart button, with a view to using it to launch things other than lights (alarms, for example). Set up in the Philips app, it turned a local Hue light on and off successfully and it appeared in the HA integration, but I had a lot of trouble using it to trigger automations.

In theory something like this ought to work:

- id: '1623662247826'
  alias: Test
  description: '' "
  trigger:
  - device_id: 19a584f3266f3107d25d90306c4f23d2
    domain: hue
    platform: device
    type: remote_button_short_release
    subtype: turn_on
  condition: []
  action:
  - service: input_boolean.turn_on
    target:
      entity_id: input_boolean.bedroom_spotlights
  mode: single

(The spotlights are not Hue devices - I’m just using them as a target for the automation.)

In practice the automation was not triggered when the button was pressed, though the appropriate Hue bulb turned on and off. I noticed too that the battery level sensor for the button was showing “?”.

Back in the Philips app I saw that I was still using the default name for the button. Changed it to something more sensible, reloaded the integration and suddenly the automation is working and battery shows 100%.

I’m sure somebody will understand why. It’s beyond me.

Device triggers are a mystery to me. Does the button have a simple entity, probably a switch, with state on or off?

No. The only entity associated with it is the battery level sensor.

The button presses are available as events.

For example, this listens for a short ‘ON’ button release event:

 
  - platform: event
    event_type: hue_event
    event_data:
      unique_id: long_winded_hue_identifier_code
      event: 1000

Go to Developer Tools > Events, enter “hue_event” in “Listening to” and click “Start Listening”. Perform a few short and long button presses and see what’s reported for each action.

There’s also this but I haven’t seen those exact values reported in the Events viewer.

is this still working? just added a smart button, configure it in the app (to turn on a light) but no events are logged at all?

UPDATE

yes it is working. Apparently it took some time for the switch to trickle down the system, including the battery sensor.

using this now:

automation:

  - alias: Toggle Security system
    id: Toggle security system
    trigger:
      platform: event
      event_type: hue_event
      event_data:
        unique_id: '00:17:redacted-01-fc00'
        event: 1000
    action:
      service: switch.toggle
      target:
        entity_id: switch.security_system

I wonder if the accompanying 1002 event (that always follows the 1000 event) could be turned into something useful?

I can also confirm that it continues to work in 2021.8.8. Here’s the output from the automation I created to monitor Hue Events.

All,

I’m a technical guy, but am still pretty new to HA. That said, I think I may have a pretty large-ish setup already, and DO feel like I know my way around a bit already.

But in that context, I found this post and it’s responses to be a little confusing, and I’m still left not understanding how to integrate a Hue Smart button.

  • I am using ZHA for everything, and this is how the button is integrated into my HA (not through a Hue bridge).
  • I absolutely DO understand that the button creates an event, not a state.
  • I see above the advice and code that @123 has given about how to listen for the event, but no combination of me going the Developer Tools> Events and entering anything like this produces information for me.
  • Is there something I’m needing to code into my congfiguration.yaml or something before I’m able to use this?

Sorry… just really confused at the moment, but I’m pretty confident in my ability to keep up if someone can back up a couple of steps or reference something more.

Thank you!!

EDIT: OK! I got as far as figuring out that I was going to be listening for a ZHA event, vs. Hue event. (Duh). Here’s what ONE, short button press gives me. Now… I just need to figure out what to do with this!

EDIT Number 2: Ok… for anyone that comes looking for this answer from here on it, and didn’t ask questions out loud on a forum like I did, here’s the resolution! It works flawlessly with my ZHA integration of Hue Smart Buttons.