Interesting post. (on a side note: I advise you to change the title of the post to something more describing).
I have had home automation for a hobby for over 10 years. I second a lot of what you’re saying. The funny thing is that I do a lot of things ‘wrong’ but leading to interesting findings and approaches.
I have a few premises towards Home Automation that guide me while I went along to see where my experiments would take me:
- The home should be controllable by a stranger who has no clue how much is automated.
- If home automation breaks, the home should stay functional.
- I should not need to fight automations. They should be unintrusive and either work quite well 95% of the time or not interfere.
- If automations do make mistakes, the user must be able to intervene easily.
- A home is to complex to be fully rule based. PLC style automation (with rules that suggest ‘always when…’ instead of trigger based) is not going to work in a home. There are too many variables.
But instead of building a well designed, compact, easy to understand system, I did the opposite to see where it took me. If there is a sensor that is fun, add it. If an integration exists that is interesting, add it. Usefullness is not an argument, the more the merrier. It is a hobby and a playground first and foremost. Home Assistant takes that kind abuse remarkably well by the way.
The first interesting result is this: The ideas followed from the abundance of information and things to control, not from a wish to accomplish something usefull. Combining things I had to something more worthwhile. And the bigger the system grew, the better the automations became. But that needed an approach to reduce complexity.
Because I have so much things in Home Assistant, I needed a way to increase information density in dashboards in a way that was still attractive and useable. I built a lot of custom components to combine related data and controls. But that becaume unmaintainable too. I also needed a way to reduce complexity in automations that combined lots of inputs.
One thing I learned was to create lots of entities to reduce complexity and make me understand what happens. For instance: Many of my windows have two window sensors, one for ajar and one for wide open. That is because when ajar, a curtain can still close, but not when the window is wide. I also have automations to tell me if I need to open a window or close it based on inside/outside temperature differences, air quality inside, direct sunlight, positions of shades, etc.
So ultimately I have a template entity for each window which is much richer in information than your average window sensor. It tells how far open it is, if I’d rather need close or open it instead, why that is usefull and maybe even what information led to that conclusion. I have an entity saying when it might be a good time to charge my car, how much time it will take and when I think it will be ready. I also have an entity telling me when I need the car to be charged. The automations reacting on them are small and easy to understand by themselves.
The logic is not all in that entity. I create lots of entities in between to combine information into new information. I for instance have an entity telling me if I produce more sun than I use. I have en entity telling me if the diswasher is waiting to be started automatically if there’s an excess of sun. You get where it takes me. Those entities are pretty self explanatory, and often by combining yet other entities in the way you use functions and variables in programming. Yet they are not functions, they are states. Ready for use 100% of the time, triggering events when the stars align.
I also added attributes to help me reduce the number of custom components I needed for dashboards. I started adding information for presentation in a standardised way. What color/background/icon is most suited to represent its state? So now I have some custom front end components. But they take their cues in a standard way from the entities and their attributes.
Working this way, many entities became self explanatory and about a what I need to know about something in the human domain rather than about what an IOT device is meant to measure or control.
Interestingly enough, my approach is contrary to where Home Assistant seems to be heading. (Partly standardised) attributes are my friend, but HA is moving away from using them and making showing them harder.
Instead Home Assistant is moving focus towards devices. But those devices often represent an IOT thing such as a smart plug, but not a domain thing (something in my home combining a lot of information coming from different IOT devices). Most devices are either a control of a sensor. So unless HA at some point makes it possible to create ones own enriched devices, standardises information inside those rich devices and has components to show those devices as one thing in the UI, this is not helping me in my approach.
It would also require entities to be able to belong to multiple devices if that information is useful in more ways. This is something I now do by referencing other entities in attributes, which is awkward for the user.