It's within the plugin package. Right click on the plugin file and select View Package Contents.
Sent from my iPhone using Tapatalk
#!/bin/bash
shutdown -hu now
UPS = indigo.variables[206759487] # "UPS"
indigo.variable.updateValue(UPS, "true")
berkinet wrote:mortenkols wrote:This is the shutdown.sh script. it turns off my mac mini if the battery on the ups is low.
#!/bin/bash shutdown -hu now
----------------
i have tried to make a script to update a variable, but I failed. what is wrong?
UPS = indigo.variables[206759487] # "UPS"indigo.variable.updateValue(UPS, "true")
The problem appears to be using Indigo internal (plugin) Python programming syntax in a bash shell script. You want Indigo to change the value of an internal variable. But, the shell script is executed by the bash shell, which is a completely separate process. The only (simple) way to have the script interact with Indigo would be through the Indigo RESTful API.
An example of such a URL to set the value of Indigo variable powerFail to true would look like:
http://127.0.0.1:8176/variables/powerFail?_method=put&value=false
You can test that by simply pasting the URL into a browser window.
To execute that from a shell script you would need a means to simulate a browser. The solution is curl which is provided in the standard OS X release. Something like this:Just change "username" and "password" to whatever you have set for Indigo, put that into your shell script and you should get the result you want.
- Code: Select all
curl --user username:password --digest -X PUT -d value=true http://127.0.0.1:8176/variables/powerFail
Mac OS X 10.11 “El Capitan” support
Installer is now compliant with SIP (aka “rootless”) requirements. apcupsd executables are installed into /usr/local/sbin instead of /sbin. Config files and scripts remain in /etc.
NB: There continues to be a known issue with USB UPSes under OS X where the OS power management service occasionally does not relinquish control of the UPS, leaving apcupsd unable to communicate with it. The workaround is to unplug and replug the USB cable after booting the Mac.
Users browsing this forum: No registered users and 3 guests