Created
October 26, 2014 01:04
-
-
Save anonymous/fe9d587ef5c4e8a9170c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#this script requires jsawk and a radiothermostat | |
#repace this with your radiothermostat's ip address | |
THERMOSTAT_IP=10.0.1.12 | |
arr=$(curl -s $THERMOSTAT_IP/tstat) | |
temp=$(echo $arr |jsawk 'return this.temp') | |
tmode=$(echo $arr |jsawk 'return this.tmode') | |
target_heat=$(echo $arr |jsawk 'return this.t_heat') | |
target_cool=$(echo $arr |jsawk 'return this.t_cool') | |
case "$tmode" in | |
0) mode_string="Off" | |
;; | |
1) mode_string="Heating" | |
;; | |
2) mode_string="Cooling" | |
;; | |
3) mode_string="Auto" | |
;; | |
esac | |
printf "Temperature: %s\nThermostat Mode: %s\n" "$temp" "$mode_string" | |
if [ "$target_cool" ] | |
then | |
printf "Target: %s" "$target_cool" | |
fi | |
if [ "$target_heat" ] | |
then | |
printf "Target: %s" "$target_heat" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment