Went throught the examples page but it’s not clear for me how to trigger on volume change
This is the code to pass slider value to media player volume
- alias: Zal Onkyo Volume Slider
trigger:
platform: state
entity_id: input_slider.zal_onkyo_volume
action:
- service: media_player.volume_set
data_template:
entity_id: media_player.onkyo
volume_level: '{{ trigger.to_state.state | int }}'
But how to do the vice versa and change slider value based on volume? What to input for the trigger
- alias: Zal Onkyo Volume Slider Set
trigger:
platform: state
entity_id: media_player.zal_onkyo (where to put the volume attribute????!)
action:
service: input_slider.select_value
data_template:
entity_id: input_slider.zal_onkyo_volume
value: '{{ trigger.payload}}'
not sure but believe get the following error with this code
ERROR (MainThread) [homeassistant.core] Invalid service data for input_slider.select_value: expected float for dictionary value @ data[‘value’]. Got ‘’
There are some issues with getting the initial value, since there is no volume value when the receiver is off. This can be solved using a sensor. I am still working on it, but this is my work in progress:
Still struggling to get the slider to update when something else changes the media_player volume. I’m on Chromecast in this case.
“Invalid service data for input_slider.select_value: expected float for dictionary value @ data[‘value’]. Got “‘0.47999998927116394’”” is the error I’m getting, but I’m guessing this is data type error?
This is great, thanks for sharing. Looks like this was designed to be used with a 0-100 slider with 10-step increments. Works well for me with the below in my config: