Support for Friends of Hue switch/remote

untill now use the following great custom_component https://github.com/robmarkcole/Hue-remotes-HASS from @robmarkcole to use my Friends of Hue switches (like this one from ABB Busch-Jaeger as remote to control automations in HA (e.g. stop HA automations manually with the foh switch in a room). The Friend of hue switchs are shows in the HUE integration as device but not as entity, so that is per now impossible to use this for automations in HA. I hope it is planed to support this remotes in the riginal HUE integration because the seperate custom_component are now has been archived and seperat ways to adress de hue gatway could cause in diverent timing problems.

here one example for what i use the FoH Switch as remote in HA:

#############################################################
# livingroom automation OFF if FOH switch lower-right pressed
#############################################################
- id: foh-swich-wohnzimmer-automation-off
  alias: Automatisierung Wohnzimmer aus
  trigger:
    - platform: state
      entity_id: remote.wohnzimmer_2
      to: 'right_lower_press'
    - platform: state
      entity_id: remote.wohnzimmer_sofa
      to: '4_click'
  action:
    - service: automation.turn_off
      entity_id: automation.bewegungssensor_wohnzimmer_licht_an_nacht, automation.bewegungssensor_wohnzimmer_licht_an_tag, automation.bewegungssensor_wohnzimmer_radio_an
    - service: media_player.volume_set
      data: 
        entity_id: media_player.radio_wohnzimmer
        volume_level: 0.3
    - service: notify.alexa_media
      data:
        data:
          type: announce
        target: 
          - media_player.radio_wohnzimmer
        message: 'Die Automatisierungen im Wohnzimmer wurden für 6 Stunden unterbrochen'
    - service: light.toggle
      entity_id: light.wohnzimmer_leselampe
    - delay: 00:00:05
    - service: light.toggle
      entity_id: light.wohnzimmer_leselampe
    - delay: 6:00:00
    - service: automation.turn_on
      entity_id: automation.bewegungssensor_wohnzimmer_licht_an_nacht, automation.bewegungssensor_wohnzimmer_licht_an_tag, automation.bewegungssensor_wohnzimmer_radio_an

#############################################################
# livingroom automation ON if FOH switch upper-right pressed
#############################################################
- id: foh-swich-wohnzimmer-automation-on
  alias: Automatisierung Wohnzimmer an
  trigger:
    - platform: state
      entity_id: remote.wohnzimmer_2
      to: 'right_upper_press'
    - platform: state
      entity_id: remote.wohnzimmer_sofa
      to: '1_click'
  action:
    - service: automation.turn_on
      entity_id: automation.bewegungssensor_wohnzimmer_licht_an_nacht, automation.bewegungssensor_wohnzimmer_licht_an_tag, automation.bewegungssensor_wohnzimmer_radio_an
    - service: media_player.volume_set
      data: 
        entity_id: media_player.radio_wohnzimmer
        volume_level: 0.3
    - service: notify.alexa_media
      data:
        data:
          type: announce
        target: 
          - media_player.radio_wohnzimmer
        message: 'Die Automatisierungen im Wohnzimmer wurden wieder aktiviert'
    - service: light.toggle
      entity_id: light.wohnzimmer_leselampe
    - delay: 00:00:05
    - service: light.toggle
      entity_id: light.wohnzimmer_leselampe

While far from ideal, you can create device automations using the UI editor. Actually you can create device automations in yaml, it’s just not what they were intended for.

sorry but the problem is not the way to create automations :wink: but it is impossible to uses FoH and Hue Switches to controll HA function like start automation or other stuff.

The cration of automations over the GUI are good for the beginners but for special requests its more easy to make them direct in yaml files. For example you have a working automation that shot be copyed to other rooms or devices in yaml you could copy this and replace the entity ids. For me the gui are good if this and commenting the automation are possible before this is impossible ife use ge yaml file so long as i can :wink:

No it isn’t. If they are devices you can create device automations.

1 Like

Sorry @tom_l you bring me in the right direction (y) Now i understand i see no entitys but it is possible to create an automation with the device over the UI.

for all other is is nessesary to create an automation over the UI to find out how the friend-of-hue could adress (device Ids are currently not in a spocken forms evailable) and after this you can use this device ID and the structure of command set in existing automations.

here the button assignment for the FoH Switches:

left upper = button_1
left lower = button_2
right uper = button_3
right lower= button_4

for example here the automation from above now with the FoH configuration with the Hue Integration and without seperate custom_component. like the component from @robmarkcole

