i have 2 raspberry pi devices and I enabled ssh access to the remote box using keys so I don’t have to enter in a password. On my HA, i create a shell script to start a service on the remote machine and another script to stop the service. When I call start script from HA, it correctly starts the service. However, when i call the script to stop the service, it does not stop the service on the remote box. When I run the same commands ssh pi@IPADDRESS sudo service lspi start and ssh pi@IPADDRESS sudo service lspi stop from putty they work.
Ok I got rid of the shell_commands and just created a switch… it works with the switch, but i still don’t know why it doesn’t work with the shell_commands
here is the simple code:
- platform: command_line
switches:
lightshow_pi:
command_on: "ssh pi@IPADDRESS sudo service lspi start"
command_off: "ssh pi@IPADDRESS sudo service lspi stop"
value_template: '{{ states.switch.lightshow_pi.state }}'
friendly_name: Lightshow pi