Hello,
I want to control the volume of an audio device via home assistant. The device can be controlled via telnet. This requires me to send a numeric value, namely the volume the user selects via telnet. I am struggling to find a way to do that. The telnet switch component seems to only allow to send one command for on and off and the command_on and command_off parts do not allow me to use value templates. I have tried something like
living_room_volume:
resource: AAA.BBB.CCC.DDD
port: 12345
command_on: “^VPZ @1,{{states.input_number.living_room_volume.state|int}}$”
command_off: “^VPZ @1,{{states.input_number.living_room_volume.state|int}}$”
But that did not work. It looks like a command arrives at the audio devices, but it has the wrong syntax. I dont know how to see the actual telnet command that is sent to the device (putting the telnet component in debug mode doesnt show anything), but I can see on the device that a command with wrong syntax has been received, so I suppose the templating failed.
I then tried to go for a shell_command via
shell_command:
set_volume_living_room: echo ^VPZ @{{zone}},{{volume}}$ | curl --raw --max-time 1 telnet://AAA.BBB.CCC.DDD:12345
But again this failed. It does not even look like anything arrived at the device. If I enter the curl command as above in the shell it works fine.
I am at a loss. Are there any other ways to do this?
Many thanks!