I’m trying to re-do some of my automations to be more in line with AD. I still believe there is an underlying zen to automation. I’m just having problems finding it. With just straight forward automation where we write an app around turning the lights in the room off when we turn on the media player. It’s all good, until someone arrives home which turns on the lights in the hallway which now disturbs the media watching atmosphere. The problem with working from an automation centric view to me is that the automations occasionally step on each other.
Which brings me to my question.
What are the pros and cons of looking at automation from each of these perspectives?
Stimulus response. A door is open which causes a light to come on. We listen for the door to open and in response we turn on the light. The application is written from the perspective of the door.
Response/Stimulus: The light waits and watches for a stimulus to occur and then does a pre-defined action. The lights in my office listen for the door to be opened. When it’s opened, they turn themselves on.
For me, all decisions about whether a light turns on or off are taken in the light’s app. Otherwise, the code is scattered all over the place and hard to debug.
every time i implant a new automation, i have the risk that it also affects already running automations.
so when that happens i have to implant that effects into the automations.
most of the automations run without interfering with each other.
but then you run in to a group of automations that interfear with each other all the time.
in that case the automations get a little more complicated.
like the raindrop in the pond.
most off them will never affect the other raindrops.
but if a lot fall at the same place its difficult to calculate the effects.
most of the time i try to find an overal effect on that, or try to make my view smaller. (hallway lights are not mixing with livingroom lights that are affected by media for instance.)
You might even group your apps like this. Instead of having an app for lights, and one for thermostats, and one for fans, you would have one app that houses responses to event listeners, or basic automations. And then another app that handles more complex automations. In a robust setup, you’re likely going have scenarios where you want both kinds of automation.