I wanna control my volume on my reciver with a slider, the thing is that my reciver is old and the only option is to use IR commands. I have a broadlink mini that works like a charm.
What i want to do is an automation that sends the IR command for volume up everytime the slider increases one step. And ofc the other way around. Anyone done something similare, is it possible?
I don’t think you can use a slider for this. You could get out of sync with the device because there is no feedback. Example: You hit your receivers upper volume limit but the slider bar is only at 25%. Now you have 75% of a bar that does nothing.
You’d have to make a sync button that lowers the slider and the volume on your receiver, something that would guarantee both slider and receiver are at the same level (usually the upper limit or lower limit, i recommend lower).
Your other option is just to have two scripts, one to turn up the volume, one to turn down the volume. No syncing needed because it’s a button.
- alias: Set Zone 1 Volume
trigger:
- platform: state
entity_id: input_number.yamaha_receiver
action:
- service: media_player.volume_set
entity_id: media_player.yamaha_receiver
data_template:
volume_level: >
{% set from = trigger.from_state.state %}
{% set to = states('input_number.yamaha_receiver') | float %}
{{ to - from }}
This is going to be close, but I don’t know what your reciever looks like in HA. You most likely need to have a value that the device is moving up. Either way, this portion is partially correct:
data_template:
volume_level: >
{% set from = trigger.from_state.state | float %}
{% set to = states('input_number.yamaha_receiver') | float %}
{{ to - from }}
The main take away is that you need to get the from state, and the to state of the device. Subtract the from from the to, and thats the difference you are going to plug into whatever it is you use.
Make sure you know the max number of your receiver’s volume steps, set the slider to have this as the max value.
Make sure the numeric input is disabled/hidden unless the receiver is on.
Make sure that there is no way to block IR from being received (an IR blaster bead right at the sensor).
Also once triggered, disable/hide the numeric input until after you have finished sending the repeated number of IR codes required.
This should help prevent the receiver and numeric input getting out of sync using petro’s suggested code.
I have no idea how to disable or hide the numeric input. Group visibility is the only thing that comes to mind.