I have a new rule intended to text me if the gate is opened while the garage door is open. I tested it for the first time this morning, and it didn’t fire:
rule "verifyGarageDoor"
when
Item Gate received update
then
if ((Gate.state == "Open") && (alarmPanelStatusAway == 1) && (GarageDoorLeft.state == "OPEN")) {
sendMail("redacted1@vtext.com", "Garage Status", "Door open");
// sendMail("redacted2@vtext.com", "Garage Status", "Door open");
}
end
From run.log, events for the relevant items:
2016-12-11 07:24:26.409 [INFO ] [runtime.busevents ] - GarageDoorLeft state updated to OPEN
2016-12-11 07:25:08.612 [INFO ] [runtime.busevents ] - alarmPanelStatusAway state updated to 1
2016-12-11 07:25:26.122 [INFO ] [runtime.busevents ] - Gate state updated to Open
2016-12-11 07:25:26.135 [INFO ] [runtime.busevents ] - Gate state updated to Open
2016-12-11 07:25:37.011 [INFO ] [runtime.busevents ] - GarageDoorLeft state updated to CLOSED
2016-12-11 07:25:38.991 [INFO ] [runtime.busevents ] - GarageDoorLeft state updated to OPEN
2016-12-11 07:25:50.256 [INFO ] [runtime.busevents ] - GarageDoorLeft state updated to CLOSED
2016-12-11 07:26:02.643 [INFO ] [runtime.busevents ] - Gate state updated to Closed
2016-12-11 07:26:02.653 [INFO ] [runtime.busevents ] - Gate state updated to Closed
Could the double notifications from the gate be causing the event to be missed? (This is a bug in the python program running on an rPI that monitors the gate).
Note: the garage door did in fact close and immediately reopen due to a poor adjustment; exactly what this alert is intended to help us catch.
Thanks. I’ll check both when I get home.
Too many years of C programming, I don’t even see semi colons anymore. I’m not sure if they are contacts, they may be strings, as they are updated via mqtt.
Not to forget, if alarmPanelStatusAway is an item, you will have to use alarmPanelStatusAway.state or maybe alarmPanelStatusAway.state as DecimalType, so, the if clause should look like
if (Gate.state.toString == "Open" && (alarmPanelStatusAway.state as DecimalType) == 1 && GarageDoorLeft.state == OPEN)
as the first one is a string, the second one is supposed to be of type number and the third item is of type contact, this one is directly compared to the state (no quotes!!!)
thanks for all the replies – two typos found (semicolons and missing “.state” on alarmPanel…)
Added the .toString method on Gate (a String, maybe I’ll convert to a Contact at some point)
Added cast to DecimalType to alarmStatus… (a Number, could probably be a contact also)
Removed quotes from “OPEN” on GarageDoorLeft (a Contact)
I’ll test it tomorrow afternoon (in the meantime, it’ll get some negative tests when the Gate is open when the garage is not) and report back.
Is there documentation in the Wiki on the methods and objects on an Item that can be used from rules? I’ve been unable to find anything; I’d take a crack at drafting something if I had info to go on.
It’s recommended to use openHAB Designer (respectively Eclipse Smarthome Designer when using OH2) to configure openHAB. If doing so, you can simply hit < ctrl > + < space > to show all possible code completions
You share your openHAB configuration directory on your headless server via samba to your laptop/desktop etc. On your desktop/laptop you install the Designer and point it to the shared samba config directory to edit / save / test etc.
It is indeed not web-based.
rule "verifyGarageDoor"
when
Item Gate received update
then
if ((Gate.state.toString == "Open")
&& (alarmPanelStatusAway.state as DecimalType == 1)
&& (GarageDoorLeft.state == OPEN)) {
sendMail("redacted@vtext.com", "Garage Status", "Door open")
}
end