I copied this together from the blueprint and some scripts - hope you can make sense of it.
The helper called input_number.hue_tapdialswitch_02_selection
holds the value which button has just been pushed.
Here is the part of the blueprint that toggles the entity or selects it for the volume/brightness to be adjusted:
alias: Hue TapDialSwitch 02 - Actions
description: ""
use_blueprint:
path: freakshock88/philips_hue_tap_dial_switch_zigbee2mqtt_actions_blueprint.yaml
input:
button_sensor: sensor.hue_tapdialswitch_02_action
remote_button_1_single_press:
- service: input_number.set_value
data:
value: 1
target:
entity_id: input_number.hue_tapdialswitch_02_selection
enabled: true
remote_button_2_single_press:
- service: input_number.set_value
data:
value: 2
target:
entity_id: input_number.hue_tapdialswitch_02_selection
enabled: true
remote_button_1_hold_release:
- service: light.toggle
data: {}
target:
entity_id:
- light.patio_lights
remote_button_2_hold_release:
- service: media_player.toggle
data: {}
target:
entity_id:
- media_player.allhome
And this is the same piece as in my previous post, just for TapDialSwitch_02 instead of _01 - note the repeat (or lack thereof) for the ‘direction_step’, ‘direction_slow’ vs. ‘direction_fast’:
remote_dial_rotate_right_step:
- service: script.turn_on
data: {}
target:
entity_id:
- script.tapdialswitch_02_turn_up
remote_dial_rotate_right_slow:
- repeat:
count: "2"
sequence:
- service: script.turn_on
data: {}
target:
entity_id: script.tapdialswitch_02_turn_up
remote_dial_rotate_right_fast:
- repeat:
count: "3"
sequence:
- service: script.turn_on
data: {}
target:
entity_id: script.tapdialswitch_02_turn_up
remote_dial_rotate_left_step:
- service: script.turn_on
data: {}
target:
entity_id:
- script.tapdialswitch_02_turn_down
remote_dial_rotate_left_slow:
- repeat:
count: "2"
sequence:
- service: script.turn_on
data: {}
target:
entity_id: script.tapdialswitch_02_turn_down
remote_dial_rotate_left_fast:
- repeat:
count: "3"
sequence:
- service: script.turn_on
data: {}
target:
entity_id: script.tapdialswitch_02_turn_down
Here are the scripts that adjust either brightness or volume, depending on the helper value.
Increase brightness/volume:
alias: TapDialSwitch 02 - Turn Up
sequence:
- if:
- condition: state
entity_id: input_number.hue_tapdialswitch_02_selection
state: "1.0"
then:
- service: script.turn_on
data: {}
target:
entity_id: script.patio_lights_brightness_up
else:
- service: script.turn_on
data: {}
target:
entity_id: script.allhome_volume_up
mode: queued
max: 5
Decrease brightness/volume:
alias: TapDialSwitch 02 - Turn Down
sequence:
- if:
- condition: state
entity_id: input_number.hue_tapdialswitch_02_selection
state: "1.0"
then:
- service: script.turn_on
data: {}
target:
entity_id:
- script.patio_lights_brightness_down
else:
- service: script.turn_on
data: {}
target:
entity_id:
- script.allhome_volume_down
mode: queued
max: 5
I only have the need for switching/adjusting two entities, the light on button 1 for brightness and the allhome media player for on button 2 volume - I understand that this section would get much more complicated (with nested if-then-else code) if I needed more than two entities, i.e. wanted to use more than 2 buttons on the TapDialSwitch to invoke turning items up or down.
The scripts for the volume adjustment are in a previous post, the ones for brightness are below:
alias: Patio Lights Brightness Up
sequence:
- service: light.turn_on
data:
brightness_step: 10
target:
entity_id:
- light.patio_lights
mode: queued
icon: mdi:lightbulb-on-30
max: 5
alias: Patio Lights Brightness Down
sequence:
- service: light.turn_on
data:
brightness_step: -10
target:
entity_id:
- light.patio_lights
mode: queued
icon: mdi:lightbulb-on-30
max: 5
I’m sure there is massive room for improvement, but I’m happy that I got it to this point
Hope that helps.