This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Thermostat with auto disable function
#1
Hello all,
I'm looking for thermostat function/script with 1-bit output. I have a electric heater in the bathroom, which controlled by MDT 1216 actor, and I have also motion detector and window sensor installed.

The idea is to start the heater (electric plug) as long:
"current temp"< "set value temp"
AND window is closed 
AND last motion detected < 1hour

Heater off (electric plug) if:
"current temp" + hysterese > "set value temp" 
OR window opened 

Heater thermostat function off if:
1) last motion detected > 1hour (in case the thermostat was forgotten)
2) OR   "current temp" > "set value temp" for more then 1 hour (in case it's too hot, but somebody enabled the heater).

It's not a PID functtion, just 1 point thermostat with some supervision.
Please advise!
 
Reply
#2
Hello

There are several questions at this moment:
1.) Are you going to control only one electric plug with connected heater? (cause it is a bit confusing "Heater off (electric plug)" and "Heater thermostat function off")

2.) How often does motion sensor is sending the telegrams (after what time it switches off)?
Reply
#3
(22.10.2024, 11:08)RomansP Wrote: Hello

There are several questions at this moment:
1.) Are you going to control only one electric plug with connected heater? (cause it is a bit confusing "Heater off (electric plug)" and "Heater thermostat function off")

2.) How often does motion sensor is sending the telegrams (after what time it switches off)?

Hello RomansP,

1) well, the electric wall heater is just plugged to electric plug without any own control or measurement. So, I just need to switch on/off the electric plug.

2) the motion sensor ist MDT BWM55.02. As I know, by default it sends ON telegram at begin (but can also send this telegram cyclically) and it sends OFF telegram after expiry of time - normally to control the lights, but I don't use it.


I don't have expirience with ser/reset timers. To build a logic is not a problem.
Reply
#4
Here is a script, but please carefully test it and give the feedback.
I will make a changes if necessary.
It is a resident script, with sleep time 60 seconds.

Code:
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
if not motion_minute_counter then   motion_minute_counter = 0 end if not temp_minute_counter then   temp_minute_counter = 0 end motion_detected = grp.getvalue('motion_detected') -- boolean current_temp = grp.getvalue('current_temp') -- float window_opened = grp.getvalue('window_opened') -- boolean heater_status = grp.getvalue('heater_status') -- boolean --log(motion_detected) --log(current_temp) --log(window_opened) --log(heater_status) set_temperature = 25 -- Celsius degree hysteresis = 1 -- Celsius degree one_hour = 60 -- minutes if not motion_detected then   motion_minute_counter = motion_minute_counter + 1 else   motion_minute_counter = 0 -- motion was detected unset counter end if current_temp > set_temperature then   temp_minute_counter = temp_minute_counter + 1 else   temp_minute_counter = 0 end if current_temp < set_temperature and       not window_opened and       motion_minute_counter < one_hour and       not heater_status then -- heater is off     grp.write('heater_control', true)   end if (current_temp + hysteresis > set_temperature or window_opened) and heater_status then   grp.write('heater_control', false) end   if (motion_minute_counter > one_hour or temp_minute_counter > one_hour) and heater_status then   grp.write('heater_control', false) end --log(motion_minute_counter) --log(temp_minute_counter)
Reply
#5
Hi RomansP,

thanks a lot, I done some changes in your script and will check it the next days.
At the moment I just using the switch button to on/off the plug with electric wall heater.
Now by using resident script I have to activate/deactivate the script with same button/group address.
How to do this?
Reply
#6
Hi

You can simply enable/disable script using other event script.
Here is example of boolean object, event script

Code:
1234567
value = event.getvalue() if value then   script.enable('heater_on_off') else   script.disable('heater_on_off') end
Reply
#7
Got the script working perfect! Thanks a lot!!!!

Some changes need to be done, so it will work properly.
1) when the script is switched off, the heating must also be switched off directly in event based script
2) provided script toggels the heater (switches on/off the heater) every 1 minute due to wrong hysteresis logic. So it tries to reach the temperature =set_temperature-hysterese.

I changed the logic to following:
Code:
12345678910
if current_temp < set_temperature - hysteresis and       window_closed and       motion_minute_counter < one_hour and       not heater_status then -- heater is off   grp.write('heater', true) end if (current_temp > set_temperature or not window_closed) and heater_status then   grp.write('heater', false) end


Best regards.
Reply


Forum Jump: