I’m trying to pass argument to the called .sh script, from my sensor. Unfortunately, I can’t get it to work:
command_line:
- switch:
unique_id: "vpnvpn"
name: 'VPN'
command_on: "/home/mona/home_assistant_commands_observer.sh {{ states('sensor.selected_config') }}"
command_off: '/home/mona/home_assistant_commands_observer.sh vpnstop'
command_state: '/home/mona/home_assistant_commands_observer.sh vpnstatus'
scan_interval: 15
2023-07-26 03:43:08.543 ERROR (SyncWorker_8) [homeassistant.components.command_line.utils] Command failed (with return code 2): /home/mona/home_assistant_commands_observer.sh {{ states('sensor.selected_config') }}
2023-07-26 03:43:08.556 ERROR (MainThread) [homeassistant.components.command_line] Command failed: /home/mona/home_assistant_commands_observer.sh {{ states('sensor.selected_config') }}
Originally, I was trying to load the config directly from the input dropdown menu, but it also was failing so I created a template sensor. It seems like HA is not reading the correct state, just passes the entire command.
input_select:
ovpn_files:
name: "OVPN Files"
options:
- None Available
- SE.ovpn
initial: "SE.ovpn"
I would appreciate some workaround. This is is annoying, I spent 10x less time for complicated things, and I can’t pass simple arguments.