diff options
Diffstat (limited to 'boiler-monster/mr3020')
-rwxr-xr-x | boiler-monster/mr3020/usr/bin/thermostat | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/boiler-monster/mr3020/usr/bin/thermostat b/boiler-monster/mr3020/usr/bin/thermostat index 91e2e7b..8fcc071 100755 --- a/boiler-monster/mr3020/usr/bin/thermostat +++ b/boiler-monster/mr3020/usr/bin/thermostat @@ -20,8 +20,20 @@ logger -t thermostat " outside is $OUTSIDE" # towel radiators +FUZZY=0 + for i in laundry_radiator bathroom_radiator; do O="$(mosquitto_sub -t stat/$i/OPEN -h ${M} -W 1 -C 1)" + P="$(mosquitto_sub -t stat/$i/POWER -h ${M} -W 1 -C 1)" + + if [ "$P" == "OFF" -a "$O" == "1" ]; then + FUZZY=1 + O=0 + fi + + if [ "$P" == "ON" -a "$O" == "0" ]; then + FUZZY=1 + fi W=0 if [ "$O" == "1" ]; then @@ -36,6 +48,18 @@ done 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)" + P="$(mosquitto_sub -t stat/$i/POWER -h ${M} -W 1 -C 1)" + + if [ "$P" == "OFF" -a "$O" == "1" ]; then + FUZZY=1 + O=0 + fi + + if [ "$P" == "ON" -a "$O" == "0" ]; then + FUZZY=1 + fi + + T="$(mosquitto_sub -t stat/$i/TEMPERATURE -h ${M} -W 1 -C 1 | sed -e 's/\..*$//g') " D="$(expr $T - $OUTSIDE)" @@ -63,7 +87,10 @@ if [ $R -gt $MAX ]; then R=$MAX fi - +if [ "$FUZZY" -eq 1 ]; then + logger -t thermostat "Fuzzy=1, stopping pump" + R=0 +fi if [ ! -f "${LOCK}" ]; then |