Hi,
I am lost of what to do, so, please, could somebody just post a sample of config files showing how to do that?
I am using Exec binding to operate TPLink HS-200 light switch.
it uses item defined as:
Switch PlugOne “Plug One” [ “Switchable” ]
With a rule:
rule “Plug One"
when
Item PlugOne received command
then
if ((receivedCommand==ON) {
var String results = executeCommandLine(”/var/lib/openhab2/conf/scripts/hs100.sh 192.168.10.25 9999 on", 5000)
logInfo(“Network”, “Switching Plug One: " + results)
}
if ((receivedCommand==OFF) {
var String results = executeCommandLine(”/var/lib/openhab2/conf/scripts/hs100.sh 192.168.10.25 9999 off", 5000)
logInfo(“Network”, “Switching Plug One: " + results)
}
var String results = executeCommandLine(”/var/lib/openhab2/conf/scripts/hs100.sh 192.168.10.25 9999 check", 5000)
logInfo(“Network”, "Checking Plug One: " + results)
end
It works with Alexa and from interface fine, PlugOne gets off and on fine. The issue is - how to communicate into the openhab if this plug gets manually switched off or on?
there is a ‘check’ request in the API that returns current status of the plug:
2016-10-30 13:41:41.259 [INFO ] [lipse.smarthome.model.script.Network] - Checking Plug One: ON
This is the output of those 2 last lines in the rule before ‘end’. Now, what exactly and where should be done to run this ‘check’ command on regular intervals, say, every 20 sec to let openhab know the current status of that plug? It sounds very trivial but somehow i cannot figure out what to do and cannot find a sample.