I’m not saying this I the issue but GPIO2 is possibly not a good choice for the DS18B20. It’s connected to the onboard LED and pulled high at boot. Almost any other pin would be better (other than GPIO16). This page is a useful resource
ESP8266 Pinout Reference: Which GPIO pins should you use? | Random Nerd Tutorials
The rules are slightly different from the original
Rule ON tele-SI7021#temperature DO Backlog var1 1; RuleTimer1 30; event ctrl_ready=1; event temp_demand=%value% ENDON
ON tele-DS18B20#temperature DO Backlog var1 1; RuleTimer1 70; event ctrl_ready=1; event temp_demand=%value% ENDON
So you are not “resetting the checking timer”
Not sure if that’s the issue but it seems to be important
Regards
Phil K
Sent from Mail for Windows
--
You received this message because you are subscribed to the Google Groups "TasmotaUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/sonoffusers/d8a6bf23-22d4-41a4-9ba1-3a7c893c2b93n%40googlegroups.com.
BTW the explanation of the rule and the code have different values for the Timer1 (70 and 30) and I don’t know which should be the correct value.
Sent from Mail for Windows
From: Fibra
Sent: 03 June 2022 13:04
To: TasmotaUsers
Subject: Simple Thermostat Example not working with DS18B20
Hello everybody,
--
Right, I’ve had a chance to read the code. RuleTimer1 needs to be higher than TelePeriod so it should be 70 in all cases – if we can get it working I will get the code error fixed.
Just to be absolutely sure can you cut and paste each line into console one line at a time
Rule1 ON system#boot DO RuleTimer1 70 ENDON
Rule1 + ON switch1#state DO Backlog event toggling1=%mem1% ENDON
Rule1 + ON event#toggling1=0 DO mem1 1 ENDON
Rule1 + ON event#toggling1=1 DO mem1 0 ENDON
Rule1 + ON Rules#Timer=1 DO Backlog var1 0; RuleTimer1 70; Power1 0 ENDON
Rule1 + ON tele-DS18B20#temperature DO Backlog var1 1; RuleTimer1 70; event ctrl_ready=1; event temp_demand=%value% ENDON
Rule1 + ON event#ctrl_ready>%mem1% DO var1 0 ENDON
Rule1 + ON event#temp_demand>%mem2% DO Power1 0 ENDON
Rule1 + ON event#temp_demand<%mem3% DO Power1 %var1% ENDON
Backlog SwitchMode1 3; Rule1 1; Rule1 4; TelePeriod 60; SetOption26 1; SetOption0 0; poweronstate 0; mem1 0; mem2 25; mem3 23; var1 0
The key line is
ON tele-DS18B20#temperature DO Backlog var1 1; RuleTimer1 70; event ctrl_ready=1; event temp_demand=%value% ENDON
Which does the following
Sets var1 to 1 (which will be used to turn the power on later if needed)
Restarts the RuleTimer (for 70 seconds)
Run the ctrl_ready event (this checks whether the thermostat is enabled if not sets var1 to 0)
Runs temp_demand event (if the temperature is greater than the high point switches power off – if lower than low point uses var1 to decide if power should be on or not)
However, in the console output you show only the line above runs
ON Rules#Timer=1 DO Backlog var1 0; RuleTimer1 70; Power1 0 ENDON
If it doesn’t work after re-entering the code try this
Rule2 on ds18b20#temperature<30 do power1 1 endon
Rule2 1
Which will simply check that the ds18b20 is being read and turn the power on if the temperature is lower than 30
Good luck
Phil K
To view this discussion on the web, visit https://groups.google.com/d/msgid/sonoffusers/31422fd7-c49d-4fc4-97b0-74e68a185050n%40googlegroups.com.