Andrew Flegg<p><span class="h-card" translate="no"><a href="https://hachyderm.io/@w8emv" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>w8emv</span></a></span> Beyond naming convention, one thing I learnt early on in <a href="https://social.linux.pizza/tags/OpenHAB" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>OpenHAB</span></a> - not yet completed switch to <a href="https://social.linux.pizza/tags/HomeAssistant" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>HomeAssistant</span></a> - and intended to document is using a state machine for anything reasonably complex.</p><p>For example, rather than "turn lights on if it's dark and we're home and we're not in bed, or it's 6:30 on a weekday or 7:30 on a weekend or there's activity", which could include loads of different sensors and flags, have a single value for "phase of the day". For example, EARLY, DAY, NIGHT; and a Boolean for "activity in communal areas" and "is dark outside".</p><p>The naming convention is also useful, at least in OpenHAB, because a script can react to a group of items and then use the naming convention to affect something else. For example, when `Internal_Lounge_TV_Online` switch `Internal_Louge_Audio_Source` to the TV, because `Internal_*_TV_Online` changed to `ON`.</p>