So here is what I am attempting to do and I am sure there is a smart more efficient way to do this but I am new to home assistant. And there is always a million other ways to skin a cat so to speak.
I have six ring floodlight cameras. I wrote scripts in python to activate all the sirens and lights on all six cameras with the goal of using this as a part of an alarm automation. So if the alarm is triggered it will activate the indoor and outdoor sirens on all six exterior ring flood light cameras and turn on the flood lights.
Because of the latency of connecting to each ring device using the rest api, I wrote six python scripts to connect to each device and then activate the siren. I then wrote a shell script run all 6 scripts in parallel. I did this because running it in parallel in python caused connection errors exceeding retries…some sort of flood prevention I guess. Anyways, so this all works and is testing good. I execute the bash script and it in turn activates all 6 python scripts simultaneously for both the flood lights and sirens.
Eventually I will use that shell script in an automation via the service shell_command.turn_on_ring_siren
when executing the service from the Hassio UI I get the following error:
Error running command: bash /usr/share/hassio/homeassistant/scripts/ring_activate_all_siren.sh
, return code: 127
Here is all the details:
configuration.yaml:
shell_command:
turn_on_all_floodlights: bash /usr/share/hassio/homeassistant/scripts/turn_on_all_floodlights.sh
turn_off_all_floodlights: bash /usr/share/hassio/homeassistant/scripts/turn_off_all_floodlights.sh
turn_on_ring_siren: bash /usr/share/hassio/homeassistant/scripts/ring_activate_all_siren.sh
Here is the bash script ring_activate_all_siren.sh:
#!/bin/bash
python backyard_grill_siren_on.py &
python backyard_sheds_siren_on.py &
python backyard_siren_on.py &
python backyardtables_siren_on.py &
python front_yard_deck_siren_on.py &
python frontyard_siren_on.py
I set permissions for the entire scripts folder, but more specifically the files mentioned are:
-rwxrwxrwx 1 linuxbox users 217 May 25 16:40 ring_activate_all_siren.sh
-rwxrwxrwx 1 root users 4096 May 24 23:30 ._turn_on_all_floodlights.sh
-rwxrwxrwx 1 root users 246 May 24 23:41 turn_on_all_floodlights.sh
I tried a test someone else mentioned and got the same error:
Fri May 25 2018 18:34:06 GMT-0800 (AKDT)
Error running command: `/usr/bin/touch /tmp/hass-shell-command-test`, return code: 127
NoneType: None
scripts.yaml:
#test a simple shell script
shelltest:
sequence:
- service: shell_command.test
configuration.yaml:
shell_command:
turn_on_all_floodlights: bash /usr/share/hassio/homeassistant/scripts/turn_on_all_floodlights.sh
turn_off_all_floodlights: bash /usr/share/hassio/homeassistant/scripts/turn_off_all_floodlights.sh
turn_on_ring_siren: bash /usr/share/hassio/homeassistant/scripts/ring_activate_all_siren.sh
test: /usr/bin/touch /tmp/hass-shell-command-test
for the siren script I have tired it with and without bash, with and without single quotes.
I am running hassio as a docker container on ubuntu 18.04 by the way.
Any ideas?