That’s how I got my Philips friend of hue wallswitch (Feller ediziodue) running. The following functions work perfectly:
- on/off on the same button
- on/off same device on different wallswitch
- use 12 different trigger on 4 buttons
- 4 release (short push)
- 4 press (long push)
- both upper button together (release + press)
- both lower button together (release + press)
- the press and release trigger will not double triggering, by using just the press
My equipment: Hassio on raspberry pi 3b, v0.107, Philips Bridge 2.0, friend of hue wallswitch
First you have to connect your friend of hue wall switch with the philips hue app.
After you have to install this custom component: https://github.com/home-assistant/core/pull/9796
Just copy the files on your home assistant and reboot your system (no yaml configuration)
@ [robmarkcole] you made a great job - thanks a lot
My example, don’t use all the buttons (to keep the script “simple”) and includes the following scenario:
- button 1 on switch 1
- release to turn on / off light 1
- press to start / stops play radio station on a sonos speaker
- button 2 on switch 1
- release to turn on / off light 2
setup in configruation.yaml:
hue:
bridges:
- host: 192.168.xxx.xxx # your IP from Philips HUE bridge
sensor:
- platform: hue
ip_address: 192.168.xxx.xxx # your IP from Philips HUE bridge
token: 53fUFmxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # your token from Philips HUE bridge
- platform: huesensor
- platform: template # a sensor with buttom information, using in the automation
sensors:
switch_1_status:
friendly_name: 'switch_1_status'
value_template: '{{states.sensor.<switchname_in_the_hue_app>.state}}'
- platform: template # a sensor with a timestamp, using in the automation
sensors:
switch_1_update2:
friendly_name: 'switch_1_update2'
value_template: '{{states.sensor.<switchname_in_the_hue_app>.last_updated}}'
input_boolean: # use for: the press and release trigger will not double triggering, by using just the press (this state turn on for a few second, after use the press trigger)
switch_1_lock:
name: 'switch 1 lock'
initial: off
icon: mdi:microsoft
automation:
- alias: 'lamp_1_turn_on'
trigger:
platform: state
entity_id: sensor.switch_1_update2
condition:
- condition: state
entity_id: sensor.switch_1_status
state: "right_upper_release"
- condition: state
entity_id: light.lamp_1
state: 'off'
- condition: state # use for: the press and release trigger will not double triggering, by using just the press (this condition check if use a press for a few second ago)
entity_id: input_boolean.switch_1_lock
state: 'off'
action:
- service: light.turn_on # I don't use toggle because I would like to reset the brightness and color.
data:
entity_id: light.lamp_1
brightness: 255
rgb_color: [255, 255, 255]
- alias: 'lamp_1_turn_off'
trigger:
platform: state
entity_id: sensor.switch_1_update2
condition:
- condition: state
entity_id: sensor.switch_1_status
state: "right_upper_release"
- condition: state
entity_id: light.lamp_1
state: 'on'
- condition: state
entity_id: input_boolean.switch_1_lock
state: 'off'
action:
- service: light.turn_off
data:
entity_id: light.lamp_1
- alias: 'lamp_2_turn_on'
trigger:
platform: state
entity_id: sensor.switch_1_update2
condition:
- condition: state
entity_id: sensor.switch_1_status
state: "right_lower_release"
- condition: state
entity_id: light.lamp_2
state: 'off'
- condition: state
entity_id: input_boolean.switch_1_lock
state: 'off'
action:
- service: light.turn_on
data:
entity_id: light.lamp_2
brightness: 255
rgb_color: [255, 255, 255]
- alias: 'lamp_2_turn_off'
trigger:
platform: state
entity_id: sensor.switch_1_update2
condition:
- condition: state
entity_id: sensor.switch_1_status
state: "right_lower_release"
- condition: state
entity_id: light.lamp_2
state: 'on'
- condition: state
entity_id: input_boolean.switch_1_lock
state: 'off'
action:
- service: light.turn_off
data:
entity_id: light.lamp_2
- alias: 'play_radiostation1'
trigger:
platform: state
entity_id: sensor.switch_1_update2
condition:
- condition: state
entity_id: sensor.switch_1_status
state: "right_upper_press"
- condition: state
entity_id: media_player.room1
state: 'paused'
action:
- service: input_boolean.turn_on # use for: deactivates the release function for a few seconds
data:
entity_id: input_boolean.switch_1_lock
- service: media_player.volume_set
entity_id: media_player.room1
data_template:
volume_level: 0.08
- service: media_player.select_source
data_template:
entity_id: media_player.room1
source: 'Radiostation1'
- service: media_player.play_media
data:
entity_id: media_player.room1
media_content_type: music
- delay: 00:00:03
- service: input_boolean.turn_off # use for: activates the release function after a few seconds
data:
entity_id: input_boolean.switch_1_lock
- alias: 'stop_radiostation1'
trigger:
platform: state
entity_id: sensor.switch_1_update2
condition:
- condition: state
entity_id: sensor.switch_1_status
state: "right_upper_press"
- condition: state
entity_id: media_player.room1
state: 'play'
action:
- service: input_boolean.turn_on
data:
entity_id: input_boolean.switch_1_lock
- service: media_player.media_pause
data:
entity_id: media_player.room1
- delay: 00:00:03
- service: input_boolean.turn_off
data:
entity_id: input_boolean.switch_1_lock
If you have a second wall switch, you can also operate the same devices. Copy both “platform: template” also the automations and change the sensor names.
I know there are solutions with fewer lines (let me know, if you have some inputs), but this solution works quickly and with 99.8% reliability.