summaryrefslogtreecommitdiffstats
path: root/tasmota-config
diff options
context:
space:
mode:
authorfishsoupisgood <github@madingley.org>2020-09-09 11:53:37 +0100
committerfishsoupisgood <github@madingley.org>2020-09-09 11:53:37 +0100
commit9d87c925a9eaa4fc256be3173c14a20d1469472d (patch)
tree50d63f87a47a0eac3f5b8058850184bcd4e6ee95 /tasmota-config
parentdafd8cf2fdcdd637cc06f760d318cf8391b1a294 (diff)
downloadheating-9d87c925a9eaa4fc256be3173c14a20d1469472d.tar.gz
heating-9d87c925a9eaa4fc256be3173c14a20d1469472d.tar.bz2
heating-9d87c925a9eaa4fc256be3173c14a20d1469472d.zip
everything, mostly, working
Diffstat (limited to 'tasmota-config')
-rwxr-xr-xtasmota-config/configure-radiators74
1 files changed, 74 insertions, 0 deletions
diff --git a/tasmota-config/configure-radiators b/tasmota-config/configure-radiators
new file mode 100755
index 0000000..488e7e3
--- /dev/null
+++ b/tasmota-config/configure-radiators
@@ -0,0 +1,74 @@
+#!/bin/bash
+
+# Adapted from https://tasmota.github.io/docs/Rules/#simple-thermostat-example
+
+# Button give 30 mins of hot.
+
+# Low setpoint is var1
+# High setpoint is var2
+# Override is in var3
+# we store current relay state in var4
+# and use var5 for computing delta
+
+# Timer1 is used as a WDT incase sensor fails
+#
+
+M=10.32.139.1
+
+
+set -x
+
+for T in laundry_radiator ; do #kstudy_radiator bedroom_radiator spare_bedroom_radiator; do
+ mosquitto_pub -h "${M}" -t "cmnd/${T}/Backlog" -m "Switchmode1 3; Rule1 1; Rule1 4; Rule2 1; Rule2 4; Rule3 1; Rule3 4"
+ sleep 3
+ mosquitto_pub -h "${M}" -t "cmnd/${T}/Backlog" -m "TelePeriod 60; SetOption26 0; SetOption0 0; PowerOnState 0"
+ sleep 3
+ mosquitto_pub -h "${M}" -t "cmnd/${T}/Backlog" -m "Setoption36 0; Setoption65 1; Setoption1 1; SensorRetain 1; PowerRetain 1"
+ sleep 3
+
+##
+
+ read -r -d '' R << EOF
+ ON system#boot DO Backlog RuleTimer1 70; var1 5; var2 5; var3 0; var4 0 ENDON
+ ON Rules#Timer=1 DO Backlog RuleTimer1 70; Power %var3% ENDON
+ ON tele-SI7021#temperature DO Backlog RuleTimer1 70; Event temp=%value% ENDON
+ ON Switch1#State=0 DO Backlog var3 0; RuleTimer2 0; Event temp=100 ENDON
+ ON Switch1#State=1 DO Backlog var3 1; RuleTimer2 1800; Event temp=100 ENDON
+EOF
+ R="$(echo $R)"
+
+ mosquitto_pub -h "${M}" -t "cmnd/${T}/Rule1" -m "${R}"
+ sleep 5
+
+##
+
+ read -r -d '' R << EOF
+ ON Switch2#State=0 DO Backlog var3 0; RuleTimer2 0; Event temp=100 ENDON
+ ON Switch2#State=1 DO Backlog var3 1; RuleTimer2 1800; Event temp=100 ENDON
+ ON Rules#Timer=2 DO var3 0 ENDON
+ ON Power1#State DO BackLog Var4 %value%; Publish2 stat/${T}/OPEN %value% ENDON
+ ON Event#temp DO BackLog Publish2 stat/${T}/var1 %var1%; Publish2 stat/${T}/var2 %var2% ENDON
+EOF
+ R="$(echo $R)"
+
+ mosquitto_pub -h "${M}" -t "cmnd/${T}/Rule2" -m "${R}"
+ sleep 5
+
+##
+
+ read -r -d '' R << EOF
+ ON Event#temp<%var1% DO Power1 1 ENDON
+ ON Event#temp>%var2% DO Power1 %var3% ENDON
+ ON Event#temp<5 DO Power1 1 ENDON
+ ON Event#temp DO BackLog Var5 %var1%; Sub5 %value%; Publish2 stat/${T}/DELTA %var5%; Publish2 stat/${T}/OPEN %var4% ENDON
+EOF
+ R="$(echo $R)"
+
+ mosquitto_pub -h "${M}" -t "cmnd/${T}/Rule3" -m "${R}"
+ sleep 5
+
+##
+
+ mosquitto_pub -h "${M}" -t "cmnd/${T}/Restart" -m "1"
+
+done