summaryrefslogtreecommitdiffstats
path: root/boiler-monster
diff options
context:
space:
mode:
authorfishsoupisgood <github@madingley.org>2021-01-12 16:58:31 +0000
committerfishsoupisgood <github@madingley.org>2021-01-12 16:58:31 +0000
commit7c6887eaaf812b63bab6c5e134f80a2ef36aeb31 (patch)
tree4b4b0d371107ae1b8540ca1618cb9aa796b72616 /boiler-monster
parentf4b573fe337a436d5e2b20be4be031d77376d609 (diff)
downloadheating-7c6887eaaf812b63bab6c5e134f80a2ef36aeb31.tar.gz
heating-7c6887eaaf812b63bab6c5e134f80a2ef36aeb31.tar.bz2
heating-7c6887eaaf812b63bab6c5e134f80a2ef36aeb31.zip
works
Diffstat (limited to 'boiler-monster')
-rwxr-xr-xboiler-monster/mr3020/etc/stm32/startup5
-rwxr-xr-xboiler-monster/mr3020/usr/bin/thermostat14
2 files changed, 14 insertions, 5 deletions
diff --git a/boiler-monster/mr3020/etc/stm32/startup b/boiler-monster/mr3020/etc/stm32/startup
index 9422745..ca19e1d 100755
--- a/boiler-monster/mr3020/etc/stm32/startup
+++ b/boiler-monster/mr3020/etc/stm32/startup
@@ -3,7 +3,11 @@
logger -t stm32 "startup"
LOCK=/var/lock/LCK..ttyATH0
+LOCK2=/var/lock/LCK..ttyATH0.stm32
echo $$ > ${LOCK}.tmp
+mv -f ${LOCK}.tmp ${LOCK}
+echo $$ > ${LOCK2}.tmp
+mv -f ${LOCK2}.tmp ${LOCK2}
#killall -9 ser2net
@@ -48,3 +52,4 @@ logger -t stm32 "Booting"
stm32flash -g 0 "${PORT}"
rm -f ${LOCK}
+rm -f ${LOCK2}
diff --git a/boiler-monster/mr3020/usr/bin/thermostat b/boiler-monster/mr3020/usr/bin/thermostat
index 1689964..af99a4a 100755
--- a/boiler-monster/mr3020/usr/bin/thermostat
+++ b/boiler-monster/mr3020/usr/bin/thermostat
@@ -1,10 +1,12 @@
#!/bin/sh
-LOCK=/var/lock/LCK..ttyATH0
+LOCK=/var/lock/LCK..ttyATH0.stm32
M=10.32.139.1
WATERS=0
-MAX=70
+MAX=65
+
+OUTSIDE="$(mosquitto_sub -t tele/weather/tempc -h ${M} -W 1 -C 1 | sed -e 's/\..*$//g') "
# conventions
# POWER is power to valve coil
@@ -30,13 +32,15 @@ done
#... others where we care about the delta
-for i in kstudy_radiator bedroom_radiator spare_bedroom_radiator dd_radiator1 dd_radiator2 dd_radiator3 hall_radiator kitchen_radiator music_room_radiator; do
+for i in kstudy_radiator bedroom_radiator spare_bedroom_radiator dd_radiator1 dd_radiator2 dd_radiator3 hall_radiator kitchen_radiator music_room_radiator 2fl_stair_radiator 2fl_main_radiator; do
O="$(mosquitto_sub -t stat/$i/OPEN -h ${M} -W 1 -C 1)"
- D="$(mosquitto_sub -t stat/$i/DELTA -h ${M} -W 1 -C 1 | sed -e 's/\..*$//g') "
+ T="$(mosquitto_sub -t stat/$i/TEMPERATURE -h ${M} -W 1 -C 1 | sed -e 's/\..*$//g') "
+
+ D="$(expr $T - $OUTSIDE)"
W=0
if [ "$O" == "1" ]; then
- W=$[ $D * 3 + 40]
+ W="$( expr \( \( \( $D * 2 \) / 3 \) + 55 \) )"
fi
logger -t thermostat " $i O=$O D=$D W=$W"