I’m trying to understand if there is a better or more efficient way to do this…
I have various “modes” based on different conditions by using helper boolean inputs. There are currently 4 different types of conditions with various mutually exclusive modes available for each one. For instance, some examples of these modes are:
Vacation - set when both our phones are a certain distance away from the home for a certain period of time (combines geofence and time)
Home Mode - set when either of our phones are at home (mutually exclusive with Away Mode)
Daytime Mode - set at a certain time in the morning (mutually exclusive with Evening Mode, Bedtime Mode, Night Mode)
Christmas Mode - manually set when Christmas decor is out
Basically, what I have envisioned in my head is a table with all the various combinations of modes on one axis and all my devices listed down the other. There would be a filter at the top so you could show the status of all switches, lights, thermostats, etc. for any given combination of modes.
The use case would be managing devices on a macro level for a base-state of all devices under very broad conditions. For example:
Someone arrives home
Home Mode changes to “On”
HA looks to see which various modes are on and sees…
Vacation Mode is “Off”
Christmas Mode is “On”
Evening Mode is “On”
It would then reference the table, find the column for this combination of modes
Set each device according to the desired status in that column
Kitchen Counter Light = On, 50%
Study Lamp = On
Bedroom Chandelier = On, 50%
Downstairs thermostat = 68 degrees
etc…
Two very nice benefits:
When you add a new device, it would be easy to set its condition across all the various automations you have as opposed to opening each one and adding it. You pull it into the table and set them all at once.
If you want to change how one specific device behaves across the board, you can do it directly in a table format instead of having to edit each automation.
This gets a little tricky I guess when automating specific micro actions - I’m viewing this more in the lens of “whole home” states - sort of like a base layer. Individual motion/presence sensing tasks could override and then return to the base state.
Does something like this exist? Am I overthinking it?
There isn’t anything that I’m aware of that is close to the big picture of what you described, with a filterable database of presets, but there are a couple things that touch on some of the concepts…
There is something just for lights called light profiles that allows you to specify a preset for individual lights or groups. So, you could use a template sensor or template select to define the profile that should be used, then set up your automations and scripts to use that to provide the value for profile in the light.turn_on action. However, profiles are probably one of the least used features in HA. Profiling every light can be a huge chore and there are almost always end up being cases where you don’t want the profile to be used, so you end up having to build out the logic of the automation anyway.
The other HA concept that is kind of like what you have described would be Scenes. Scenes allow you to define a preset state for multiple entities that can be called into being with a single action.
Let me preface this with the disclaimer that I am not a “modes” person… so take this with a grain of salt.
I think you may be glossing over the amount of work the set up would be and how much extra work you are going to be creating for yourself to cover all the edge cases that don’t fit the monolithic mode scheme.
Let’s abstract your modes a little and say you have the following:
Occupancy (Home, Away, Vacation)
Times of Day (Morning, Day, Evening, Bedtime, Night)
Special (None, Christmas)
There are 30 combinations possible from those, which means you would need to define 30 desired states for every entity you plan to control with this scheme. Or you would need to design some sort of mode hierarchy or inheritance function.
I don’t think it would really simplify much, especially considering the UI you have in mind doesn’t exist.
I am not an expert at HA so if I were to implement your automatic configuration I’d end up brute forcing it.
First off, you’d have to determine how many dimensions you have, looks like you have 3. (occupancy (3), time (3), season (2) ) This will yield 18 lighting conditions. You would trigger the automation on a change in one of the dimensions.
The action would have two parts. First part determining which of the 18 scenes. This could result in a number 0 through 17 though setting a combination of 5 bits would be easier to calculate but harder to document (first 2 bits are occupancy, 2nd 2 are time, last bit season). The second part would be a series of 18 if statements checking the scene number then setting the scene that corresponds to the scene number.
Thank you - you seem to get exactly what I’m saying since you correctly surmised the number of “modes” combinations. That is exactly what I was going for.
That being said, I know it would be a lot on the front end. I literally have over a thousand entities somehow and I don’t even have that much in my home. The initial setup would be a chore but nothing insurmountable.
The benefit is when I add or change a device. My vision is that it would simply be matter of locating the device and pulling up its control(s). There would be a table of 30 different modes and I would simply go down the list and select the state for each given mode. Then it’s done. In about one minute, I’ve programmed what I want the control to do for every possible combination of events. The reality is it probably wouldn’t really be 30 different states - with groupings I could pare it down (e.g., lights that stay active in automations in vacation mode vs. lights that can stay off the whole time; a light in one room would never be triggered by occupancy sensors in another, etc.).
So going through it… I just added a Shelly that turns off all the outlets in my living room (not TV… just lamps) - I would want this switch off for:
Vacation/Morning/None
Vacation/Daytime/None
Vacation/Evening/None
Vacation/Bedtime/None
Vacation/Night/None
Vacatation/Morning/Christmas
Vacation/Daytime/Christmas
Vacation/Night/Christmas
That’s 8 of 30 modes where the switch stays off - that would take around 30 seconds to setup. The alternative is going into each of 10 automations to map this control with all the other various entities in the automation.
If I want to later change the switch to turn off when we are also away but not on vacation, its just a matter of modifying 7 cells in a spreadsheet vs. editing a handful of automations and surgically turning it off.
The problem I’ve found with the “select” type modes is that they usually are triggered by the same “sensor” - like time of day. That’s fine for “Daytime” and “Evening” modes for me but I want Bedtime and Night modes triggered by other things like sunset and bedroom occupancy (I actually use a script for when my phone is charging on a smartplug by my bed).
The alternative is adding a new device and then having to go through every automation individually to dictate what I want to happen. Less work upfront obviously, but more work as things grow and/or change.
Thanks for the reply - I think its both simpler and more complicated. Certain “modes” are mutually exclusive (Day/Night, etc.) and others are not (Bedtime/Christmas). But the mutually exclusive modes aren’t necessarily triggered by the same events (eg., time of day vs actual sunrise or sunset; Christmas is a manual switch for me, etc.). Its easier to just have a list of 10 different modes and look at whether they are on or off. Instead of 100 combinations, its actually 30. Still sounds like a lot but in practice, most of the programming is binary (eg., a switch is either on or off). Not a lot of “thinking” to do on my part and very easily changed later.