Anybody else using OpenHab scripts as a replacement for Vera Scenes?
For example, I have a rule that fires at 9:00 PM that turns sets my kitchen lights to “night” mode.
rule "Night kitchen"
when
Time cron "0 30 21 ? * *"
then
sendCommand(KitchenLightsStatus, OFF)
sendCommand(KitchenTableLightStatus, OFF)
sendCommand(IslandLightsLoadLevelStatus, 20)
end
But I could put that same group of light settings in a OpenHab script, then just just call the script.
rule "Night kitchen"
when
Time cron "0 30 21 ? * *"
then
callScript("night_kitchen")
end
The advantage that all of my light settings are in a single place, and that would make it easier to reuse those settings in other rules - for example to a button on a MiniMote or MultiSwitch. The alternative would be to have multiple triggers for the rule - Time and Command, but I’m using separate rule files for different things. My lighting is in one, my remotes in another, etc. Given that, OpenHab Scripts would seem like the way to go.
That’s the general approach I’m taking as well. For me, it’s limited to the cases where I specifically need to re-use the script.
The Minimote use-case you listed is one of the primary examples in my system.
The other pattern I use a lot is to create a number of specialized Groups that also relate to the Scenes.
Group GManagedGoodnight "Goodnight Switches" (GManaged)
and then attach this Group to all the relevant Switches. You can then use a single line to turn off the relevant Switch items. In my case, there are ~40 switches being turned off with this single command:
GManagedGoodnight.sendCommand(OFF)
This makes my goodnight script simpler, since it’s just:
I’ll have to take a look at groups one of these days. I know they can do stuff like that, but just haven’t used them at all yet for automation purposes, anyway.