Action trigger - friends of hue switch

Hello!

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: ''
  trigger:
    platform: event
    event_type: left_upper_release
    event_data:
      entity_id: remote.loungeswitch1
  condition: []
  action:
  - 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:
image

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

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

Thanks!

Hi,

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

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

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