homebridge-script
homebridge-script copied to clipboard
incompatible with file-exists 3.0.1
after update file-exists package to the latest version 3.0.1, homebridge-script stopped working.
I submitted a pull request for a quick fix for this. But not sure if this package is being maintained any more. Feel free to install my fork. it should work with the latest file-exists pponce/homebridge-script
How can I install your fork?
You can simply replace the index.js file with pponce's version.
Thank you for the fast reply. I still don't get it to work. Switching it on it does not run my script. But when turning the switch off it runs the off script. How exactly I need to configure this?
"on": "~/on.sh", <- Path to script when turning the switch on ?
"off": "~/off.sh", <- Path to script when turning the switch off ?
"state": "~/state.sh", <- Path to state script? Which states should it send? true and false?
"fileState": "/Users/olegmalovichko/script.flag", <- Whats that?
"on_value" : "true", <- Whats that?
"exact_match": true <- Whats that?
On and Off works now. Had a typo. But I still don't understand how it should work with the state..
To install my fork you can do npm install -g homebridge-script2
I'm not sure what on_value or exact match do. I left them set at true. When a homekit app checks for current state, it uses the existence of the filestate file that you configure. If it exists, it's on. If not, it's off. Make sure your on.sh script creates the configured filestate file. And that your off script rm's your configured filestate file. I don't see in the code where the state.sh script executes. So it probably does not. But I kept the state script that comes with the repo and point to it in my config. I use my on.sh, off.sh scripts. They create and remove the filestate configured file. Things work just fine like this.
Ah thank you, thats how it woks! Is it maybe possible to edit the code to let the status script run if home kit ask for a status?
Probably. I'm a bit of hack coder. Let me give it a go in my fork.
Can you help me with the state.sh ?
You write that we should output to stdout. I'm pretty new to all of this. How das this work ?
I thought something like this echo "true" 2>&1
?
ah forget it! I just had an oder version. Had to manually copy the index.js to the file. Installing with npm install -g pponce/homebridge-script
got me an older version.
Now it works great! Thank you very much!
Actually you got the new update with working state.sh. I updated it pretty much after my comment and updated the read-me. Had not had time to test it though. Glad it works. Let me know if you run into issues. Running: npm install -g homebridge-script2 should always get you the latest version.
@MeinMilchKaffee Let me know if everything is working well with my changes and using state.sh.
I hadn't time today to test it. I will try it tomorrow and keep you updated.
Installed 0.0.9. Works great!