Skip to content

Instantly share code, notes, and snippets.

@gacha
Created February 16, 2025 18:55
Show Gist options
  • Save gacha/513215d44c754fb812839d9e2240f769 to your computer and use it in GitHub Desktop.
Save gacha/513215d44c754fb812839d9e2240f769 to your computer and use it in GitHub Desktop.
Tasmota using a relay controls boiler valve to heat the water tank.
  • A pellet stove with a temp sensor.
  • A valve which switches the stove from heating home or water tank, by default it heats the home.
  • A water tank with a temp sensor.
  • An ESP12F-X4 Relay Module
Rule1
   ON System#Boot DO
// stove is not warmed up
      Backlog2 var1 0;
// min water temp
      mem1 30;
// max water temp
      mem2 40;
// warmed stove temp
      mem3 55;
// cold stove temp
      mem4 50;
// Timezone settings
      Timezone 99;
      TimeStd 0,0,10,1,4,120;
      TimeDst 0,0,3,1,3,180;
// Telemetry period
      TelePeriod 60;
// Disable one-shot
      Rule 4;
// Switch between - or _ as sensor name separator
      SetOption64 1;
// Turn all relays off on startup
      PowerOnState 0;
// Run watchdog timer for DS18B20_1 sensor
      RuleTimer1 70;
// Run watchdog timer for DS18B20_2 sendor
      RuleTimer2 70;
   ENDON
// When watchdog timers fire, then turn everything off
   ON Rules#Timer=1 DO Backlog2 var1 0; RuleTimer1 70; Power2 off ENDON
   ON Rules#Timer=2 DO Backlog2 var1 0; RuleTimer2 70; Power2 off ENDON
// When telemetry is read
   ON tele-DS18B20_1#temperature DO Backlog2 RuleTimer1 70; event stove_temp=%value% ENDON
   ON tele-DS18B20_2#temperature DO Backlog2 RuleTimer2 70; event water_temp=%value% ENDON
// stove is warmed up
   ON Event#stove_temp>=%mem3% DO var1 1 ENDON
// stove is cold
   ON Event#stove_temp<=%mem4% DO var1 0 ENDON
// Turn on the valve if the stove is warmed
   ON Event#water_temp<=%mem1% DO Power2 %var1% ENDON
// Turn off the valve if the water is warmed
   ON Event#water_temp>=%mem2% DO Power2 off ENDON
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment