summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xboiler-monster/mr3020/usr/bin/thermostat29
-rwxr-xr-xheating-cgi/boiler_rx11
2 files changed, 38 insertions, 2 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
diff --git a/heating-cgi/boiler_rx b/heating-cgi/boiler_rx
index 777b3ee..f794e1b 100755
--- a/heating-cgi/boiler_rx
+++ b/heating-cgi/boiler_rx
@@ -35,10 +35,19 @@ while (1) {
my $nodata = 0;
while ( ( not $telnet->eof ) and ( $nodata < $timeout ) ) {
- my $line = $telnet->getline( Timeout => 1, Errmode => 'return' );
+ my $line = undef;
+ eval {
+ local $SIG{ALRM} = sub { die 'Timed Out'; };
+ alarm 2;
+
+ $line = $telnet->getline( Timeout => 1, Errmode => 'return' );
+ alarm 0;
+ };
+ alarm 0;
if ( not defined $line or ( length($line) == 0 ) ) {
$nodata++;
+ next;
}
else {
$nodata = 0;