Page 1 of 1

Script to monitor if heaters really are switched on?

Posted: Saturday 09 February 2019 21:51
by espenf
I have a thermostat-script that controls my heaters based on data from temperature sensors in the room and a dummy-thermostat in domoticz. Most of the heaters are controlled with 433mhz-plugs.
It works relatively fine, but every now and then the 433-plugs ignores a command from the controller. I guess thats a well known problem with 433-devices.. :)
I combine this with another LUA-script to improve 433mhz reliability that minimizes the problem, but it still occurs once or twice a week. And it is not usually discovered before its bedtime for the baby and the room is cold, or even worse, when the babys mother are freezing.. :shock:

So, have anyone found a good solution to monitor or fix this?

I'm thinking that I should monitor temperatures and send an alarm to my phone if the temperature is sinking when domoticz think that the heater is on and vice versa.
But Im not quite sure where I should start. I have alarms set for given temperatures, but it would be nice if it could be more dynamic and based on the thermostat set point aswell.

Re: Script to monitor if heaters really are switched on?

Posted: Sunday 10 February 2019 7:12
by Egregius
For the rare case the Zwave network misses a command I use this on my bathroom heather, script is part of the bathroom thermometer in pass2php:

Code: Select all

<?php
$prev=apcu_fetch('badkamer_temp');
$set=apcu_fetch('badkamer_set');
$tbadkamervuur=past('badkamervuur1');
if($status>$prev&&$status>$set&&$tbadkamervuur>600){
	sw('badkamervuur1','Off');
	sw('badkamervuur2','Off');
}elseif($status<$prev&&$status<$set&&$tbadkamervuur>600)
	sw('badkamervuur1','On',true);
Basically, when the new $status (in this case $status is the new temperature) is higher than the previous and it's higher than the setpoint switch the heater off again.
Else if the new $status is lower than the previous and it's lower than the setpoint, switch the heater on again.

Re: Script to monitor if heaters really are switched on?

Posted: Sunday 10 February 2019 21:37
by espenf
ok, so you save the last state somehow, or is it possible to read previous values for the sensor?
This script runs every time the temp-sensor gives a new status, or is it time-based?

Re: Script to monitor if heaters really are switched on?

Posted: Sunday 10 February 2019 23:10
by Egregius
It's pass2php. The script is device triggered, so on every temperature update of that thermometer. Because the new status is saved after the execution of the device script it's possible to get the previous value from the php cache. That gives the possibility to create scripts like these.