Hey Freddie and everyone.
First of all, thanks for your hard and beautiful work with Hue Tap, especially with the blueprint to make the life easier. I love Hue Taps as I think they can do almost everything what you need for your lights and music in one device. I was trying to use your blueprint, but unfortunately, I can’t set up few things the way I would like to.
I came to slightly different idea, but have no idea how can I achieve it as I don’t have any knowledge it yaml coding or programming at all. So please don’t judge me too much. I was trying to do it in UI itself, but couldn’t get anywhere near. So I’m trying to twist you yaml, but it’s not working too.
My idea is to get rid of the last pressed helper and use a double tap detection as a trigger to related buttons. The main reason for that is. If I used button 1 for lights then I won’t be able adjust volume on button 3 until I press it and if my Sonos if on already it will switch it off and obviously vice versa.
Below is my target for all actions that I would like to archive and yaml with your coding that I’m trying to twist.
Would you mind please to have a look at it what I’m doing wrong as I’m getting error when I’m trying to save the blue print.
Button 1
Press - On/Off Lights
Hold - Favourite Scene - e.g Main Light
Double Press - Activate Dimming
Turn Left/Right for Dimming Up/Down - Main lights
Button 2
Press - Scroll Scenes
Hold - Back to Scene 1
Double Press - Activate Dimming
Turn Left/Right for Dimming Up/Down - Selected lights
Button 3
Press - On/Off Sonos Player
Hold - Change Favourite Radio Station
Double Press - Activate Volume
Turn Left/Right for Volume Up/Down
Button 4
Press - On YouTube Music Playlist Shuffled
Hold - Back to Radio Favourites
Double Press - Activate Action
Turn Left - Previous Track
Turn Right - Next Track
blueprint:
name: Philips Tap Dial
description: Control Actions and Volume for Lights and Media Player
domain: automation
input:
mqtt_topic:
name: MQTT Topic
description: Topic of the Philips Hue Tap Dial Switch
default: zigbee2mqtt/
tap_counter:
name: Counter Helper
description: Create a counter helper within Home Assistant to monitor the number
of button presses on the switch, distinguishing between single and multiple
clicks. This helper can be used for various switches, provided that they are
not pressed at the same time
selector:
entity:
domain:
- counter
multiple: false
button_1_single_press:
name: Button 1 Single Press
description: Action to run on button 1 single press
default: []
selector:
action: {}
button_1_hold:
name: Button 1 Hold
description: Action to run on button 1 hold
default: []
selector:
action: {}
dial_rotate_left_after_double_press_button_1:
name: Dial Left After Double Press Button 1
description: To be controlled with the dial
selector:
action: {}
dial_rotate_right_after_double_press_button_1:
name: Dial Right After Double Press Button 1
description: To be controlled with the dial
selector:
action: {}
button_2_single_press:
name: Button 2 Single Press
description: Action to run on button 2 single press
default: []
selector:
action: {}
button_2_hold:
name: Button 2 Hold
description: Action to run on button 2 hold
default: []
selector:
action: {}
dial_rotate_left_after_double_press_button_2:
name: Dial Left After Double Press Button 1
description: To be controlled with the dial
selector:
action: {}
dial_rotate_right_after_double_press_button_2:
name: Dial Right After Double Press Button 1
description: To be controlled with the dial
selector:
action: {}
button_3_single_press:
name: Button 3 Single Press
description: Action to run on button 3 single press
default: []
selector:
action: {}
button_3_hold:
name: Button 3 Hold
description: Action to run on button 3 hold
default: []
selector:
action: {}
dial_rotate_left_after_double_press_button_3:
name: Dial Left After Double Press Button 1
description: To be controlled with the dial
selector:
action: {}
dial_rotate_right_after_double_press_button_3:
name: Dial Right After Double Press Button 1
description: To be controlled with the dial
selector:
action: {}
button_4_single_press:
name: Button 4 Single Press
description: Action to run on button 4 single press
default: []
selector:
action: {}
button_4_hold:
name: Button 4 Hold
description: Action to run on button 4 hold
default: []
selector:
action: {}
dial_rotate_left_after_double_press_button_4:
name: Dial Left After Double Press Button 1
description: To be controlled with the dial
selector:
action: {}
dial_rotate_right_after_double_press_button_4:
name: Dial Right After Double Press Button 1
description: To be controlled with the dial
selector:
action: {}
mode: parallel
max: 10
max_exceeded: silent
trigger:
- platform: mqtt
topic: !input mqtt_topic
condition:
-
condition: template
value_template: ‘{{ trigger.payload_json.action != ‘’’’ }}’
action: -
variables:
counter_var: !input tap_counter -
choose:
button 1 Action- conditions:
value_template: ‘{{ trigger.payload_json.action is match(’‘^button_1_press$’‘)
}}’
sequence:- if:
- condition: template
value_template: ‘{{ trigger.payload_json.action is match(’‘button_1_single_press’‘)
}}’
then:
- condition: template
- delay:
milliseconds: 250 - if:
- condition: template
value_template: ‘{{ states(counter_var) > ‘‘1’’ }}’
then: - stop: Double tap detected
sequence:- choose:
- conditions:
- condition: template
value_template: ‘{{ trigger.payload_json.action is match(’‘^dial_rotate_left_’‘)
}}’
sequence: !input dial_rotate_left_after_double_press_button_1
- condition: template
- conditions:
- condition: template
value_template: ‘{{ trigger.payload_json.action is match(’‘^dial_rotate_right_’‘)
}}’
sequence: !input dial_rotate_right_after_double_press_button_1
- condition: template
- service: counter.reset
target:
entity_id: ‘{{ counter_var }}’
- conditions:
- choose:
- condition: template
- if:
- conditions:
- condition: template
value_template: ‘{{ trigger.payload_json.action == ‘‘button_1_single_press’’
}}’
sequence: !input button_1_single_press
- condition: template
- delay:
seconds: 1 - service: counter.reset
target:
entity_id: ‘{{ counter_var }}’ - conditions:
- condition: template
value_template: ‘{{ trigger.payload_json.action == ‘‘button_1_hold’’ }}’
sequence: !input button_1_hold
- condition: template
- conditions:
button 2 Action
- conditions:
value_template: ‘{{ trigger.payload_json.action is match(’‘^button_2_press$’‘)
}}’
sequence: - if:
- condition: template
value_template: ‘{{ trigger.payload_json.action is match(’‘button_2_single_press’‘)
}}’
then: - delay:
milliseconds: 250 - if:
- condition: template
value_template: ‘{{ states(counter_var) > ‘‘1’’ }}’
then: - stop: Double tap detected
sequence:- choose:
- conditions:
- condition: template
value_template: ‘{{ trigger.payload_json.action is match(’‘^dial_rotate_left_’‘)
}}’
sequence: !input dial_rotate_left_after_double_press_button_2
- condition: template
- conditions:
- condition: template
value_template: ‘{{ trigger.payload_json.action is match(’‘^dial_rotate_right_’‘)
}}’
sequence: !input dial_rotate_right_after_double_press_button_2
- condition: template
- service: counter.reset
target:
entity_id: ‘{{ counter_var }}’
- conditions:
- choose:
- condition: template
- condition: template
- conditions:
- condition: template
value_template: ‘{{ trigger.payload_json.action == ‘‘button_2_single_press’’
}}’
sequence: !input button_2_single_press - delay:
seconds: 1
- condition: template
- service: counter.reset
target:
entity_id: ‘{{ counter_var }}’ - conditions:
- condition: template
value_template: ‘{{ trigger.payload_json.action == ‘‘button_2_hold’’ }}’
sequence: !input button_2_hold
- condition: template
button 3 Action
- conditions:
value_template: ‘{{ trigger.payload_json.action is match(’‘^button_3_press$’‘)
}}’
sequence: - if:
- condition: template
value_template: ‘{{ trigger.payload_json.action is match(’‘button_3_single_press’‘)
}}’
then: - delay:
milliseconds: 250 - if:
- condition: template
value_template: ‘{{ states(counter_var) > ‘‘1’’ }}’
then: - stop: Double tap detected
sequence:- choose:
- conditions:
- condition: template
value_template: ‘{{ trigger.payload_json.action is match(’‘^dial_rotate_left_’‘)
}}’
sequence: !input dial_rotate_left_after_double_press_button_3
- condition: template
- conditions:
- condition: template
value_template: ‘{{ trigger.payload_json.action is match(’‘^dial_rotate_right_’‘)
}}’
sequence: !input dial_rotate_right_after_double_press_button_3
- condition: template
- service: counter.reset
target:
entity_id: ‘{{ counter_var }}’
- conditions:
- choose:
- condition: template
- condition: template
- conditions:
- condition: template
value_template: ‘{{ trigger.payload_json.action == ‘‘button_3_single_press’’
}}’
sequence: !input button_3_single_press - delay:
seconds: 1 - service: counter.reset
target:
entity_id: ‘{{ counter_var }}’
- condition: template
- conditions:
- condition: template
value_template: ‘{{ trigger.payload_json.action == ‘‘button_3_hold’’ }}’
sequence: !input button_3_hold
- condition: template
button 4 Action
- conditions:
value_template: ‘{{ trigger.payload_json.action is match(’‘^button_4_press$’‘)
}}’
sequence: - if:
- condition: template
value_template: ‘{{ trigger.payload_json.action is match(’‘button_4_single_press’‘)
}}’
then: - delay:
milliseconds: 250 - if:
- condition: template
value_template: ‘{{ states(counter_var) > ‘‘1’’ }}’
then: - stop: Double tap detected
sequence:- choose:
- conditions:
- condition: template
value_template: ‘{{ trigger.payload_json.action is match(’‘^dial_rotate_left_’‘)
}}’
sequence: !input dial_rotate_left_after_double_press_button_4
- condition: template
- conditions:
- condition: template
value_template: ‘{{ trigger.payload_json.action is match(’‘^dial_rotate_right_’‘)
}}’
sequence: !input dial_rotate_right_after_double_press_button_4
- condition: template
- service: counter.reset
target:
entity_id: ‘{{ counter_var }}’
- conditions:
- choose:
- condition: template
- condition: template
- conditions:
- condition: template
value_template: ‘{{ trigger.payload_json.action == ‘‘button_4_single_press’’
}}’
sequence: !input button_4_single_press
- condition: template
- delay:
seconds: 1 - service: counter.reset
target:
entity_id: ‘{{ counter_var }}’ - conditions:
- condition: template
value_template: ‘{{ trigger.payload_json.action == ‘‘button_4_hold’’ }}’
sequence: !input button_4_hold
- condition: template