climate.sh now publishes temperature and humidity to dedicated topics
authortelegnom <max@chaos.expert>
Fri, 5 Aug 2016 10:15:48 +0000 (12:15 +0200)
committertelegnom <max@chaos.expert>
Fri, 5 Aug 2016 10:15:48 +0000 (12:15 +0200)
climate.sh

index bf4cb89..99852e2 100755 (executable)
@@ -4,4 +4,9 @@ humitempfile="/dev/shm/humitemp.log"
 
 humitemp="$(head -n 1 $humitempfile)"
 
-mosquitto_pub -h strom.ccc-ffm.de --psk 4a4e1c01e4a2641b3905272685b20d99 --psk-identity hq -t /hq/climate/lounge -m "$humitemp" -u hq -P hq
+humidity="$(awk '{ print $2 }' <<< "$humitemp")"
+temperature="$(awk '{ print $3 }' <<< "$humitemp")"
+timestamp="$(date +'%s')"
+
+mosquitto_pub -h strom.ccc-ffm.de --psk 4a4e1c01e4a2641b3905272685b20d99 --psk-identity hq -t /hq/climate/lounge/temperature -m "$timestamp;$temperature" -u hq -P hq -r
+mosquitto_pub -h strom.ccc-ffm.de --psk 4a4e1c01e4a2641b3905272685b20d99 --psk-identity hq -t /hq/climate/lounge/humidity -m "$timestamp;$humidity" -u hq -P hq -r