From 7c6887eaaf812b63bab6c5e134f80a2ef36aeb31 Mon Sep 17 00:00:00 2001 From: fishsoupisgood Date: Tue, 12 Jan 2021 16:58:31 +0000 Subject: works --- boiler-monster/mr3020/etc/stm32/startup | 5 +++++ boiler-monster/mr3020/usr/bin/thermostat | 14 +++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) (limited to 'boiler-monster') 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" -- cgit v1.2.3