Philips Hue, Friends of Hue switch 4 buttons for Hue Integration

A blueprint for “Friends of Hue” switch, connected through the Hue integration. Need HA version 2023.08 or newer.

It supports all states of the switch for all 4 buttons

  • Initial Press
  • repeat
  • short release
  • long release

The blueprint is below. Create a .yaml file in your blueprints/automations directory and copy the below text. For HA to read the dictory, either restart or reload automations.

For easier usage, here is a link to the blueprint on Github. The link is provided by @ mertodinlo
Friends Of Hue switch, 4 button, all functions Blueprint

A more advance version with a lot of additional functions is include in post 69. Provided by @ SmartHomeVoyager

blueprint:
  name: Hue, Friends Of Hue switch, 4 button, all functions
  description: >
    HA version 2023.08 or newer

    Works with all functions

    Correct the problem of "short release" triggered on the same time as "long release"

    If multible switches needing the same functionality, select multible 

  domain: automation
  input:
    hue-switch-button1:
      name: "Hue Switch button 1"
      description: "Upper Left"
      selector:
        entity:
          device_class: button
          multiple: true 
    hue-switch-button2:
      name: "Hue Switch button 2"
      description: "Lower Left"
      selector:
        entity:
          device_class: button
          multiple: true
    hue-switch-button3:
      name: "Hue Switch button 3"
      description: "Upper Right"
      selector:
        entity:
          device_class: button
          multiple: true
    hue-switch-button4:
      name: "Hue Switch button 4"
      description: "Lower Right"
      selector:
        entity:
          device_class: button
          multiple: true
    button_1_short_release:
      name: Short Release 1
      description: Action to run on button upper-left short release
      default: []
      selector:
        action: {}
    button_2_short_release:
      name: Short Release 2
      description: Action to run on button lower-left short release
      default: []
      selector:
        action: {}
    button_3_short_release:
      name: Short Release 3
      description: Action to run on button upper-right short release
      default: []
      selector:
        action: {}
    button_4_short_release:
      name: Short Release 4
      description: Action to run on button lower-right short release
      default: []
      selector:
        action: {}
        
    button_1_long_release:
      name: Long Release 1
      description: Action to run on button upper-left long release
      default: []
      selector:
        action: {}
    button_2_long_release:
      name: Long Release 2
      description: Action to run on button lower-left long release
      default: []
      selector:
        action: {}
    button_3_long_release:
      name: Long Release 3
      description: Action to run on button upper-right long release
      default: []
      selector:
        action: {}
    button_4_long_release:
      name: Long Release 4
      description: Action to run on button lower-right long release
      default: []
      selector:
        action: {}

    button_1_press:
      name: Press 1
      description: Action to run on button upper-left initial press
      default: []
      selector:
        action: {}
    button_2_press:
      name: Press 2
      description: Action to run on button lower-left initial press
      default: []
      selector:
        action: {}
    button_3_press:
      name: Press 3
      description: Action to run on button upper-right initial press
      default: []
      selector:
        action: {}
    button_4_press:
      name: Press 4
      description: Action to run on button lower-right initial press
      default: []
      selector:
        action: {}

    button_1_repeat:
      name: Repeat 1
      description: Action to run on button upper-left repeat
      default: []
      selector:
        action: {}
    button_2_repeat:
      name: Repeat 2
      description: Action to run on button lower-left repeat
      default: []
      selector:
        action: {}
    button_3_repeat:
      name: Repeat 3
      description: Action to run on button upper-right repeat
      default: []
      selector:
        action: {}
    button_4_repeat:
      name: Repeat 4
      description: Action to run on button lower-right repeat
      default: []
      selector:
        action: {}

mode: queued
max: 10

trigger:
- platform: state
  entity_id: !input 'hue-switch-button1'
  id: B1
- platform: state
  entity_id: !input 'hue-switch-button2'
  id: B2
