My Heating and Hot Water PLEG

Hi,

Its been a while now since i first started playing with Vera… and then when i found out it can not do what i wanted it to do natively, by asking the forum how the heck i could do just some of what i wanted, i was introduced to PLEG. This awesome piece of work really is what i expected Vera to be able to do and as such i have stayed with Vera almost solely because of it (and the RFXtrx plugin).

I wanted to share my Heating and Hot Water setup that i have near perfect now with the hope that it will help others get to grips with PLEG and for others with more skill than myself to point out where i could improve. The aim of this PLEG instance is to optimise Heat and Water in my home by reducing consumption with out really compromising on comfort.

To summarise what hardware i have before the huge PLEG, I have: Motion Sensors in every room (4 in 1’s and PIR’s from a DSC 1832), 13 Danfoss TRV’s, 1 ASR2-RF for switching Hot Water or/and Heating (2 Relays in the device) and 4 1 wire thermometers on the pipes exiting my Megaflo Water Storage tank.

Here is my PLEG Setup:

Triggers
Name Description
DINPIR Dining Room PIR is tripped
DOGPIR Dogs Room PIR is tripped
HALLPIR Hallway PIR is tripped
TEMPPIRHALL Office_4 in 1 sensor (motion) is tripped
BED4PIR Grants_4 in 1 sensor (motion) is tripped
KITPIR Kitchen PIR is tripped
LANDINGPIR Landing PIR is tripped
TEMPLIVPIR Guest Room_4 in 1 sensor (motion) is tripped
LIVPIR Living Room PIR is tripped
UTILPIR Backdoor Motion Sensor is tripped
BED1PIR Master Bedroom_4 in 1 sensor (motion) is tripped

Schedules
Name Type Time Days
Periodic Interval 30m
HeatOnMorn Weekly 03:01:00 1,2,3,4,5,6,7
HeatOffMorn Weekly 08:29:00 1,2,3,4,5,6,7
HeatOffWKND Weekly 10:59:00 6,7
HeatOnNight Weekly 16:59:00 1,2,3,4,5,6,7
HeatOffNight Weekly 22:59:00 1,2,3,4,5,6,7
WaterOnMorn Weekly 03:29:00 2,3,4,5,6,7
WaterOffMorn Weekly 05:59:00 2,3,4,5,6,7
WaterOnNight Weekly 16:59:00 1,2,3,4,5,6,7
WaterOffNight Weekly 17:59:00 1,2,3,4,5,6,7
MidMornHeat Weekly 04:59:00 1,2,3,4,5
WaterOffMornWKND Weekly 06:59:00 6,7
WaterOnMornMon Weekly 01:59:00 1
WaterOffMornMon Weekly 03:59:00 1

Device Properties
Name Device Name Device Variable
WaterMode Hot Water ModeTarget
HeatRelayMode Heating ModeTarget
OutsideTemp Temperature CurrentTemperature
BED3RAD Guestroom 1 Radiator CurrentSetpoint
BED2RAD Office Radiator CurrentSetpoint
BED1RAD Master Bedroom Radiator CurrentSetpoint
BED4RAD Grants Room Radiator CurrentSetpoint
BED1TEMP _4 in 1 sensor (temp) CurrentTemperature
BED4TEMP Grants_4 in 1 sensor (temp) CurrentTemperature
HotWaterStorage Pressure Release (Middle) CurrentTemperature

