Oops⊠forgot the quotesâŠ
events.sendCommand("IsItDark", âONâ if âsetâ in str(event.channel).split(":") else âOFFâ)
I didnât see your Items, so I made some guesses. This should be everything youâd need to setup area triggers and actions. Grab the latest Mode (Time of Day), since I fixed a bug related to the use of Channels.
In your Item file(s) add the followingâŠ
Group gArea_Trigger "Area Triggers" <presence>
Group:Switch:OR(ON,OFF) gPapillon_Trigger "Papillon Trigger [%s]" <presence> (gArea_Trigger)
Group:Switch:OR(ON,OFF) gBasement_Trigger "Basement Trigger [%s]" <presence> (gArea_Trigger)
Group:Switch:OR(ON,OFF) gOutside_Trigger "Outside Trigger [%s]" <presence> (gArea_Trigger)
Group gArea_Action "Area Actions" <presence>
Group gPapillon_Action "Papillon Action" <presence> (gArea_Action)
Group gBasement_Action "Basement Action" <presence> (gArea_Action)
Group gOutside_Action "Outside Action" <presence> (gArea_Action)
Switch papillon_motion "Papillon Motion [%s]" <motion> (gPapillon_Trigger) {channel="zwave:device:55555:node2:sensor_binary"}
Switch papillon_light "Papillon Light [%s]" <switch> (gPapillon_Action) {channel="zwave:device:55555:node3:switch_binary"}
Switch basement_motion_1 "Basement Motion 1 [%s]" <motion> (gBasement_Trigger) {channel="zwave:device:55555:node4:sensor_binary"}
Switch basement_motion_2 "Basement Motion 2 [%s]" <motion> (gBasement_Trigger) {channel="zwave:device:55555:node5:sensor_binary"}
Switch basement_light "Basement Light [%s]" <switch> (gBasement_Action) {channel="zwave:device:55555:node6:switch_binary"}
Switch outside_trigger "Outside Trigger [%s]" <switch> (gOutside_Trigger)
Switch christmas_lights "Christmas Lights [%s]" <switch> (gOutside_Action) {channel="zwave:device:55555:node7:switch_binary"}
Create an /automation/jsr223/python/personal/metadata.py
script and add the following to it. You can let this run after every startup, but itâs a little cleaner to just comment everything out.
from core.metadata import set_metadata
set_metadata("papillon_light", "area_triggers_and_actions", {
"modes": {
"Morning": {"brightness": 98},
"Day": {"brightness": 0},# if there is motion during Day mode, the light will not turn on
"Evening": {"brightness": 98},
"Night": {"brightness": 98}
},
"actions": {
"light_action": {"OFF": {"delay": 300}}# the turning off of the light will be delayed by 5 minutes
}
}, overwrite=True)
set_metadata("basement_light", "area_triggers_and_actions", {# there is no modes metadata, so the default values in configuration.area_triggers_and_actions_dict will be used
"actions": {
"light_action": {"OFF": {"delay": 120}}
}
}, overwrite=True)
set_metadata("christmas_lights", "area_triggers_and_actions", {
"modes": {
"Morning": {"brightness": 98},
"Day": {"brightness": 0},
"Evening": {"brightness": 98}
"Night": {"brightness": 0}
}
}, overwrite=True)
Use these In configuration.mode_dictâŠ
mode_dict = OrderedDict([
("Morning", {"hour": 5, "minute": 45, "second": 0}),
("Day", {"channel": "astro:sun:local:rise#event", "event": "START"}),
("Evening", {"channel": "astro:sun:local:set#event", "event": "START"}),
("Night" , {"hour": 21, "minute": 30, "second": 0})
])
You will need to turn on/off your outside_light Item to trigger the Christmas lights, so you might want to add it to a sitemap.