[Almost Solved]Repeating Temperature Setpoint Watchdog

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
The_Rascal
New user
Posts: 4
Joined: 09 Mar 2017, 01:56

[Almost Solved]Repeating Temperature Setpoint Watchdog

#1 Post by The_Rascal » 09 Mar 2017, 03:20

At the moment I have a Domoticz server running on a Raspberry which i Can send a setpoint using the code below.

This works well, as long as i resend the data from Domoticz ever few minutes as it only checks that once and makes a decision to turn on or off GPIO 12.
After the temperature has dropped to below the setpoint it will not turn off until i send the setpoint again from Domoticz.

The question is
Can i make the esp8266 compare the setpoint to the room temperature every 60 secs, just encase the Domoticz goes down or a lose Wifi.

Domoticz Code

Code: Select all

commandArray = {}
        if devicechanged['Tent Temp Fan Control Setpoint'] then
   DomDevice = 'Tent Temp Fan Control Setpoint'
         DomValue = otherdevices_svalues[DomDevice]
         CalcValue = (DomValue*1)
         print(CalcValue)
         url= 'http://192.168.1.200/control?cmd=event,FanSetpoint='..(CalcValue)..''
         commandArray['OpenURL']= url
end
return commandArray 
In the esp8266 i have this running as a rule

Code: Select all

on FanSetpoint do
 TaskValueSet 3,1,%eventvalue%
  if [Room#Temperature]>[RoomTemp#Temp] do
   GPIO,12,1
   else
   GPIO,12,0
   endif
endon
Room#Temperature Is the Actual temp
RoomTemp#Temp is the setpoint sent via FanSetpoint.

In The ESP i have a Dummy device setup in Location 3 and

1 Temperature & Humidity - DHT Room 23 GPIO-14 Temperature: ¬¬¬¬¬¬¬
2 Switch input FanRelay 28 GPIO-12 State:¬¬¬¬¬¬¬ I use this to tell Domoticz The relay is on or off
3 Dummy Device RoomTemp Temp: THE SETPOINT SENT FROM DOMOTICZ


Thanks so much for Looking and at least thinking about it.
Last edited by The_Rascal on 09 Mar 2017, 21:54, edited 1 time in total.

The_Rascal
New user
Posts: 4
Joined: 09 Mar 2017, 01:56

Re: Checking a Temperature against a setpoint

#2 Post by The_Rascal » 09 Mar 2017, 21:47

If been thinking overnight,

Please keep in mind this is the first code i have ever written.

After trail and error this seems to work

Code: Select all

on System#Boot do
  TaskValueSet 3,1,24                                                   // 24 is a setpoint to return to if power is turned off.
  TimerSet,2,60                                                           // 60 seconds to then start Temp-Watchdog.
endon

on FanSetpoint do
  TaskValueSet 3,1,%eventvalue%                  
  TimerSet,1,10                                                           // 10 seconds after a setpoint has been received restart Temp-Watchdog 
endon

on Rules#Timer=1 do
    event,Temp-Watchdog 
endon

on Temp-Watchdog do
  if [Room#Temperature]>[RoomTemp#Temp] do
   GPIO,12,1
   else
   GPIO,12,0
   endif
   TimerSet,2,120                                                         // 120 second THEN restart whole check of setpoint to actual temp.
endon

on Rules#Timer=2 do
    event,Temp-Watchdog
endon
I was hoping someone might be able to check the code over and see if it can be compressed or improved. I know it looks crap, but im over the moon it works.

Thanks The_Rascal...

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 0 guests