Conditions
Name Expression
HeatRepeat Periodic
WaterRepeat Periodic
HeatOn (HeatOnMorn or HeatOnNight) and (AnyMotion; NOW < 18:00:00) and ComfortCheck
HeatOff (HeatOffMorn or HeatOffNight) or (HeatOnMorn; ReachedTemp < 05:30:00) or (HeatOnNight; ReachedTemp < 05:30:00)
WaterOn (AnyMotion; Periodic < 18:00:00) and (HotWaterStorage <= 40)
WaterOff WaterTempReached
AnyMotion DINPIR or DOGPIR or HALLPIR or TEMPPIRHALL or BED4PIR or KITPIR or LANDINGPIR or TEMPLIVPIR or LIVPIR or BED1PIR or UTILPIR
TurnDown HeatOffNight
TurnUp HeatOnNight and (AnyMotion; NOW < 18:00:00) and (OutSideTemp <= 11)
MidMorn WaterOffMorn or WaterOffMornWKND and (AnyMotion; NOW < 18:00:00) and (OutSideTemp <= 11)
ReachedTemp (BED1TEMP >= 21) and (BED4TEMP >= 19)
ComfortCheck (BED1TEMP <= 11) or (BED4TEMP <= 11)
WaterStillHot HotWaterStorage <= 40
AnyMotion18 AnyMotion; NOW < 18:00:00
WaterTempReached HotWaterStorage >= 55

Actions
Actions for Condition: HeatRepeat
Device Action Arguments
Heating SetModeTarget NewModeTarget={(HeatRelayMode)}

Actions for Condition: WaterRepeat
Device Action Arguments
Hot Water SetModeTarget NewModeTarget={(WaterMode)}

Actions for Condition: HeatOn
Device Action Arguments
Heating SetModeTarget NewModeTarget=HeatOn
Push Notification SendProwlNotification Event=Heating ON Description=Heating ON Priority= URL=

Actions for Condition: HeatOff
Device Action Arguments
Heating SetModeTarget NewModeTarget=Off
Push Notification SendProwlNotification Event=Heat OFF Description=Heat OFF Priority= URL=

Actions for Condition: WaterOn
Device Action Arguments
Hot Water SetModeTarget NewModeTarget=HeatOn
Push Notification SendProwlNotification Event=Water Heat ON Description=Water Heat ON Priority= URL=

Actions for Condition: WaterOff
Device Action Arguments
Hot Water SetModeTarget NewModeTarget=Off
Push Notification SendProwlNotification Event=Water Heat OFF Description=Water Heat OFF Priority= URL=

Actions for Condition: TurnDown
Device Action Arguments
Dining Room Radiator SetCurrentSetpoint NewCurrentSetpoint=10
FrontDoor Radiator SetCurrentSetpoint NewCurrentSetpoint=10
Guest Toilet Radiator SetCurrentSetpoint NewCurrentSetpoint=10
Guestroom 1 Radiator SetCurrentSetpoint NewCurrentSetpoint=10
Office Radiator SetCurrentSetpoint NewCurrentSetpoint=10
Kitchen Radiator SetCurrentSetpoint NewCurrentSetpoint=10
Landing Radiator SetCurrentSetpoint NewCurrentSetpoint=10
Livingroom Back Radiator SetCurrentSetpoint NewCurrentSetpoint=10
Livingroom Front Radiator SetCurrentSetpoint NewCurrentSetpoint=10
Grants Room Radiator SetCurrentSetpoint NewCurrentSetpoint=10

Actions for Condition: TurnUp
Device Action Arguments
FrontDoor Radiator SetCurrentSetpoint NewCurrentSetpoint=20
Guest Toilet Radiator SetCurrentSetpoint NewCurrentSetpoint=21
Bathroom Radiator SetCurrentSetpoint NewCurrentSetpoint=20
Kitchen Radiator SetCurrentSetpoint NewCurrentSetpoint=21
Landing Radiator SetCurrentSetpoint NewCurrentSetpoint=19
Livingroom Back Radiator SetCurrentSetpoint NewCurrentSetpoint=21
Livingroom Front Radiator SetCurrentSetpoint NewCurrentSetpoint=22

Actions for Condition: MidMorn
Device Action Arguments
Kitchen Radiator SetCurrentSetpoint NewCurrentSetpoint=21
Landing Radiator SetCurrentSetpoint NewCurrentSetpoint=20
Livingroom Back Radiator SetCurrentSetpoint NewCurrentSetpoint=21
Livingroom Front Radiator SetCurrentSetpoint NewCurrentSetpoint=22
FrontDoor Radiator SetCurrentSetpoint NewCurrentSetpoint=20

