Unfortunately I have just tried this without success. However I will update my code.
To test this I go to the developer tools and insert a two digit value on the āinput_number.218_volā entity to overcome any potential formatting issues. In addition to this, I am using the GUI slider.
Both scenarios I cant get the variable shell to work. as previously said if I change the variable formatting to a static number in the shell. Then adjust the GUI slider, I get the specified value on the component which is totally expected. This proves to me that my theory is correct but my variable formatting is incorrect.
It seems weāre very close to having something that works! ā00.0ā value is not recognised by the component. I need a ā00ā value (without the decimal point).
Search for āPython leading zerosā for help. Iād give you the exact format but I canāt remember how it works and am struggling with a very bad internet connection.
This seems to be exactly what I need! But it is still not controlling the componentā¦ As this is a command_line string, does it need to be fired upon every state change of the volume entity in the automation?
This shell is a fixed command without templating, when I adjust the volume slider up or down, the componentās volume goes up by one. This is expected and demonstrates the automation is working.
As above I have run my template through the editor and I get the result Iām expecting. Is it possible that command_line is unaware of certain types of templates? any workarounds would be greatly appreciated to get these 2 digits into the shell.
Another great suggestion from you! thank you for all your time on this.
The device is an audio pre-amplifier. I setup a telnet connection to see what it was receiving and found the non-formatted shell commands from Home Automation are making their way to the device but the formatted shell commands are not. again, this points towards the dynamic formattingā¦
I have now added the shell_command logger to my config.yaml
logger:
default: info
logs:
homeassistant.components.shell_command: debug
For ease of testing, I made a script I can trigger on demand. the first line from the logger at 14:36:32 uses the templating shell_command which does not control my IP device as expected. I notice that it seems to self report the actual input number within Home Assistant.
b'#SVN 25 | nc 192.168.1.8 9014\n'
At 14:37:03 uses this shell_command control the device as expected by āmanuallyā adding the value ā50ā. As you can see the device replies with and behaves as expected