I’m trying to use an input slider to control my old AV receiver.
I have 2 shell_command and script to control it. Each time a press the script, i have +1 ou -1 on my volume.
I want to make it with input_slider from -60dB to -10dB, but i think i need to make a loop somewhere to call +1 or -1 as many time as needed.
Something like. (CurrentValue - NewValue) * +/-_1_script.
Does someone have an idea about such a thing ?
on the basis that your commands are Vol up and vol down, you won’t be able to use a slider, unless you can get the volume value of your yamaha device and then send as many vol up/down commands as required.
It would probably be better to set 2 buttons for up and down to “mimic” the remote actions no?
Hi @petro I’m trying to achieve the same control of an IR amp but through the harmony hub. Below is my setup but I can not get it to work. Any help would be appreciated. I have proven that the volume up/down scripts work.
loop_command.py
count = data.get('count')
command = data.get('command')
sleep_time = 0.05
if count:
try:
count = int(count)
except ValueError:
# if the value of count is not an integer, don't do any loops.
logger.warning("Bad count {}, cannot convert to integer.".format(count))
count = None
domain, command = command.split('.')
if domain and command and count: #make sure the entity_id exists and the count is greater than 0.
for i in range(count):
hass.services.call(domain, command , None, True)
time.sleep(sleep_time)
else:
logger.warning("Did not execute loop.")
automation.yaml
# Yamaha Volume
- id: yamaha_volume
alias: Yamaha Volume
initial_state: True
trigger:
platform: state
entity_id: input_number.yamaha_receiver
condition:
condition: template
value_template: "{{ trigger.to_state.state != trigger.from_state.state and
trigger.to_state.state is not none and
trigger.from_state.state is not none }}"
action:
service: python_script.loop_command
data_template:
command: >
{% if trigger.to_state.state|float > trigger.from_state.state|float %}
script.yamaha_receiver_volume_up
{% else %}
script.yamaha_receiver_volume_down
{% endif %}
count: >
{{ ((trigger.to_state.state|float - trigger.from_state.state|float)|abs / state_attr('input_number.yamaha_receiver', 'step'))|round }}
After a restart of the Hass docker container it is now working but it only output .5dB or one step per 1 seconds so it’s very slow, not sure how to speed this up. Am I right in thinking that a slider control is not really going to work well when hass has no way of knowing the current volume level of the AV receiver. I don’t know if it is possibly to get the current volume level through IR. What are you thoughts, I should really just get a modern AV receiver that is network controllable.
I am at the same point. By coincident, I am also using a Yamaha receiver, which I can control with HA, through a broadlink rm4. Tested and working.
Despite being a 2011 device, it does have LAN connection and is controllable by Yamaha APP “AV Controller”. The App does not use a slider for volume control, but the Amp does feedback volume level with dbA setting. Vol up and vol down, can be set to target colume level and Amp volume knob follows.
I have no idea, though, how to extract that info, either from the app or the amp.
So for the time being, I will have to settle with the less desirable method of Vol up and down buttons
It turns out, that, despite my Amp not featuring MusiCast, I am still able to control it from HA.
The OotB Intergration works fine. follow instructions from integration notes: add device as media player in config.yaml, define host IP, restart. Done. ;))) Meesa happi gungan!
Device tested: Yamaha RX-A810, build ca 2011, latest firmware,