OpenHAB 1.8.2. I have an issue where I have two rules that control my porch light - camera motion event which works, and door switch which doesn’t work. If I set status_night = true, then the camera motion event fires correctly (only turning on the porch light when night). If I open the front door, Contact01_FrontDoor_Basic changes to OPEN, but the porch light turns on whether status_night is true or false.
I’ve removed my .rules file and included only the below/tested. This still ignores Status_Night.state==ON in the “Front Door Opened, Porch light on” rule. Camera-motion rule still follows Status_Night.state.
I have Status_Night set to a switch in my sitemap, so I can test these easily. I have no idea why this basic rule file is causing me grief!
Other than trying to upgrade to v2 (again), is there some way I can resolve this? I don’t think I can narrow it down/troubleshoot further.
rules
import org.openhab.core.library.types.DateTimeType
import org.eclipse.xtext.xbase.lib.*
var Number intBulbBrightness = 100
rule "Sunrise" // Sets night-status to ON every morning
when
Item Sunrise_Event received update ON
then
sendCommand(Status_Night, OFF)
end
rule "Sunset" // Sets night-status to ON every evening
when
Item Sunset_Event received update ON
then
sendCommand(Status_Night, ON)
end
rule "Porch Motion" // Works at night only
when
Item CamMotion_Porch received update ON
then
postUpdate(CamMotion_Porch, OFF)
if (Status_Night.state==ON) {
sendCommand(Dimmer_Porch, intBulbBrightness)
}
end
rule "Front Door Opened, Porch light on" // Runs all day
when
Item Contact01_FrontDoor_Basic received update OPEN
then
if (Status_Night.state==ON) {
sendCommand(Dimmer_Porch, intBulbBrightness)
}
end
items
Switch CamMotion_Porch
Switch Sunrise_Event {astro="planet=sun, type=rise, property=start, offset=-5"}
Switch Sunset_Event {astro="planet=sun, type=set, property=end, offset=-30"}
Switch Status_Night
Dimmer Dimmer_Porch { zwave="5:command=SWITCH_MULTILEVEL,refresh_interval=30" }
Contact Contact01_FrontDoor_Basic { zwave="22:command=basic,respond_to_basic=true" }
sitemap
sitemap default label="House"
{
Frame {
Switch item=Status_Night
}
}
My camera-motion event:
curl --header "Content-Type: text/plain" --request PUT --data "ON" http://openhab:8080/rest/items/CamMotion_Porch/state