pponce/homebridge-script2

Click on HomeKit Accessories doesn't run the scripts

mjalafoo opened this issue · 3 comments

Followed the guide exactly (example 1)

  • Placed the "on.sh" "off.sh" in "/home/pi/"
    screen shot 2017-09-25 at 12 13 26 am

  • Both ON and OFF scripts are triggering a Python script to trigger PIface Digital 2 board (example below from ON script)
    screen shot 2017-09-25 at 12 15 56 am

  • Tested the scripts with BASH commands and they work just fine, they also create the "script.flag" file when running ON and delete that file when running OFF (python script runs ok too)
    screen shot 2017-09-25 at 12 18 14 am

  • This is my config.json settings
    screen shot 2017-09-25 at 12 24 36 am

  • Below is a view on my debugging log in this one I switch on the accessory and I switch off the accessory (but of coarse the scripts do not run, as the IO in the Pi Face doesn't change state)
    screen shot 2017-09-25 at 12 27 40 am

It is worth noting that when I run the scripts using the BASH command (for example ON script) and it creates the "script.flag" the HomeKit accessory holds the ON STATE, and when I run the Off script using the BASH command and it deletes the "script.flag" the HomeKit Accessory changes to OFF state.

I am running Rasbian Jessie, below are the versions of the stack:

  • Operating System 8
  • Node JS 7.9.0
  • NPM 4.2.0
  • Homebridge 0.4.27

Please let me know if I am doing anything wrong.

Try making your script files executable so one does not need to execute with bash command.
chmod +x on.sh
chmod +x off.sh
chmod +x state.sh

It worked. Thanks a lot.
I had to do the following:
sudo chmod 777 on.sh
sudo chmod 777 off.sh
sudo chmod 777 state.sh
sudo chmod 777 on.py
sudo chmod 777 off.py
modified my config.json to have the full path for the files (/home/pi/on.sh) instead of (~/on.sh)

glad it worked! i added a note to make sure executable in the instructions. Might also add to make sure it's accessible by homebridge user.