Regular readings will recall that our central heating is run by Apple HomeKit giving multiple zones with independent time and temperature schedules, we also monitor key windows to warn if they have been left open, and have some interaction between windows and radiators so local radiators are disabled while a window is left open. Generally all of this works very well, but occasionally we find that the state of the window warning lamp is inconsistent with the physical position of the windows, or the boiler runs unexpectedly overnight (although it only heats the central core of hall, stairs and landing). I suspect that the cause is intermittent lack of communication between the hubs and smart devices such the the hub misses the shut down of the last radiator valve at night, the last window to be closed, or the first to open. Control rules are all triggered by changes of state, and if the change of state is missed then you’re sunk.
It occurred to me that what is required is a periodic check on the status of the imputs and appropriate changes to the outputs even if the change of state that should have triggered the rule was missed – I think of this as a watchdog. In the ideal world it shouldn’t be needed but periodically it will correct the status of an output.
You could of course program multiple time-based triggers into every rule (remember that a rule is if any trigger and all conditions then set scenes), but this is time-consuming and far from elegant.
Elagto’s Eve app, which I prefer over Apple’s own Home app for writing rules, does offer a recurring timer function, but it only enables a scene directly and cannot itself be part of a trigger or condition in a wider rule.
This was handled as follows:
- Create two new scenes, one of which just turns the device on, and the other just turns it off.
- Create two new recurring timers; for me one sets the on scene on the hour, and every five minutes subsequently, and the other sets the off scene at two minutes past the hour and every five minutes subsequently.
- The device should now be cycling on and off continuously – two minutes on and three minutes off.
- Next I’ll test the on transitions as part of a series of rules.
- Each rule to be modified may need two steps of modification. Firstly the existing triggers may need to be replicated as conditions – so for example an ‘at sunrise’ trigger may be to be replicated as conditions ‘after sunrise’ and ‘before sunset’ given that this rule will be retested throughout the day. Secondly an extra trigger is added for if my watchdog turns on.
- The resulting rule should still work in the original manner if the ‘at sunrise’ trigger is detected, but if not within minutes (and every five minutes subsequently) the watchdog will trigger another evaluation of the rule.
My expectation is that this will improve the robustness of my system operation once I’ve changed all my rules suitably.