Hue dimmer switch in Automations

I had a hard time finding documentation for using the Hue dimmer switch as a Home Assistant switch, so thought I’d document here. A lot of the posts are about the now-deprecated code here. This does not use that github repo at all and instead only uses the official Hue integration

Update: As of 2012.12 HA release, the hue_event data coming from a switch has changed. This is the new instructions with the original below that.

  1. Add the dimmer switch in the Hue app as an accessory. Name it. Don’t associate it with any Hue lights (unless that is how you want it to work)
  2. Assuming you already have the official Hue integration running, I had to restart Home Assistant to get the switch to show up.
  3. Once you’ve restarted HA, you’ll know it is working because you’ll see a battery sensor for the new switch in the entity list, but nothing else about the switch.
  4. In Developer Tools → Events → create a listener for “hue_event”.
  5. Press a button on the hue switch.
  6. The events listener will show you the “id” (entity name) and “type” (“initial_press” usually. They seem to have a short_press as well) and “subtype” (1 for the top dimmer button. 4 for the bottom “off” dimmer button). Note these.
  7. Create an automation (i just used the UI) with type “Event”, put “hue_event” in as the event name, and then in event data put “id: your_id_from_the_listener”, and on a new line, “type: initial_press”, then another new line and subtype: 1 (for on button)

Previous to 2021.12

  1. Add the dimmer switch in the Hue app as an accessory. Name it. Don’t associate it with any Hue lights (unless that is how you want it to work)
  2. Assuming you already have the official Hue integration running, I had to restart Home Assistant to get the switch to show up.
  3. Once you’ve restarted HA, you’ll know it is working because you’ll see a battery sensor for the new switch in the entity list, but nothing else about the switch.
  4. In Developer Tools → Events → create a listener for “hue_event”.
  5. Press a button on the hue switch.
  6. The events listener will show you the “id” (entity name) and “event” (code for button you pressed. Note these. I bet “on” is always 1002 and “off” is always 1004.
  7. Create an automation (i just used the UI) with type “Event”, put “hue_event” in as the event name, and then in event data put “id: your_id_from_the_listener”, and on a new line, “event: 1002” (for on button)
5 Likes

Thank you for sharing this little golden piece of information.

That’s all I need for now and all I found before were overthought scripts.

1 Like

Thanks for this. Solved my issue as well. I like it a lot that it works without requiring the device_id or unique_id.

For extra clarity, the event data would look like this:
Screenshot_20220109_122156