I have a couple of Python scripts on a Raspberry Pi Zero that I use along with a relay HAT to open and close my garage door. I have set up Home Assistant on a Raspberry Pi 4 and am trying to add buttons to my HA dashboard to run these scripts via SSH. To test the setup, I am trying to ssh a simple command of
ssh [email protected] -p xx touch /home/pi/test.txt
which should create a file ‘test.txt’ in the pi user’s home file. I have SSH’d into the HA and tested the command from the command line and it works - it creates a file ‘test.txt’ on the Raspberry Pi at the specified IP address. However, when I click the button on my dashboard it does nothing.
In my configuration.yaml I have,
shell_command:
test: ssh [email protected] -p xx touch /home/pi/test.txt
(with the correct IP address and port)
And in scripts.yaml I have,
test:
alias: test
sequence:
- service: shell_command.test
The code for the card for the button to run the script is,
show_name: true
show_icon: true
type: button
tap_action:
action: toggle
name: Test.txt
icon: mdi:test-tube
entity: script.test
I’m fairly new to HA but not to scripting, etc. and any guidance would be most appreciated! I have checked other relevant posts but not found what I need.