This Rule worked great under OH 1.x but now it doesn’t.
rule "SmartMirror Power"
when
Item SmartMirrorPow changed
then
if (SmartMirrorPow.state==ON && ZWMot2.state==CLOSED){
if (SmartmirrorDSP!=null){
SmartmirrorDSP.cancel
SmartmirrorDSP=null
}
executeCommandLine("ssh@@pi@smartmirror@@./tv.sh "+SmartMirrorPow.state)
SmartmirrorDSP = createTimer(now.plusMinutes(5)) [|
sendCommand(SmartMirrorPow, OFF)]
}
if (SmartMirrorPow.state==ON && ZWMot2.state==OPEN) {
if (SmartmirrorDSP!=null) {
SmartmirrorDSP.cancel
SmartmirrorDSP=null
}
executeCommandLine("ssh@@pi@smartmirror@@./tv.sh@@"+SmartMirrorPow.state)
}
if (SmartMirrorPow.state==OFF) {
if (SmartmirrorDSP!=null) {
SmartmirrorDSP.cancel
SmartmirrorDSP=null
}
executeCommandLine("ssh@@pi@smartmirror@@./tv.sh@@"+SmartMirrorPow.state)
}
end
When i look at the logs, i will only see the “OFF” command:
2016-10-18 15:49:33.226 [INFO ] [lipse.smarthome.io.net.exec.ExecUtil] - executed commandLine '[ssh, pi@smartmirror, ./tv.sh, OFF]'
what does the tv.sh? it is located at the remote host /home/pi/tv.sh and “translates” the openhab ON/OFF state to a state that can be interpreted by the tvservice script. (It switches the display on or off)
#!/bin/bash
if [ "$1" = "OFF" ]; then
/opt/vc/bin/tvservice -o
elif [ "$1" = "ON" ]; then
/opt/vc/bin/tvservice -p
fi
Why does it only execute the “OFF” part of my rule?
Thanks