[SOLVED] simple extra arguement that should not have been there.
I have a Hass script that calls a shell command which calls a bash script which calls a python script, which is failing.
if I comment everything out of the bash script except the python line, I can trigger it from HASS.
So the bash script and HASS config is correct.
If I call the same bash script directly from the terminal, everything works.
if I try the full workflow I get an error in HASS, simply saying failed.
going back to my bash script and adding “&>> file” to the end I can see an error message I made in the python script meaning the arguments are wrong/invalid/missing.
HASS config:
shell_command:
start_projector: /bin/bash /home/homeassistant/.homeassistant/scripts/startProjector.sh
script:
start_projector:
alias: Star Projector
sequence:
- service: shell_command.start_projector
bash script:
#!/bin/bash
export DISPLAY=:0
/usr/bin/python2.7 /home/homeassistant/.homeassistant/scripts/ProjectorComms.py -i 192.168.1.10 -p 9999 -m "POWER" -v &>> /home/homeassistant/log.txt
python script:
........some stuff...............
try:
opts, args = getopt.getopt(sys.argv[1:],"i:p:m:",["ip=:","port=:","msg=:"])
except getopt.GetoptError:
print ("Failed to supply: ProjectorComms.py -i <projectorIPaddress> -p <port> -m <message>")
sys.exit(2)
for opt, arg in opts:
........some stuff...............
log file:
Failed to supply: ProjectorComms.py -i <projectorIPaddress> -p <port> -m <message>