summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames <31272717+gpd-pocket-hacker@users.noreply.github.com>2021-01-25 16:28:27 +0000
committerJames <31272717+gpd-pocket-hacker@users.noreply.github.com>2021-01-25 16:28:27 +0000
commit1f91e592c0b97dc315335417f323d31ca028782a (patch)
treebcc75672b51259dda367ae93b667a83b33adcf5d
parent74b8348ac8e37ef4ca5d98f4f782c382401f96d7 (diff)
downloadheating-1f91e592c0b97dc315335417f323d31ca028782a.zip
heating-1f91e592c0b97dc315335417f323d31ca028782a.tar.gz
heating-1f91e592c0b97dc315335417f323d31ca028782a.tar.bz2
fish
-rw-r--r--boiler-monster/mr3020/Makefile2
-rw-r--r--boiler-monster/mr3020/etc/crontabs/root1
-rw-r--r--boiler-monster/mr3020/etc/msmtprc30
-rw-r--r--boiler-monster/mr3020/etc/panaceas-ca.crt32
-rwxr-xr-xboiler-monster/mr3020/usr/bin/thermostat2
l---------boiler-monster/mr3020/usr/sbin/sendmail1
-rw-r--r--humidity_sensors/DOC/The_IAPWS_Formulation_1995_for_the_Thermodynamic_Properties_of_Ordinary_Water_Substance_for_General_and_Scientific_Use.pdfbin0 -> 2566836 bytes
-rw-r--r--piano-alarm/mt300-v2/Makefile4
-rwxr-xr-xpiano-alarm/mt300-v2/usr/bin/piano_alarm50
-rwxr-xr-xpiano-alarm/mt300-v2/usr/bin/sensor.pl74
l---------piano-alarm/mt300-v2/usr/sbin/sendmail1
-rwxr-xr-xtasmota-config/configure-radiators2
12 files changed, 187 insertions, 12 deletions
diff --git a/boiler-monster/mr3020/Makefile b/boiler-monster/mr3020/Makefile
index 26efbc3..d249c6b 100644
--- a/boiler-monster/mr3020/Makefile
+++ b/boiler-monster/mr3020/Makefile
@@ -1,4 +1,4 @@
-STUFF=$(shell find etc usr \! -type d -print)
+STUFF=$(shell find etc usr \! -type d -a \! -type l -print)
stamp: ${STUFF}
tar cf - ${STUFF} | ssh boiler-monster "cd / && tar xvpf -"
diff --git a/boiler-monster/mr3020/etc/crontabs/root b/boiler-monster/mr3020/etc/crontabs/root
new file mode 100644
index 0000000..5548b76
--- /dev/null
+++ b/boiler-monster/mr3020/etc/crontabs/root
@@ -0,0 +1 @@
+* * * * * /usr/bin/thermostat
diff --git a/boiler-monster/mr3020/etc/msmtprc b/boiler-monster/mr3020/etc/msmtprc
new file mode 100644
index 0000000..fed8874
--- /dev/null
+++ b/boiler-monster/mr3020/etc/msmtprc
@@ -0,0 +1,30 @@
+# Example for a system wide configuration file
+
+# A system wide configuration file is optional.
+# If it exists, it usually defines a default account.
+# This allows msmtp to be used like /usr/sbin/sendmail.
+account default
+
+# The SMTP smarthost.
+host smtp.panaceas.org
+from boiler-monster@ourano.org
+
+# Construct envelope-from addresses of the form "user@oursite.example".
+#auto_from on
+#maildomain fish
+
+# Use TLS.
+#tls on
+
+# Syslog logging with facility LOG_MAIL instead of the default LOG_USER.
+syslog LOG_MAIL
+
+auth on
+user boiler-monster
+password Inor1Fie
+
+tls on
+tls_starttls off
+#tls_certcheck off
+
+tls_trust_file /etc/panaceas-ca.crt
diff --git a/boiler-monster/mr3020/etc/panaceas-ca.crt b/boiler-monster/mr3020/etc/panaceas-ca.crt
new file mode 100644
index 0000000..d4d33ed
--- /dev/null
+++ b/boiler-monster/mr3020/etc/panaceas-ca.crt
@@ -0,0 +1,32 @@
+-----BEGIN CERTIFICATE-----
+MIIFgjCCA2qgAwIBAgIJALpKS9TB9wWiMA0GCSqGSIb3DQEBBQUAMDQxGDAWBgNV
+BAoTD3BhbmFjZWFzLm9yZyBDQTEYMBYGA1UEAxMPY2EucGFuYWNlYXMub3JnMB4X
+DTE0MDMyOTA5MDE1OFoXDTI0MDMyNjA5MDE1OFowNDEYMBYGA1UEChMPcGFuYWNl
+YXMub3JnIENBMRgwFgYDVQQDEw9jYS5wYW5hY2Vhcy5vcmcwggIiMA0GCSqGSIb3
+DQEBAQUAA4ICDwAwggIKAoICAQC8poSmhM9TKrFn1n3vaVgjt5z8l+nJ7SwBOeBJ
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fGD1HOaZlogJ5Viqz7wGKAn51sIVt9oWf01SNcuBciX3W7UsDvcNXCUQc74X9uV
+aZjsGlTrCg29Ocssnlq4hZD3J1KsB6bXuPmhdrgNeXc+k8NJHGWju4AwWGvBGJfL
+99TwkSTkIrNCfVSvAKTQ5OiERTqXzGxDKXQpAxQqpfaF73nxtS9fSmcKk/UbyhGd
+BaGdqX6LXxXIwqEDEi19d2wtVjuOnRz1wGK9NaWFPj+7ndyRdYaja2eO5VPO5sVl
+Tk6ROZNyzouupDZKd23XB0gcNEv5YHbD7PqUkN8ModdAWiQpkxcYVzwyV/qHJnNM
+NowhxhJDP0ZJ4svN1LkXYCfd+StqhwplJ/4eIdklku6Gwc6VCcFTC1yLyS2adUwi
+aTX19aEYzavXdUtRpC8U4QQ/UWL+r9QtDmNJXOxeM8R1oGbuT3bnH1UYs9fJ6/t8
+DVY3sXog5PyxWQiQqC6Pn6VRSUei5WPsuGuzre0W2Jl0emtv2Ojyhb5/ynP7psH9
+4vIbkKZEEvnsV8l7ZF+1DuWJP/fAfw==
+-----END CERTIFICATE-----
diff --git a/boiler-monster/mr3020/usr/bin/thermostat b/boiler-monster/mr3020/usr/bin/thermostat
index 9b56d44..91e2e7b 100755
--- a/boiler-monster/mr3020/usr/bin/thermostat
+++ b/boiler-monster/mr3020/usr/bin/thermostat
@@ -8,6 +8,8 @@ MAX=65
OUTSIDE="$(mosquitto_sub -t tele/weather/tempc -h ${M} -W 1 -C 1 | sed -e 's/\..*$//g') "
+logger -t thermostat " outside is $OUTSIDE"
+
# conventions
# POWER is power to valve coil
# OPEN is valve state
diff --git a/boiler-monster/mr3020/usr/sbin/sendmail b/boiler-monster/mr3020/usr/sbin/sendmail
new file mode 120000
index 0000000..071af7e
--- /dev/null
+++ b/boiler-monster/mr3020/usr/sbin/sendmail
@@ -0,0 +1 @@
+../bin/msmtp \ No newline at end of file
diff --git a/humidity_sensors/DOC/The_IAPWS_Formulation_1995_for_the_Thermodynamic_Properties_of_Ordinary_Water_Substance_for_General_and_Scientific_Use.pdf b/humidity_sensors/DOC/The_IAPWS_Formulation_1995_for_the_Thermodynamic_Properties_of_Ordinary_Water_Substance_for_General_and_Scientific_Use.pdf
new file mode 100644
index 0000000..bb10d96
--- /dev/null
+++ b/humidity_sensors/DOC/The_IAPWS_Formulation_1995_for_the_Thermodynamic_Properties_of_Ordinary_Water_Substance_for_General_and_Scientific_Use.pdf
Binary files differ
diff --git a/piano-alarm/mt300-v2/Makefile b/piano-alarm/mt300-v2/Makefile
index c86bede..625ed08 100644
--- a/piano-alarm/mt300-v2/Makefile
+++ b/piano-alarm/mt300-v2/Makefile
@@ -1,7 +1,7 @@
-STUFF=$(shell find etc usr \! -type d -print)
+STUFF=$(shell find etc usr \! -type d -a \! -type l -print)
stamp: ${STUFF}
- tar cf - ${STUFF} | ssh boiler-monster "cd / && tar xvpf -"
+ tar cf - ${STUFF} usr/sbin/sendmail | ssh piano-alarm "cd / && tar xvpf -"
touch $@
tidy:
diff --git a/piano-alarm/mt300-v2/usr/bin/piano_alarm b/piano-alarm/mt300-v2/usr/bin/piano_alarm
index de5677c..b82f147 100755
--- a/piano-alarm/mt300-v2/usr/bin/piano_alarm
+++ b/piano-alarm/mt300-v2/usr/bin/piano_alarm
@@ -9,47 +9,85 @@ echo -e "Subject: 41hpa piano alarm: ${STATE} \n\nPiano alarm at 41hpa says ${ST
TL=17000
TH=22000
-HL=450
+HL=400
HH=700
T=`sensor.pl -t -i`
H=`sensor.pl -h -i`
-
-exit 0
+TANK="$(mosquitto_sub -h 10.32.136.1 -p 1883 -t stat/music_room_humidifier/var3 -W 1 -C 1 )"
BAD=0
+M=""
+
if [ -z "$T" ]; then
+ if [ ! -z "$M" ]; then
+ M="${M}, "
+ fi
+ M="${M}failed to read temperature"
BAD=1
fi
+
if [ -z "$H" ]; then
+ if [ ! -z "$M" ]; then
+ M="${M}, "
+ fi
+ M="${M}failed to read humidity"
BAD=1
fi
if [ "$T" -lt "$TL" ]; then
+ if [ ! -z "$M" ]; then
+ M="${M}, "
+ fi
+ M="${M}temperature too low $T<$TL"
BAD=1
fi
if [ "$T" -gt "$TH" ]; then
+ if [ ! -z "$M" ]; then
+ M="${M}, "
+ fi
+ M="${M}temperature too high $T>$TH"
BAD=1
fi
if [ "$H" -lt "$HL" ]; then
+ if [ ! -z "$M" ]; then
+ M="${M}, "
+ fi
+ M="${M}air too dry $H<$HL"
BAD=1
fi
if [ "$H" -gt "$HH" ]; then
+ if [ ! -z "$M" ]; then
+ M="${M}, "
+ fi
+ M="${M}air too wet $H>$HH"
BAD=1
fi
if [ "$1" == "test" ]; then
+ if [ ! -z "$M" ]; then
+ M="${M}, "
+ fi
+ M="${M}test"
+ BAD=1
+fi
+
+if [ $TANK -eq 0 ]; then
+ if [ ! -z "$M" ]; then
+ M="${M}, "
+ fi
+ M="${M}humidifier tank is empty"
BAD=1
fi
if [ "$BAD" -eq 1 ]; then
- message "T=$T (should be $TL-$TH) H=$H (should be $HL-$HH)"
+ message "$M"
fi
-echo "piano_alarm T=$T H=$H"
-logger "piano_alarm T=$T H=$H"
+echo "piano_alarm T=$T H=$H TANK=$TANK M=$M"
+logger "piano_alarm T=$T H=$H TANK=$TANK M=$M"
diff --git a/piano-alarm/mt300-v2/usr/bin/sensor.pl b/piano-alarm/mt300-v2/usr/bin/sensor.pl
index 9a5501d..6004db8 100755
--- a/piano-alarm/mt300-v2/usr/bin/sensor.pl
+++ b/piano-alarm/mt300-v2/usr/bin/sensor.pl
@@ -22,11 +22,78 @@ sub get_line($) {
}
}
+
+#from W. Wagner and A. Pruß:" The IAPWS Formulation 1995 for the Thermodynamic Properties of Ordinary Water Substance for General and Scientific Use ", Journal of Physical and Chemical Reference Data, June 2002 ,Volume 31, Issue 2, pp. 387535
+sub pws($) {
+ my $t = shift;
+ my $tc = 647.096; # critical T in K
+ my $pc = 22064000; # critical P in Pa;
+ my @c = (
+ -7.85951783, 1.84408259, -11.7866497, 22.6807411,
+ -15.9618719, 1.80122502
+ );
+
+ $t += 273.15; #into K
+
+ my $v = 1. - ( $t / $tc );
+
+ my $pn = $c[0] * $v;
+ $pn += $c[1] * ( $v**1.5 );
+ $pn += $c[2] * ( $v**3 );
+ $pn += $c[3] * ( $v**3.5 );
+ $pn += $c[4] * ( $v**4 );
+ $pn += $c[5] * ( $v**7.5 );
+
+ $pn *= $tc / $t;
+
+ return $pc * exp($pn);
+}
+
+sub rh_to_pw($$) {
+ my ( $t, $h ) = @_;
+
+ return pws($t) * ( $h / 100. );
+}
+
+sub pw_to_rh($$) {
+ my ( $t, $pw ) = @_;
+
+ return ( $pw / pws($t) ) * 100.;
+}
+
+sub rh_to_ah($$) {
+ my ( $t, $h ) = @_;
+ my $c = 0.00216679; #kg K /J
+
+ return $c * rh_to_pw( $t, $h ) / ( $t + 273.15 );
+}
+
+sub ah_to_rh($$) {
+ my ( $t, $ah ) = @_;
+ my $c = 0.00216679; #kg K /J
+
+ return pw_to_rh( $t, $ah * ( $t + 273.15 ) / $c );
+}
+
+sub fixup($$) {
+ my ( $t, $h ) = @_;
+
+ my $ah = rh_to_ah( $t, $h );
+
+ my $ct = $t - 1.15;
+
+ my $ch = ah_to_rh( $ct, $ah );
+
+# print "($t,$h) => ($ct,$ch)\n";
+
+ return ( $ct, $ch );
+}
+
sub display($$$$$$) {
my ( $t, $h, $show_t, $show_h, $int, $mrtg ) = @_;
if ( $int or $mrtg ) {
- $t = int( $t * 100 );
+ $t = int( $t * 1000 );
$h = int( $h * 10 );
}
@@ -84,9 +151,12 @@ for ( my $tries = 0 ; $tries < 4 ; ++$tries ) {
if ( $line =~ /\$SNTHD,([-.0-9]+),([-.0-9]+)/ ) {
- display( $1, $2, $temp, $humid, $int, $mrtg );
+ my ( $t, $h ) = fixup( $1, $2 );
+
+ display( $t, $h, $temp, $humid, $int, $mrtg );
exit 0;
}
+ sleep(int(rand(4)));
}
exit 1;
diff --git a/piano-alarm/mt300-v2/usr/sbin/sendmail b/piano-alarm/mt300-v2/usr/sbin/sendmail
new file mode 120000
index 0000000..071af7e
--- /dev/null
+++ b/piano-alarm/mt300-v2/usr/sbin/sendmail
@@ -0,0 +1 @@
+../bin/msmtp \ No newline at end of file
diff --git a/tasmota-config/configure-radiators b/tasmota-config/configure-radiators
index 6799acd..b8e15a4 100755
--- a/tasmota-config/configure-radiators
+++ b/tasmota-config/configure-radiators
@@ -18,7 +18,7 @@ M=10.32.139.1
set -x
-for T in laundry_radiator kstudy_radiator bedroom_radiator spare_bedroom_radiator; do
+for T in laundry_radiator kstudy_radiator bedroom_radiator spare_bedroom_radiator music_room_e_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"