Just as a way of update I have updated this collection of bits and bobs to use JSON as it's interchange format, instead of comma separated strings.
This provides an ability to tag more information into each "Datum" such as proper names for things and the hub will timestamp data as it arrives so the display (lcd_heating_monitor.py) can flag stale data by prefixing it with a * on the display.
This was a pre-cursor, call it V1.1 for adding a scheduler and writing data back out to devices, such as, a central heating controller. It needs to get data by name from the hubs data, test some conditions and then write a named value back, such as "heating_switch":"True". This upgrade will hopefully come in the next week or two.
The early parts of the scheduler and conditions framework is present in scheduler.py but not hooked up to anything yet. Basically the scheduler has an ordered set of schedules. Each schedule has a set of Conditions with modifiers which form a logic chain. These are evaluated and the schedule returns "True" if it's conditions match. The scheduler will then call "activate()" on the schedule allowing it to do what it needs to. If it's conditions return false, the it calls "deactivate()" to allow the schedule to set up it's trigger data.
As an example, a schedule for my base heating value might be:
OR TimeCondition( 06:30, 07:30 )
OR TimeCondition( 17:00, 23:00 )
AND DataCondition( "OR", [("livingRoom", "lessThan", 22), ("bedroom","lessThan",20),("garage","lessThan",1 )] )
The later DataCondition will run the given tests as an OR operation. If all of these conditions match this schedule will return True and the scheduler will call activate() which will insert/update a Datum item with the key heating_switch: True.
For now I'm aiming at a single active schedule. Schedules will be in order of priority with the highest first. Upon finding an active schedule the scheduler will activate it and proceed to deactivate the remaining schedules. This does require care and attention to not create loops or feedback in the schedules, but certainly much easier to deal with than multi-schedules.
Longer finger I might consider multi-zoning, but I'm currently thinking this will be done a bit crudely with just one independent scheduler per zone. Of course all schedulers have access to each others data so can cross communicate.
The gitlab for the project should be accessible here:
https://gitlab.com/paulcam/home_heating