silashansen
(Silas Hansen)
September 13, 2023, 7:14pm
1
I created this blueprint to be able to quickly setup a Philips Hue Tap Dial with the following basic functionality of a sonos system:
Volume (smoothly follows the dial speed)
Play / Pause
Next / Previous
For ultimate simplicity , I did not open this up to all sorts of other actions for the buttons. If that is what you need, then you are better off with some of the other blueprints that offer this.
I based this off the following blueprint by freakshock88 - thank you for the inspiration.
Smooth volume adjustment
This blueprint takes care of the volume adjustment to make the experience extra smooth. If I had let it be up to the user to make a service call to increase/decrease the volume, then it wouldn’t be the same great experience, as it requires a bit of logic to make it smooth depending on how fast you turn the dial.
Technical details:
The blueprint will automatically adjust the volume of ALL the speakers in the current sonos group belonging to the controller unit you select.
To configure this blueprint, you need to set the following two input entities:
Sonos controller unit (a speaker device)
Philips Hue Tap Dial _action entity
Import the blueprint directly from here:
Blueprint here:
blueprint:
name: Phlips Tap Dial Sonos Controller
description: "Use Philips Tap Dial to control Sonos.
Use an entity id which ends with '_action', e.g. 'sensor.bedroom_bed_tap_dial_switch_action'"
domain: automation
input:
button_sensor:
name: Philips Hue Tap dial switch sensor entity
description:
Sensor for Philips Hue Tap dial switch to use (Use sensor with
entity_id ends with _action)
selector:
entity:
multiple: false
filter:
- domain: sensor
sonos_controller:
name: Sonos controller device
This file has been truncated. show original
1 Like
dontinelli
(Dontinelli)
November 15, 2023, 1:07pm
2
I wanted to use this blueprint. Unfortunately it seems that it does not work with ZHA, as I do not have the sensor with “_action”. Has anyone been able to adapt it to a ZHA enviroment?
dontinelli
(Dontinelli)
November 16, 2023, 6:45pm
3
I managed to combine the above blueprint with one from @GordonFreemanK (https://github.com/GordonFreemanK/ha-blueprints/blob/ad373f6357d38c756c5a3382ab83ae2fdfe712be/hue_tap_dial_switch.yaml ):
blueprint:
name: Philips Hue Tap Dial Switch Sonos Controller (ZHA)
description: Use Philips Tap Dial to control Sonos (ZHA version).
domain: automation
input:
switch:
name: Philips Hue Tap Dial Switch
description: The switch that will trigger the automation
selector:
device:
integration: zha
manufacturer: Signify Netherlands B.V.
model: RDM002
multiple: false
sonos_controller:
name: Sonos controller device
description: The sonos controller that this tap dial will operate
selector:
entity:
multiple: false
filter:
- domain:
- media_player
integration: sonos
volume_dial_fast:
name: Fast dial volume increase/decrease
description: How fast the volume is increase or decreased when dialing fast.
The range is 0.0 to 1.0
default: 0.1
selector:
number:
min: 0.0
max: 1.0
step: 0.01
mode: slider
volume_dial_slow:
name: Slow dial volume increase/decrease
description: How fast the volume is increase or decreased when dialing slow.
The range is 0.0 to 1.0
default: 0.05
selector:
number:
min: 0.0
max: 1.0
step: 0.01
mode: slider
volume_dial_step:
name: Singel step dial volume increase/decrease
description: How fast the volume is increase or decreased when dialing a single
step at a time. The range is 0.0 to 1.0
default: 0.01
selector:
number:
min: 0.0
max: 1.0
step: 0.01
mode: slider
variables:
sonos_controller: !input sonos_controller
volume_dial_fast: !input volume_dial_fast
volume_dial_slow: !input volume_dial_slow
volume_dial_step: !input volume_dial_step
event: '{{ trigger.event.data.command }}'
scene: '{{ trigger.event.data.args[1] }}'
step_mode: '{{ trigger.event.data.params.step_mode }}'
step_size: '{{ trigger.event.data.params.step_size }}'
mode: restart
max_exceeded: silent
trigger:
- platform: event
event_type: zha_event
event_data:
device_id: !input switch
action:
- choose:
# Buttons
- conditions:
- '{{ event == "recall" }}'
- '{{ scene == 1 }}'
sequence:
- service: media_player.media_play_pause
target:
entity_id: !input sonos_controller
- conditions:
- '{{ event == "recall" }}'
- '{{ scene == 0 }}'
sequence:
- service: media_player.media_play_pause
target:
entity_id: !input sonos_controller
- conditions:
- '{{ event == "recall" }}'
- '{{ scene == 5 }}'
sequence:
- service: media_player.media_previous_track
target:
entity_id: !input sonos_controller
- conditions:
- '{{ event == "recall" }}'
- '{{ scene == 4 }}'
sequence:
- service: media_player.media_next_track
target:
entity_id: !input sonos_controller
# Dial rotatation
- conditions:
- '{{ event == "step_with_on_off" }}'
- '{{ step_mode == ''StepMode.Down'' }}'
- '{{ step_size == 1 }}' # step rotatation
sequence:
- repeat:
count: '{{ state_attr(sonos_controller, ''group_members'') | length }}'
sequence:
- service: media_player.volume_set
data:
volume_level: '{{ [state_attr(state_attr(sonos_controller, ''group_members'')[repeat.index - 1], ''volume_level'') - volume_dial_step, 0] | max | float }}'
target:
entity_id: '{{ state_attr(sonos_controller, ''group_members'')[repeat.index - 1] }}'
- conditions:
- '{{ event == "step_with_on_off" }}'
- '{{ step_mode == ''StepMode.Down'' }}'
- '{{ step_size > 1 }}'
- '{{ step_size < 10 }}' # slow rotatation
sequence:
- repeat:
count: '{{ state_attr(sonos_controller, ''group_members'') | length }}'
sequence:
- service: media_player.volume_set
data:
volume_level: '{{ [state_attr(state_attr(sonos_controller, ''group_members'')[repeat.index - 1], ''volume_level'') - volume_dial_slow, 0] | max | float }}'
target:
entity_id: '{{ state_attr(sonos_controller, ''group_members'')[repeat.index - 1] }}'
- conditions:
- '{{ event == "step_with_on_off" }}'
- '{{ step_mode == ''StepMode.Down'' }}'
- '{{ step_size > 9 }}' # fast rotatation
sequence:
- repeat:
count: '{{ state_attr(sonos_controller, ''group_members'') | length }}'
sequence:
- service: media_player.volume_set
data:
volume_level: '{{ [state_attr(state_attr(sonos_controller, ''group_members'')[repeat.index - 1], ''volume_level'') - volume_dial_fast, 0] | max | float }}'
target:
entity_id: '{{ state_attr(sonos_controller, ''group_members'')[repeat.index - 1] }}'
- conditions:
- '{{ event == "step_with_on_off" }}'
- '{{ step_mode == ''StepMode.Up'' }}'
- '{{ step_size == 1 }}' # step rotatation
sequence:
- repeat:
count: '{{ state_attr(sonos_controller, ''group_members'') | length }}'
sequence:
- service: media_player.volume_set
data:
volume_level: '{{ [state_attr(state_attr(sonos_controller, ''group_members'')[repeat.index - 1], ''volume_level'') + volume_dial_step, 0] | max | float }}'
target:
entity_id: '{{ state_attr(sonos_controller, ''group_members'')[repeat.index - 1] }}'
- conditions:
- '{{ event == "step_with_on_off" }}'
- '{{ step_mode == ''StepMode.Up'' }}'
- '{{ step_size > 1 }}'
- '{{ step_size < 10 }}' # slow rotatation
sequence:
- repeat:
count: '{{ state_attr(sonos_controller, ''group_members'') | length }}'
sequence:
- service: media_player.volume_set
data:
volume_level: '{{ [state_attr(state_attr(sonos_controller, ''group_members'')[repeat.index - 1], ''volume_level'') + volume_dial_slow, 0] | max | float }}'
target:
entity_id: '{{ state_attr(sonos_controller, ''group_members'')[repeat.index - 1] }}'
- conditions:
- '{{ event == "step_with_on_off" }}'
- '{{ step_mode == ''StepMode.Up'' }}'
- '{{ step_size > 9 }}' # fast rotatation
sequence:
- repeat:
count: '{{ state_attr(sonos_controller, ''group_members'') | length }}'
sequence:
- service: media_player.volume_set
data:
volume_level: '{{ [state_attr(state_attr(sonos_controller, ''group_members'')[repeat.index - 1], ''volume_level'') + volume_dial_fast, 0] | max | float }}'
target:
entity_id: '{{ state_attr(sonos_controller, ''group_members'')[repeat.index - 1] }}'
The volume increase/decrease does not yet work flawlessly, but I’m not sure if this is due to wrong tweaking of the limits of slow/fast increase or if I have to get used to the handling of the tap. I thought before starting a new thread to share this blueprint, I put it here so that other users can test.
bluespice
(john)
November 20, 2023, 10:40pm
4
I have the dial tap but no …_action entity unfortunately…and I’m using the Hue integration not ZHA.
Henke
(Henke)
January 30, 2024, 1:26pm
5
This one works great for me with my Sonos One, Move, Beam etc. But I just got a Sonos Symfonisk speaker and while the normal buttons works, it just doesn’t seem to work with the dial - no volume is being changed. When I inspect the media_players in Dev. tools there’s nothing there that really stands out…
Do you have any idea what could be the issue with this one Sonos speaker?