+++
+++ I use OH2 and have no idea if this is working in OH1 as well!
+++
Hi guys,
I just setup a new simple rule to receive an email after leaving the house if there are one or more windows still open and which ones they are.
Prerequisites:
- a working presence detection (there are multiple tutorials already available)
- multiple window/door sensors of course
- working and configured persistence (I use rrd4j)
- configured “Mail Action” add-on
Item configuration:
Group:Contact:OR(OPEN,CLOSED) WindowSensors "Window Sensors [%s]"
Contact Window1 "Window1 [%s]" (WindowSensors) { channel="zwave:device:12345678:node1:sensor_door" }
Contact Window2 "Window2 [%s]" (WindowSensors) { channel="zwave:device:12345678:node2:sensor_door" }
Contact Window3 "Window3 [%s]" (WindowSensors) { channel="zwave:device:12345678:node3:sensor_door" }
Contact Window4 "Window4 [%s]" (WindowSensors) { channel="zwave:device:12345678:node4:sensor_door" }
...
Rule configuration: (how you check your presence is up to you)
rule "Window rule"
when
Item Presence changed from ON to OFF
then
if (WindowSensors.state == OPEN) {
var String open_windows = "| "
WindowSensors.members.forEach [ window |
if (window.state == OPEN) {
open_windows = open_windows + window.name + " | "
}
]
sendMail("name@example.com", "Window(s) still open! (" + open_windows + ")", "Window(s) still open: " + open_windows )
}
end
The email would look like this:
To: name@example.com
Subject: Window(s) still open! (| Window2 | Window4 | )
Window(s) still open: | Window2 | Window4 |
I hope this comes in handy
Christian