I have an IP_Cam and use this as a motion-sensor to trigger my HUE lights via the HUE API + HTTP-binding. I do this because I want to be able to set the ‘transition time’ (quick when turning on and slow when turning off.
This has been working, but now I get the following error in my log and the lights are not turned on. As far as I know I didn’t update anything. I’m using openHAB 2.4.0 Release Build on a RPI (running Openhabian).
The item IPCam_MotionAlarm
is updated and I can set the HUE lights with basicUI etc.
2019-02-25 21:48:29.000 [vent.ItemStateChangedEvent] - IPCam_MotionAlarm changed from OFF to ON
==> /var/log/openhab2/openhab.log <==
2019-02-25 21:48:29.036 [INFO ] [smarthome.model.script.Motion update] - evaluate
2019-02-25 21:48:29.044 [INFO ] [.smarthome.model.script.HUE API call] - Send command '{"on":true, "bri":254, "transitiontime":0}' to http://192.168.2.101/api/My_Hue_API_key/groups/8/action
2019-02-25 21:48:29.048 [INFO ] [smarthome.model.script.Motion update] - cancel timer
2019-02-25 21:48:30.069 [ERROR] [.smarthome.model.script.actions.HTTP] - Fatal transport error: java.util.concurrent.TimeoutException: Total timeout 1000 ms elapsed
My rules to turn the lights on/off:
var Timer NoMotionTimer = null
rule "Carport Lights ON at IPCam Motion"
when
//Item IPCam_MotionAlarm received update ON or
Item IPCam_LineCrossingAlarm received update ON or
Item IPCam_MotionAlarm received update ON or
Item FrontDoor changed to OPEN
then
if (Sun_PhaseName.state!="DAYLIGHT") {
val url = "http://192.168.2.101/api/My_Hue_API_key/groups/8/action"
val String body = '{"on":true, "bri":254, "transitiontime":0}'
logInfo("HUE API call", "Send command '{}' to {}", body, url)
sendHttpPutRequest(url, "application/json", body)
}
end
rule "Carport Lights OFF after IPCam Motion"
when
Item IPCam_MotionAlarm received update or
Item IPCam_LineCrossingAlarm received update or
Item FrontDoor received update
then
logInfo("Motion update", "evaluate")
// Motion and Line crossing are not ON (they are OFF or undef); set timer to turn of the lights
if (IPCam_MotionAlarm.state != ON && IPCam_LineCrossingAlarm.state != ON && FrontDoor.state != OPEN) {
logInfo("IP Cam", "Set motion-stopped timer")
NoMotionTimer = createTimer(now.plusSeconds(60), [ |
val url = "http://192.168.2.101/api/My_Hue_API_key/groups/8/action"
val String body = '{"on":false, "bri":256, "transitiontime":50}'
logInfo("HUE API call", "Send command '{}' to {}", body, url)
sendHttpPutRequest(url, "application/json", body)
NoMotionTimer = null
])
}
else {
logInfo("Motion update", "cancel timer")
NoMotionTimer?.cancel
NoMotionTimer = null
}
end
Any hints where to start looking?