Home‎ > ‎News‎ > ‎

Outdoor temp added

posted 28 Jan 2013, 13:35 by Jan Larsson   [ updated 29 Jan 2013, 06:47 ]
The outdoor temp is now in the system and being graphed. I also write the temp to a file that Switch King kan read as an external source and present in its app. Worked like a charm when the temp was below zero. When my 1-wire network presented positive numbers no + sign was written in the log and Switch King did not understand this... hmmm SMOP sloved it. (Small matter of programing)

#!/bin/bash
#write to file for SwitchKing, add + if positive temp.
if [ ${Temp_ute:0:1} == "-" ]; then
        # Negative temp with minus sign already
        echo $Temp_ute > /var/www/temp_ute.log
else
        # positive temp without + sign  that we now add.
        pos_temp_ute="+"$Temp_ute
        echo $pos_temp_ute > /var/www/temp_ute.log
fi
Comments