Hi All
This is my current rule which works, most of the time.
What occurs is it retrieves the image from the Doorbell and places it into the visitor-history folder just fine. What it fails to do reliably is copies the latest file from the at folder into /html and calls it lastvisitor.jpg
When I open the file using a browser http://IP/html/latestvisitor.jpg its quite old.
Any suggestions?
Thanks guys!
rule "Save Local Visitors History on Door Bell"
when
Item DoorBird_DoorBell received command ON
then
if(gPresenceSensors.state == ON){
Echo_LivingRoom_TTS.sendCommand('Theres someone at your Front Gate')
}
if(gPresenceSensors.state == OFF){
sendBroadcastNotification("Theres someone at your Front Gate")
}
logInfo("DoorBird", "DoorBell pressed by Visitor")
var t = now
var cmd = 'wget http://user:pass@192.168.0.141/bha-api/history.cgi?index=1 -O ' + OPENHAB_DIR + 'vistors-history/'
cmd = cmd + t.getYear
if (t.getMonthOfYear < 10) cmd = cmd + '0'
cmd = cmd + t.getMonthOfYear
if (t.getDayOfMonth < 10) cmd = cmd + '0'
cmd = cmd + t.getDayOfMonth
if (t.getHourOfDay < 10) cmd = cmd + '0'
cmd = cmd + t.getHourOfDay
if (t.getMinuteOfHour < 10) cmd = cmd + '0'
cmd = cmd + t.getMinuteOfHour
if (t.getSecondOfMinute < 10) cmd = cmd + '0'
cmd = cmd + t.getSecondOfMinute
cmd = cmd + '.jpg'
if(vTimeOfDay.state != "DAY") {
sendHttpGetRequest("http://user:pass@192.168.0.141/bha-api/light-on.cgi")
}
Thread::sleep(1500)
executeCommandLine('wget http://user:pass@192.168.0.141/bha-api/history.cgi?index=1 -O ' + OPENHAB_DIR + 'html/latestvisitor.jpg')
executeCommandLine(cmd)
end