Not entirely sure about the product, it is integrated into a 3D printed battery powered switch from danish company called “Lab3D”. They produce this, no matter which “friends of hue” switch I chose during setup.
I have previously tried other versions, they behaved the same. Reason Im not using those today is they were of poor quality, hence stopped working due to mechanical problems.
If you send me the “codes pr switch” and check the “long press code/codes”, then I believe I can easily change the blueprint.
I have ha running through a virtual machine on a nas.
I have fed the philips hue via the philips hue bridge to ha.
And now I would like to program the foh switch via ha.
I’m just stuck on how best to do this.
I managed to make the blueprint.
Only I don’t understand how I have to proceed now to be able to activate multiple scenes in succession.
1st press welcome.
2nd press eat.
3rd press bright light.
etc.
Can I now also set via ha to adjust the light strength by holding the button.
You can easily create several actions for each button/press, just create them in the blueprint. If you need a delay, then use the delay service. The service calls are the normal once, which can be used in all automations.
For dim up or dim down, you can use the “repeate”, and set an action to increate or decrease light. It will trigger app 2 times a second.
With HA version 2023.08 the Hue integration includes button entities. Hence, I have created a new version of the blueprint. It solves a number of issues
Buttons can be chosen directly in the blueprint. No need for finding the device number
Possiblity to chose multible buttons for each action. Solves the issue with 2 or more switches in a room. Just select the buttons from each and they will get the same actions
No need for creating the helper any more:-)
Here we go
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'
EDIT: Small typo, resulting in long_release not triggering correctly. Works now
I’ve added the possibility to define double click actions. There is an additional input, which is an input number and defines the maximal time between to button presses to be evaluated as double click.
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-double-press-time:
name: "Double press time span"
description: "Maximal time between two button presses to count as double press"
selector:
entity:
domain: input_number
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_double_press:
name: Double Press 1
description: Action to run on button upper-left initial double press
default: []
selector:
action: {}
button_2_double_press:
name: Double Press 2
description: Action to run on button lower-left initial double press
default: []
selector:
action: {}
button_3_double_press:
name: Double Press 3
description: Action to run on button upper-right initial double press
default: []
selector:
action: {}
button_4_double_press:
name: Double Press 4
description: Action to run on button lower-right initial double 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 }}'
hue_double_press_seconds: !input 'hue-double-press-time'
# switch_from_ID: '{{ trigger.entity_id }}'
- choose:
- conditions: '{{ switch_to_state == ''initial_press'' }}'
sequence:
- choose:
- conditions: '{{ switch_id == ''B1'' }}'
sequence:
- if: { condition: template, value_template: "{{ true }}" }
then: !input 'button_1_press'
- wait_for_trigger:
- platform: state
entity_id: !input 'hue-switch-button1'
timeout:
seconds: "{{ states('hue_double_press_time') | int }}"
continue_on_timeout: false
- if: { condition: template, value_template: "{{ true }}" }
then: !input 'button_1_double_press'
- conditions: '{{ switch_id == ''B2'' }}'
sequence:
- if: { condition: template, value_template: "{{ true }}" }
then: !input 'button_2_press'
- wait_for_trigger:
- platform: state
entity_id: !input 'hue-switch-button2'
timeout:
seconds: 2
continue_on_timeout: false
- if: { condition: template, value_template: "{{ true }}" }
then: !input 'button_2_double_press'
- conditions: '{{ switch_id == ''B3'' }}'
sequence:
- if: { condition: template, value_template: "{{ true }}" }
then: !input 'button_3_press'
- wait_for_trigger:
- platform: state
entity_id: !input 'hue-switch-button3'
timeout:
seconds: 2
continue_on_timeout: false
- if: { condition: template, value_template: "{{ true }}" }
then: !input 'button_3_double_press'
- conditions: '{{ switch_id == ''B4'' }}'
sequence:
- if: { condition: template, value_template: "{{ true }}" }
then: !input 'button_4_press'
- wait_for_trigger:
- platform: state
entity_id: !input 'hue-switch-button4'
timeout:
seconds: 2
continue_on_timeout: false
- if: { condition: template, value_template: "{{ true }}" }
then: !input 'button_4_double_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'
However, if there is a normal short press on the switch, the sequence will always preform the initial press, the short release and the double press. The double press, as It waits for a state trigger, which be the “short-release” and then performs the “double press” actions, along with the 2 other actions.
The idea is good and I might look into implementing a double press when I get some time during a rainy day.
Your version of the blueprint do NOT work any more, as of HA version 2023.08. As described in “post 1” you need to use the blueprint from “post 32”. Just copy the new blueprint on top of the existing.
copied the wrong text again. Sorry. I will continue with this this week, thank you in advance. I will make sure that I paste the English text from now on.
You can use the “repeat” to run an action which dim-/dim+. I do not use it, hence have not tried my self. I use the switch only for scenes.
The “light.on” service use the brightness_step_pct. Easy to find in the GUI when defining the service call. Remember the “repeat” will run app 2 times a second.