Hello there!
I am trying to issue a shell command but am unable to pass an input helper value to the command
In configuration.yaml I am having success with:
shell_command: echo -e -n 'v=12345' > /dev/ttyACM0
but my attemts to add the input helper to the string fail
shell_command: echo -e -n 'v={{ states.input_number.voltage_set_online.state |int }}' > /dev/ttyACM0
It looks like the command is not being sent at all when adding the input number to the command since i have loopback enabled for the serial device but i am getting nothing back. the command simply is not executed or is malformed so that it does not reach the serial device.
When i put the same code into a helper sensor to output it visually to home assistant it looks just fine thoughâŚ
âecho -e -n âv=50â > /dev/ttyACM0â
I am really stuck, can you help me out?
Thanks!
WELL DAMN. I WANT TWO DAYS BACK
Turns out the Home Assistant Serial implementation does NOT allow for âShell helpersâ when using shell commands with helper values.
So a > /dev/ttyACM0
simply is not being executed.
MASSIVE Kudos to this post:
I have spent the last year trying to figure out how to control a few devices i own with a usb-to-serial interface, and to say the least at times i wanted to hang myself. have came on this forum searching for answers and ended up with such a messy set of trial and error setups i couldnt think straight at times and it was such a mess i had to stop and revisit countless times.
in short, like two weeks ago i had gotten to the point where i had taken an arduino uno, 2 line LCD shield, and usb cableâŚ
The solution is to use a /bin/bash command like this that implements the âshell helperâ and therefor cannot be recognized by HA
shell_command: /bin/bash -c "echo -e -n a='{{ states("input_number.set_online") }}' > /dev/ttyACM0"