Action trigger - friends of hue switch


Disclaimer - very new to HA but I’ve found answers to many of my questions via the forum so thank you :slight_smile: Not for the following one, though.

I have a Niko switch along with two hue bridges (reason for getting started with HA) and a bunch of philips hue lights. I want to turn on a series of lights via the switch, but have some difficulty getting an automation working correctly.

The Niko switches are discoverable by using the “hue sensor advanced” package as suggested here here

The action is a custom rest command because hue.hue_activate_scene doesn’t work for two bridges.

So far I have:

- id: '1587713344024'
  alias: Turn living room lights on
  description: ''
    platform: event
    event_type: left_upper_release
      entity_id: remote.loungeswitch1
  condition: []
  - data:
      huegroupid: '7'
      huesceneid: xxxx
    service: rest_command.set_hue_1_scene

The action is working correctly when I program a “state” change in as action - however it is a little temperamental as the state needs to be “high” for a period before the action will fire - so when you push the switch often nothing happens. Setting “for: 00:00:00.5” doesn’t really help. Hence trying to use the event trigger. In the entities card you can see that the event registers perfectly every time so the problem is not here. Can anyone suggest what I’m doing wrong?

Thank you!

Hi guys

So nobody have run into this before? Here’s some more info, i really hope somebody can help.

Here’s the entity:

If a button is pressed, the state cycles through “xx_yy_pressed” and then “xx_yy_released”, both states are registered. e.g.:

How do I get home assistant to react to the state change, not just the minimum length of time the state is active.



I use this script to trigger an actio on the buttons of a Hue Dimmer switch.

- alias: Sonos Kitchen aan
    platform: state
    entity_id: sensor.sw_sonos_keuken
    condition: state
    entity_id: sensor.sw_sonos_keuken
    state: '1_click_up'
    - service: media_player.media_play

Main difference with your solution is the Condition section, That’s what I use to get it triggered on the state.