Last active
January 18, 2024 11:24
-
-
Save lymbada/6e32b92293d1938f09a6464a04ec4a0b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: Mqtt-VolumeKnob | |
description: Using the (Tuya ERS-10TZBVK-AA) MQTT Volume-Knob to controle the volume of a primary MediaPlaye (with 2nd option on hold & rotate) | |
domain: automation | |
input: | |
primary_media: | |
name: Primary Player | |
description: Media Player for main volume control | |
selector: | |
entity: | |
filter: | |
domain: media_player | |
secondary_media: | |
name: Secondary Player | |
description: an additional Media Player object for the push&rotate function | |
selector: | |
entity: | |
filter: | |
domain: media_player | |
volume_knob: | |
name: Volume Knob | |
description: the (Tuya) MQTT device with the rotation for controling volume | |
selector: | |
entity: | |
filter: | |
integration: mqtt | |
domain: sensor | |
alias: Mqtt-VolumeKnob | |
mode: queued | |
max: 10 | |
trigger: | |
- platform: state | |
entity_id: | |
- !input volume_knob | |
condition: [] | |
variables: | |
p_media: !input 'primary_media' | |
s_media: !input 'secondary_media' | |
action: | |
- variables: | |
action: >- | |
{{ trigger.to_state.attributes.action }} | |
volume_entity: !input primary_media | |
- choose: | |
- conditions: | |
- >- | |
{{ action == "brightness_step_down" }} | |
sequence: | |
- service: media_player.volume_set | |
data_template: | |
entity_id: !input primary_media | |
volume_level: >- | |
{{ state_attr(p_media,'volume_level') - | |
((trigger.to_state.attributes.action_step_size / 19) | round | |
)/100 }} | |
- conditions: | |
- >- | |
{{ action == "brightness_step_up" }} | |
sequence: | |
- service: media_player.volume_set | |
data_template: | |
entity_id: !input primary_media | |
volume_level: >- | |
{{ state_attr(p_media,'volume_level') + | |
((trigger.to_state.attributes.action_step_size / 19) | round | |
)/100 }} | |
- conditions: | |
- >- | |
{{ action == "color_temperature_step_up" }} | |
sequence: | |
- service: media_player.volume_set | |
data_template: | |
entity_id: !input secondary_media | |
volume_level: >- | |
{{ state_attr(s_media,'volume_level') + | |
((trigger.to_state.attributes.action_step_size / 19) | round | |
)/100 }} | |
- conditions: | |
- >- | |
{{ action == "color_temperature_step_down" }} | |
sequence: | |
- service: media_player.volume_set | |
data_template: | |
entity_id: !input secondary_media | |
volume_level: >- | |
{{ state_attr(s_media,'volume_level') - | |
((trigger.to_state.attributes.action_step_size / 19) | round | |
)/100 }} |
Removed the 'test' from the alias and name, added the specific volume knob mode (ERS-10TZBVK-AA)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
initial commit includes working version with 4 basic controls from the Tuya Zigbee volume knob (specifically model ERS-10TZBVK-AA designed for light controls).
Rotation (ClockWise-cw CounterClockwise-ccw) gives volume up and volume down (with apparent acceleration based on speed of dial
With push-hold & CC / CCW rotation giving the 2nd media playervolume controls up & down