- platform: state
  entity_id: !input 'hue-switch-button3'
  id: B3
- platform: state
  entity_id: !input 'hue-switch-button4'
  id: B4

action:
- variables:
    switch_to_state: '{{ trigger.to_state.attributes.event_type }}'
    switch_from_state: '{{ trigger.from_state.attributes.event_type }}'
    switch_id: '{{ trigger.id }}'
    #    switch_from_ID: '{{ trigger.entity_id }}'
- choose:
  - conditions: '{{ switch_to_state == ''initial_press'' }}'
    sequence:
    - choose:
      - conditions: '{{ switch_id == ''B1'' }}'
        sequence: !input 'button_1_press'
      - conditions: '{{ switch_id == ''B2'' }}'
        sequence: !input 'button_2_press'
      - conditions: '{{ switch_id == ''B3'' }}'
        sequence: !input 'button_3_press'  
      - conditions: '{{ switch_id == ''B4'' }}'
        sequence: !input 'button_4_press'

  - conditions: '{{ switch_to_state == ''repeat'' }}'
    sequence:
    - choose:
      - conditions: '{{ switch_id == ''B1'' }}'
        sequence: !input 'button_1_repeat'
      - conditions: '{{ switch_id == ''B2'' }}'
        sequence: !input 'button_2_repeat'
      - conditions: '{{ switch_id == ''B3'' }}'
        sequence: !input 'button_3_repeat'
      - conditions: '{{ switch_id == ''B4'' }}'
        sequence: !input 'button_4_repeat'

  - conditions: '{{ switch_to_state == ''long_release'' }}'
    sequence:
    - choose:
      - conditions: '{{ switch_id == ''B1'' }}'
        sequence: !input 'button_1_long_release'
      - conditions: '{{ switch_id == ''B2'' }}'
        sequence: !input 'button_2_long_release'
      - conditions: '{{ switch_id == ''B3'' }}'
        sequence: !input 'button_3_long_release'
      - conditions: '{{ switch_id == ''B4'' }}'
        sequence: !input 'button_4_long_release'

  - conditions: '{{ switch_to_state == ''short_release'' }}'
    sequence:
    - choose:
      - conditions: '{{ switch_from_state == ''initial_press'' }}'
        sequence: 
          - choose:
            - conditions: '{{ switch_id == ''B1'' }}'
              sequence: !input 'button_1_short_release'
            - conditions: '{{ switch_id == ''B2'' }}'
              sequence: !input 'button_2_short_release'
            - conditions: '{{ switch_id == ''B3'' }}'
              sequence: !input 'button_3_short_release'
            - conditions: '{{ switch_id == ''B4'' }}'
              sequence: !input 'button_4_short_release'
7 Likes

Thank you for this blueprint.

With FOH switches you can press two buttons (1+2 and 3+4) at the same time and these creates additional events.

Do you have planned to add this feature?

See: deCONZ - Philips Friends of Hue Smart Switch (4 buttons)

I was not aware about these separate events. I will look into this during the weekend, a very nice feature.

Tried to get the events from the two buttom press. I can not get any events specifically for this. If I press 1+3 (the 2 top once), then I get a event with subtype 1 and one with subtype 3. The same for the 2 button below. I have also tried the 1+4, and this do not give any events.

Can you try on you device? Listen for hue_event and look at the type and subtype.

If your device have more subtypes, then it will be easy to implement. Mine do not.

I am sorry. I can’t help you, because I am using the deConz-Addon. But I can take a look on the deconz_event.

Be aware this blueprint is for switches connected through the Hue Integtation.

I just got a Senic + Gira Friends of Hue Switch and connected it to my philips hue bridge which is added to home assistant via the official integration.

When testing the events I stumbled upon the short press problem and so your post here.

There seems to be no event trigger for pressing both buttons (1+3 or 2+4 at the same time). Instead I get no event at all when in the home assistant when listening to hue_event and pressing them at the same time. One by one does work and gives me the subtypes 1-4.
eg:

