Has anybody come up with a good method of defining rules and scenes for their openhab setups that aren’t too difficult to maintain? I’ve had openhab up and running for about 6 months with 4 lights in two rooms in my apartment. The rules seemed a bit complicated to maintain for what I wanted to do. For example, when I say “bedtime”, the living room lights where I am turn up to 50% so I can see my way to the bathroom to get ready for bed. After a bit of time, they gradually dim all the way to OFF. At the same time the living room lights turned on, the bedroom lights turn on also. My phone begins to auto listen. Once I am finally in bed, I say “tucked in” and the lights all turn off. That rule was a bit complicated, but worked pretty consistently once I got it set up. However, even basic scenes where I turn the scene on and various devices change to predefined settings have seemed like a fair amount of work to set up and could be error prone. I just moved from an apartment to a bigger house and will be adding more devices gradually. I want to come up with a manageable method for configuring scenes and rules.
Here’s an example of a scene I have set up:
Items:
Scene_Living_Room - a number used to track and set scene state. 0 is off, 1 is dim, 2 is medium, 3 is bright, 4 is custom
Bulbs 1 - 4
Bulb1LivingRoomBrightSetting
Bulb1LivingRoomMedSetting
Bulb1LivingRoomDimSetting - These are numbers between 0 and 100 that I use to configure the bulbs when the scene is enabled. Each bulb has its own set of numbers. They aren’t necessary, but the other option is to hard code values in the rule. I’d prefer to set up a rule once and not have to edit the configuration files again to make small tweaks. This allows me to change bulb values from the site maps. I have all of the setting values in their own pages. I have a switch named showSettingsValues and the setting items visibility is set for when showSettingsValues is ON.
Rules: (these are pseudo code from memory)
Rule “living room scene”
When
Scene_Living_Room received command
Then
If received Command == 3
{
Sendcommand(bulb1, Bulb1LivingRoomBrightSetting)
Sendcommand(bulb2, Bulb2LivingRoomBrightSetting)
… The rest of the bright bulb settings…
}
If received Command == 2
{
… Same thing as 3 but with med settings
} If received Command == 1
{
… Same thing as 3 but with low settings…
}
If received Command == 0
{
… Same thing as 3 but off…
}
End
I also have a rule for when any of bulb1 through 4 is updated where it compares all 4 bulb values with the settings for the scenes above. If all of the bulbs match a scene setting then I update Scene_Living_Room to that scene’s value. Otherwise I set it to 4 for custom.
Is this setup along the lines of what other people are doing? Have I made it too complicated? Does anybody know of good ways to streamline the rules? It seems like if I add another bulb it would be quite a few places that I have to update, and I’m trying to make it as simple as possible.
Looking forward to hearing about other people’s experience!