Actions for Condition: ReachedTemp
Device Action Arguments
Heating SetModeTarget NewModeTarget=Off
Push Notification SendProwlNotification Event=Heat OFF Description=Reached Temp Priority= URL=


There are limitations i need to work through such as the Danfoss thermostats do not always respond but i don’t want to keep sending the command to them as they are battery powered and seem to eat batteries. I need to add logic for the 2 guest rooms so they change from 10c to 20c when motion is detected and the HeatOff command is sent for the Water too many times as the thermometer fluctuates between 49 and 50. Other than that it all seems to work nicely. As it is still summer in the UK I will probably tweak this again in winter but my point being, the above was made some much simpler with PLEG than trying to learn LUA to do the same thing (I tried, i mostly failed).

Hope this helps others who are starting with PLEG to see what can be done with RichardTSchaefer’s plugin(s), and please feel free to help me improve my logic if you see an error or improvement.

One of the things that I see that I could probably improve upon with PLEG that would help your scenario is to add the concept of INTERVALS to the timers.
i.e. optionally specify how long they are true for. Than you would not need to define start and stop timers.

You could replace all occurrences of NOW with PERIODIC
NOW is just a predefined 1 minute interval timer. It is created if it is referenced. But since you already have one you do not need to use it … And I did not see any case where you needed the 1 minute resolution. Your PERIODIC timer is 30 minutes.

[quote=“RichardTSchaefer, post:2, topic:176579”]One of the things that I see that I could probably improve upon with PLEG that would help your scenario is to add the concept of INTERVALS to the timers.
i.e. optionally specify how long they are true for. Than you would not need to define start and stop timers.

You could replace all occurrences of NOW with PERIODIC
NOW is just a predefined 1 minute interval timer. It is created if it is referenced. But since you already have one you do not need to use it … And I did not see any case where you needed the 1 minute resolution. Your PERIODIC timer is 30 minutes.[/quote]

Thanks Richard,

I can see you have implemented StopType and Random Delay to the Schedules now (just updated to 5.13). The reason i have the OFF schedules is to send a different command to the switch to set the value from HeatOn to Off. Is this possible with intervals?

If you have an interval defined as TimerSchedule

You can have two conditions:

BeginIntervalCondition TimerSchedule
EndIntervalCondition Not TimerSchedule

Add appropriate commands to the actions for the above two conditions!

Awesome! Will ditch the redundant schedules now!

Thanks again!

Exclamation mark!

:slight_smile:

Hi @andyvirus

Impressive !, I’ve been looking to do something similar, but need a few more TRVs first.
Would you be able to share a few screenshots of your PLEG set up too.?

I am fiddling with the heating again so unfortunately i have deleted a lot of the schedules and redundant conditions now. Once i have refined it i will update with what i have done.

Basically unlike when i originally set this up, the house was mostly empty in the day time, now it is mostly occupied so i need to re-think what is the optimum way to heat an occupied house with out heating every room for no good reason.

The water heating I have down to a T now so its heating fiddling. I also have to get up really early in the morning some days so need to get some calendar integration going on for those early starts.

Wow I am impressed! I have been thinking about exactly this kind of scenario, so you have done a lot of the work for me ;D I plan to use a heat miser stat but shouldn’t be vastly different. I am interested to know what version of the danfoss you are using? I hear that the latest are slightly more reliable. Do you find they react quickly enough to the new set point when they do react? Very interested to see your evolution of this, as my house is occupied most of the time also, so I am trying to work out how to optimise room control using the danfoss controls and motion to ensure I am not wasting energy heating unoccupied rooms during the day. I kind of know what rooms are mostly used, so I may set lower set points in the others and only up them if there are several motion events in one of the other rooms over a period of time. I thought about perhaps linking a light switch to indicate occupancy in a room so people can override the default daytime behaviour. Any thoughts on how you intend to tackle it?

Cheers

I wonder does the LC13 danfoss valves stay active these days? I had some of the old LC12 (I think) and they were going into “panic” mode which meant they were useless. Is this issue now resolved?