Skip to content

Instantly share code, notes, and snippets.

Created October 26, 2014 01:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/fe9d587ef5c4e8a9170c to your computer and use it in GitHub Desktop.
Save anonymous/fe9d587ef5c4e8a9170c to your computer and use it in GitHub Desktop.
#!/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