#############################################################
# Wohnzimme Automatisierung aus wenn FOH Schalter rechts unten gedrückt gehalten
#############################################################
- id: foh-swich-wohnzimmer-automation-off
  alias: Automatisierung Wohnzimmer aus
  trigger:
  - device_id: de624750192a41128131138a1a2bd4a2
    domain: hue
    platform: device
    subtype: button_4
    type: remote_button_short_press
  - device_id: ce8438f1de2d46708f207fa5f5cb9a3c
    domain: hue
    platform: device
    subtype: turn_off
    type: remote_button_short_release
  action:
    - service: automation.turn_off
      entity_id: automation.bewegungssensor_wohnzimmer_licht_an_nacht, automation.bewegungssensor_wohnzimmer_licht_an_tag, automation.bewegungssensor_wohnzimmer_radio_an
    - service: media_player.volume_set
      data: 
        entity_id: media_player.radio_wohnzimmer
        volume_level: 0.3
    - service: notify.alexa_media
      data:
        data:
          type: announce
        target: 
          - media_player.radio_wohnzimmer
        message: 'Die Automatisierungen im Wohnzimmer wurden für 6 Stunden unterbrochen'
    - service: light.toggle
      entity_id: light.wohnzimmer_leselampe
    - delay: 00:00:05
    - service: light.toggle
      entity_id: light.wohnzimmer_leselampe
    - delay: 6:00:00
    - service: automation.turn_on
      entity_id: automation.bewegungssensor_wohnzimmer_licht_an_nacht, automation.bewegungssensor_wohnzimmer_licht_an_tag, automation.bewegungssensor_wohnzimmer_radio_an

#############################################################
# Wohnzimme Automatisierung an wenn FOH Schalter rechts oben gedrückt gehalten
#############################################################
- id: foh-swich-wohnzimmer-automation-on
  alias: Automatisierung Wohnzimmer an
  trigger:
  - device_id: de624750192a41128131138a1a2bd4a2
    domain: hue
    platform: device
    subtype: button_3
    type: remote_button_short_press
  action:
    - service: automation.turn_on
      entity_id: automation.bewegungssensor_wohnzimmer_licht_an_nacht, automation.bewegungssensor_wohnzimmer_licht_an_tag, automation.bewegungssensor_wohnzimmer_radio_an
    - service: media_player.volume_set
      data: 
        entity_id: media_player.radio_wohnzimmer
        volume_level: 0.3
    - service: notify.alexa_media
      data:
        data:
          type: announce
        target: 
          - media_player.radio_wohnzimmer
        message: 'Die Automatisierungen im Wohnzimmer wurden wieder aktiviert'
    - service: light.toggle
      entity_id: light.wohnzimmer_leselampe
    - delay: 00:00:05
    - service: light.toggle
      entity_id: light.wohnzimmer_leselampe
    - delay: 06:00:00

One Problem by doing this is, if you have to disable and re enable the integration the DeviceIDs are changed and it is nessesary to determine the device IDs again and put those in all affected automations. This is a verry bad thing with the Device IDs in the automations instead of entity names. :see_no_evil:

That’s ridiculous. Open an issue on github.

Anyone having luck with the long press trigger? Short work ok, bit slow, but it works. Long press is unreliable and unusable for me.
For completeness, I’m using a Niko FoH EnOcean device, via the official Hue bridge and HA integration.

Just as a matter of interest, you could potentially do this based on ‘hue_event’ type events. The subtype in this shows the button pressed.

{
    "event_type": "hue_event",
    "data": {
        "id": "bedroom_2_wall_switch_button",
        "device_id": "401915c383787c35048d7823d18bab8c",
        "unique_id": "eab8817e-43a4-4d9f-bb7f-cf3584eae3a4",
        "type": "short_release",
        "subtype": 2
    },
    "origin": "LOCAL",
    "time_fired": "2022-05-23T10:00:09.883931+00:00",
    "context": {
        "id": "0180f05c1b9b4eb149442bd7961a23b4",
        "parent_id": null,
        "user_id": null
    }
}
Event 22 fired 11:00:
{
    "event_type": "hue_event",
    "data": {
        "id": "bedroom_2_wall_switch_button",
        "device_id": "401915c383787c35048d7823d18bab8c",
        "unique_id": "eab8817e-43a4-4d9f-bb7f-cf3584eae3a4",
        "type": "initial_press",
        "subtype": 2
    },
    "origin": "LOCAL",
    "time_fired": "2022-05-23T10:00:08.872234+00:00",
    "context": {
        "id": "0180f05c17a8f0b39179bf7cb52ed70e",
        "parent_id": null,
        "user_id": null
    }
}

Thanks. Should indeed be doable with those events and some check in the automation like in this post: Friends of Hue (ABB) switch reporting two events on long button press - Hardware - Home Assistant Community (home-assistant.io)