this post was submitted on 06 May 2025
14 points (93.8% liked)
homeassistant
14104 readers
36 users here now
Home Assistant is open source home automation that puts local control and privacy first. Powered by a worldwide community of tinkerers and DIY enthusiasts. Perfect to run on a Raspberry Pi or a local server. Available for free at home-assistant.io
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Before you start consolidating, consider what might happen if the switch is in an unexpected state. For example, someone turned off the heater or pump and you were expecting it to be on.
In other words, you need to consider what a "safe state" is for each thing and how your code, when it fails, reverts to that state. This is an example of "failsafe".
Note that I said "when it fails". This is true for all software, even on mission critical systems.
Source: I write software for a living.
Yes, definitely. That's one of the reasons I've implemented this way. If a light (for example) had the physical switch turned off and back on, a lot of smart bulbs will go to the on state, even if HA had previously set (and expects it to be) off. The next execution may turn it off in an off state, on in an on state, on from an off state or off from an on state, but either way that truth table will resolve after an iteration