OK, let’s see how this works…
I have attached PDFs of the Reports from a PLEG and two PLTSs. The PLEG is an extract of my main heating and hot-water logic. The two PLTSs are simple monostables that give a five-second pulse whenever the associated VirtualSwitch changes state. The need for these is peculiar to how I like my logic to work: When I change the state of one of my master switches, I want the logic to syncronise regardless of where it is in the timing cycle. The pulses make this easy to achieve.
My main heating is controlled by a Horstmann HRT4-ZW thermostat which is directly associated with a HorstMann ASR-ZW relay. I don’t really ever turn the heating on or off - I just change the temperature setpoint. The required setpoint is calculated in the PLEG according to various states. When the master switch HouseHeat is off, the setpoint will be 8 degrees for frost protection. During the night or if I am away from home, the setpoint is 14 degrees. In the morning it is 20 degrees and it drops to 19 degrees after 10 am. The calculation is in the condition SetPoint supported by Heat and DoDrop. The setpoint is sent to the thermostat by the condition SendTemp which evaluates the circumstances under which I want the temperature to change.
My master switches include: EarlyStart which enables a separate pair of on and off schedules for a one-time override of the normal ones. This activates both heating and hot water and I use this when my clients demand my presence at uncivilised times of the morning. HouseHeat is the main enable for heating above the frost-protection point. HotWater is the enable for water heating. HWBoost triggers a one-shot 30-60 minute cycle of water heating which is useful when guests are staying. It is also fired automatically when returning from vacation (during which the water heating will have been off). Most of the master switches are set and cleared by various remote controls scattered around the house. They are also on the Dashboard for access by 'phone.
The schedules should be mostly self-explanatory. In addition to the normal weekly on and off times, I have absolute times for start and finish of vacation (Away and Home) and a 30-minute interval (see later).
The device property HWRelayMode is used to capture the last command sent to a second Horstmann ASR-ZW relay that controls the hot water tank motorized valve - which in turn “calls” for heat from the boiler dependent on the tank 'stat. The ASR-ZW has a fail-safe mechanism that requires periodic resend of the required state. The condition HWPulse, triggered every 30 minutes by the I30M schedule, fires an action which re-transmits HWRelayMode thus refreshing the ASR-ZWs watchdog. This will work even if I have set the relay state external to the PLEG.
The conditions include three sequence expressions: EarlySeq, NormalSeq and AwaySeq. These conditions are true when the sequence has completed. E.g. AwaySeq is false when I am away and true when I am home. The remaining conditions use the state of these sequence conditions along with the master switches and schedules to determine when to change the heating thermostat, what setpoint to send and whether the hot-water should be on or off. The DoAway and DoBack conditions also fire actions to set or clear a VirtualSwitch called Away which activates another PLEG to manage lighting and other security features when I am not at home.
The actions should be fairly obvious given their names and the above explanations.
I really don’t know how useful this will be to others. I did it this way because that’s how I want it to work. ;D Some of the logic is designed with future enhancements in mind - so there are simpler ways to achieve it if that is all you need.
If you want more details on any of the above, please ask.