Strange to me is that the Single Rocker feature (1+3 or 2+4) seems to be removed out of the philips hue integration.
At least it does not show me when setting up a automation

Altough it seems like this was the case (or maybe still is? Maybe im missing something?)
I found this video (7:27) where there have been the triggers “Both First and 3 Button released” as well as “Both First and 3 Button long released”.
But no Holding Button 1-4 Trigger

It seems like they have done a lot of changes in the philips hue integratin regarding the avaible events/triggers of Friend of Hue Buttons

Sorry for the screenshot as well as the video beeing german.
I hope you still get my point.

Agree, it is a earlier version which had the 1+3. So, we have to live with the current possibilities.

But why are they removing features :sleepy:

Would have been nice when using the single rocker option.
Probably gonna go with the double rocker then.

Nevertheless now gonna try out your blueprint. Thx for sharing and the quick response

Created an account just to make a like and comment that this worked as intended. :slightly_smiling_face:
Thanks

1 Like

Hi,

the blueprint is great. However I have 2 questions:

  1. If I have already configured the switch in the Hue app, do I need to reset if first in the Hue app? Will the Hue config and this blueprint clash if both are configured?

  2. I don’t quite get the difference between the 4 types of press

  • What is the difference between short release and initial press
  • What is repeat? Is that like double press?
  • Is long release the same as pressing and holding? Can I use this for continuous dimming?

At the end of the day I would like to press and hold and while I am holding the lights dimm up or down until I release the button. Which one do I need for that?

Thanks for your help!

1 Like

If you have automations in both the hue system and in HA, they will both fire. This blueprint have no knowledge about the hue app. I actually use the hue app for the actual light control, and then use HA automations for other stuff, like setting music on long press etc

Initial press is when you press the button
Short_release is when you release the button after a short time
Long_release is when you release after some time, I do not know the exact time, however something like 1 sec
Repeat, is a command send from the button repeated when you hold the button. Not sure about the period between, however several every second.

You can use the repeat to make the light dim a little every time it fires. Personally I do the dimming in the hue app, much easier.

Thank you for this blueprint!
I am using the FOH Switch from Niko (Niko dimschakelaar voor het Hue systeem Niko Intense matt black) connected through the Hue integration. I can see in my devices and it registers the different actions.
However, it does not show up in the blueprint under ‘Device’? Any hints on how to get this to work?

This part of the blueprint limits to devices called “PhilipsFoH”. I believed that all FoH switches would get this name. The only reason to include this in the blueprint is to limit the device list.

  1. Find the right manufactor name of the switch, and change the blueprint on your local machine.
  1. It might also work like this, however can not check now.
    hue-4-button-switch:
      name: Hue Frinds of 4-Button Switch
      description: Hue Frinds of 4-Button Switch
      selector:
        device:

It is the right manufacterer, that’s why I thought it was odd. It seems that it does not pop up in the devices list if I ommit the ‘maufacturer’ from the selector. Strange.

       "id": "redacted-adbab663-5b75-4adb-a047-49a05f551a75",
        "id_v1": "/sensors/2",
        "product_data": {
          "model_id": "FOHSWITCH",
          "manufacturer_name": "PhilipsFoH",
          "product_name": "Friends of Hue Switch",
          "product_archetype": "unknown_archetype",
          "certified": true,
          "software_version": "0.0.0"
        },
        "metadata": {
          "name": "Friends of Hue Switch 1",
          "archetype": "unknown_archetype"
        },
        "services": [
          {
            "rid": "feb2bc9e-4296-4a9e-9942-f6683116deaf",
            "rtype": "button"
          },
          {
            "rid": "36c038f6-7845-4013-8971-faa1a91af876",
            "rtype": "button"
          },
          {
            "rid": "83928dd5-16a5-4614-9933-d32a749fd818",
            "rtype": "button"
          },
          {
            "rid": "11123b19-3dcc-498f-993b-487658fa5b65",
            "rtype": "button"
          },
          {
            "rid": "a9e7cdcd-677b-4d9a-850d-2e3746cd3e49",
            "rtype": "zgp_connectivity"
          }
        ],
        "type": "device"
      },

This is strange. I have the same problem if I try to create a new blueprint, however my already existing once work.

Without the selector “manufactor” I get a list of all other devices, however non of my Friends of Hue switches. Like they do not registre correctly as devices. It was working in december. Normally I just change the existing automation.

I will have a look at this during the weekend, however not sure how to solve it for now.

Due to a change in how the Hue integration populates FoH devices, this have become a bit more compliacted to create a new automation, however it still works with all features and easy to change afterwards.

The device ID need to be obtained. There might exist other simple methods, im open for suggestion.

  1. Go to “Developer Tools”, and to “Events”. In the “Listen to events” put in “Hue_event”.
  2. Press a button on the FoH switch. Does not matter which on
  3. In the developer tools page the events will be shown. Copy the device ID. It will look something like
event_type: hue_event
data:
  id: kokken_kontakt_button
  device_id: 7a6eb279e4b55328282e219a5d1c9144
  unique_id: b7b2b0e1-f2b6-4adb-8d89-9ed8a6656205
  type: repeat

Copy the device_id. In above example this part “7a6eb279e4b55328282e219a5d1c9144”, however the number will be unique for your switch. You need this part when creating the automation

The new Blueprint is below. Use this instead of the original.

blueprint:
  name: Friends of Hue 4 Button All functions (Corrected Long Press) 
  description: Automate your Friends of Hue 4 Button switch using Hue integration with short and long press. Be aware input.helper need to be created before automation works with corect long press
  domain: automation
  input:
    helper-remember-longrelease:
      name: Input.helper to remember longrelease
      description: A toggled helper, created through "settings - devices - helpers - create helpers". The helper can have whatever name
      selector:
        entity:
          domain: input_boolean

#    hue-4-button-switch:
#      name: Hue Frinds of 4-Button Switch
#      description: Hue Frinds of 4-Button Switch
#      selector:
#        device:
#          manufacturer: PhilipsFoH

    hue-4-button-switch:
      name: Unique ID
      description: "Unique ID, find in Hue-event"
      default: ""

    button_1_short_release:
      name: Short Release 1
      description: Action to run on button upper-left short release
      default: []
      selector:
        action: {}
    button_2_short_release:
      name: Short Release 2
      description: Action to run on button lower-left short release
      default: []
      selector:
        action: {}
    button_3_short_release:
      name: Short Release 3
      description: Action to run on button upper-right short release
      default: []
      selector:
        action: {}
    button_4_short_release:
      name: Short Release 4
      description: Action to run on button lower-right short release
      default: []
      selector:
        action: {}
        
    button_1_long_release:
      name: Long Release 1
      description: Action to run on button upper-left long release
      default: []
      selector:
        action: {}
    button_2_long_release:
      name: Long Release 2
      description: Action to run on button lower-left long release
      default: []
      selector:
        action: {}
    button_3_long_release:
      name: Long Release 3
      description: Action to run on button upper-right long release
      default: []
      selector:
        action: {}
    button_4_long_release:
      name: Long Release 4
      description: Action to run on button lower-right long release
      default: []
      selector:
        action: {}

    button_1_press:
      name: Press 1
      description: Action to run on button upper-left initial press
      default: []
      selector:
        action: {}
    button_2_press:
      name: Press 2
      description: Action to run on button lower-left initial press
      default: []
      selector:
        action: {}
    button_3_press:
      name: Press 3
      description: Action to run on button upper-right initial press
      default: []
      selector:
        action: {}
    button_4_press:
      name: Press 4
      description: Action to run on button lower-right initial press
      default: []
      selector:
        action: {}

    button_1_repeat:
      name: Repeat 1
      description: Action to run on button upper-left repeat
      default: []
      selector:
        action: {}
    button_2_repeat:
      name: Repeat 2
      description: Action to run on button lower-left repeat
      default: []
      selector:
        action: {}
    button_3_repeat:
      name: Repeat 3
      description: Action to run on button upper-right repeat
      default: []
      selector:
        action: {}
    button_4_repeat:
      name: Repeat 4
      description: Action to run on button lower-right repeat
      default: []
      selector:
        action: {}

mode: queued
max: 10

trigger:
- platform: event
  event_type: hue_event
  event_data:
    device_id: !input hue-4-button-switch
action:
- variables:
    type: '{{ trigger.event.data.type }}' 
    subtype: '{{ trigger.event.data.subtype }}'


- choose:
  - conditions: '{{ type == ''initial_press'' }}'
    sequence:
    - service: input_boolean.turn_on
      target:
        entity_id: !input 'helper-remember-longrelease'
    - choose:
      - conditions: '{{ subtype == 1 }}'
        sequence: !input 'button_1_press'
      - conditions: '{{ subtype == 2 }}'
        sequence: !input 'button_2_press'
      - conditions: '{{ subtype == 3 }}'
        sequence: !input 'button_3_press'  
      - conditions: '{{ subtype == 4 }}'
        sequence: !input 'button_4_press'

  - conditions: '{{ type == ''short_release'' }}'
    sequence:
    - choose:
      - conditions: 
          - condition: state
            entity_id: !input 'helper-remember-longrelease'
            state: "on"
        sequence: 
          - choose:
            - conditions: '{{ subtype == 1 }}'
              sequence: !input 'button_1_short_release'
            - conditions: '{{ subtype == 2 }}'
              sequence: !input 'button_2_short_release'
            - conditions: '{{ subtype == 3 }}'
              sequence: !input 'button_3_short_release'
            - conditions: '{{ subtype == 4 }}'
              sequence: !input 'button_4_short_release' 

  - conditions: '{{ type == ''repeat'' }}'
    sequence:
    - service: input_boolean.turn_off
      target:
        entity_id: !input 'helper-remember-longrelease'
    - choose:
      - conditions: '{{ subtype == 1 }}'
        sequence: !input 'button_1_repeat'
      - conditions: '{{ subtype == 2 }}'
        sequence: !input 'button_2_repeat'
      - conditions: '{{ subtype == 3 }}'
        sequence: !input 'button_3_repeat'
      - conditions: '{{ subtype == 4 }}'
        sequence: !input 'button_4_repeat'

  - conditions: '{{ type == ''long_release'' }}'
    sequence:
    - choose:
      - conditions: '{{ subtype == 1 }}'
        sequence: !input 'button_1_long_release'
      - conditions: '{{ subtype == 2 }}'
        sequence: !input 'button_2_long_release'
      - conditions: '{{ subtype == 3 }}'
        sequence: !input 'button_3_long_release'
      - conditions: '{{ subtype == 4 }}'
        sequence: !input 'button_4_long_release'


1 Like

New version created. I might report this as a error on the hue integration page at some point.

@khvej8 Love this! Using multiple cheaper FoH toggles and this is a great addition to control my Shelly relays! Thanks!

Two questions:

  • Is there not real long press action available?
  • Added the Hass Sky Connect for Zigbee devices last week but it’s obvisouly not possible to pair a FoH toggle with Hass directly using ZHA and the Sky Connect. Any experience around?

In the first post the possibilities are mentioned, all covered by the blueprint. Unfortunately there is not an “even longer longrelease” or a “double click” which would also be nice.

I have not tried to connect my FoH switches to a native zigbee network. There are some post about this and they are supported using Zigbee2MQTT. Look in this link: EnOcean PTM 215Z control via MQTT | Zigbee2MQTT
Be aware the blueprint will not work, as it use Hue integration events, and not MQTT events.

1 Like