Unable to pass input helper value to shell command

Hello there!

I am trying to issue a shell command but am unable to pass an input helper value to the command :frowning:

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 :frowning:

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? :slight_smile:

Thanks!

WELL DAMN. I WANT TWO DAYS BACK :frowning:

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:

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"