ryanbuckner wrote:I wound up using the shell do command and realized that json was not installed on my Python 2.5 version.
bschollnick2 wrote:ryanbuckner wrote:I wound up using the shell do command and realized that json was not installed on my Python 2.5 version.
JSON is easy enough to enable for the python install, but you can't do it as an embedded python script. You have to do it as an external script....
ryanbuckner wrote:bschollnick2 wrote:ryanbuckner wrote:I wound up using the shell do command and realized that json was not installed on my Python 2.5 version.
JSON is easy enough to enable for the python install, but you can't do it as an embedded python script. You have to do it as an external script....
Ok. Once I get the commands working from terminal I'll creaet an external script. I understand that JSON was included with 2.6 and I have 2.5. Better to upgrade Python or find and install the JSON module? Sorry, not a python guy.
set nestDSTemp to do shell script "/usr/local/bin/nest.py --user joe@example.com --password swordfish --serial <your_serial> curtemp"
set nestDSHumid to do shell script "/usr/local/bin/nest.py --user joe@example.com --password swordfish --serial <your_serial> curhumid"
set nestUSTemp to do shell script "/usr/local/bin/nest.py --user joe@example.com --password swordfish --serial <your_seria2l> curtemp"
set nestUSHumid to do shell script "/usr/local/bin/nest.py --user joe@example.com --password swordfish --serial <your_serial2> curhumid"
tell application "IndigoServer"
set value of variable "downstairsNestTemp" to nestDSTemp
set value of variable "upstairsNestTemp" to nestUSTemp
set value of variable "upstairsNestHumid" to nestUSHumid
set value of variable "downstairsNestHumid" to nestDSHumid
end tell
Chompy wrote:Thanks for posting the script you used, Ryan. I modified it slightly to pull the temperature & humidity from my nest.
It would be nice to see someone create a plugin that reads more of the nest's states, such as whether it's in away mode or if the AC is currently running.
Next, a payload is returned with the new status:
"status": 200,
"headers": {
"X-nl-skv-key": "shared.#DEVICE 2 SERIAL NUMBER#",
"X-nl-skv-version": 1689916148,
"X-nl-skv-timestamp": 1326038378000,
"X-nl-service-timestamp": 1326038379151
},
"payload": {
"hvac_fan_state": false,
"name": "TWO",
"hvac_heat_x2_state": false,
"hvac_ac_state": false,
"can_cool": true,
"auto_away": 0,
"compressor_lockout_enabled": false,
"target_temperature_low": 16.66667,
"current_temperature": 19.53,
"target_temperature_high": 26.66667,
"compressor_lockout_timeout": 0,
"target_change_pending": false,
"hvac_aux_heater_state": false,
"target_temperature": 20.55556,
"can_heat": true,
"target_temperature_type": "heat",
"hvac_heater_state": true
}
Here, the hvac_heater_state is set to true. The furnace is on.
A little while later, that value is set to false.
elif (cmd == "coolstate"):
print n.status["shared"][n.serial]["hvac_ac_state"]
elif (cmd == "heatstate"):
print n.status["shared"][n.serial]["hvac_heater_state"]
elif (cmd == "fanstate"):
print n.status["shared"][n.serial]["hvac_fan_state"]
set nestTemp to do shell script "/usr/local/bin/nest.py --user NESTLOGIN --password NESTPASSWORD curtemp"
set nestHumid to do shell script "/usr/local/bin/nest.py --user NESTLOGIN --password NESTPASSWORD curhumid"
set nestCooling to do shell script "/usr/local/bin/nest.py --user NESTLOGIN --password NESTPASSWORD coolstate"
set nestHeating to do shell script "/usr/local/bin/nest.py --user NESTLOGIN --password NESTPASSWORD heatstate"
set nestFan to do shell script "/usr/local/bin/nest.py --user NESTLOGIN --password NESTPASSWORD fanstate"
set nestTargetTemp to do shell script "/usr/local/bin/nest.py --user NESTLOGIN --password NESTPASSWORD targettemp"
set nestLeaf to do shell script "/usr/local/bin/nest.py --user NESTLOGIN --password NESTPASSWORD leaf"
if nestCooling is "False" then set nestCooling to "false"
if nestCooling is "True" then set nestCooling to "true"
if nestHeating is "False" then set nestHeating to "false"
if nestHeating is "True" then set nestHeating to "true"
if nestFan is "False" then set nestFan to "false"
if nestFan is "True" then set nestFan to "true"
if nestLeaf is "False" then set nestLeaf to "false"
if nestLeaf is "True" then set nestLeaf to "true"
set nestTargetTemp to (round nestTargetTemp rounding as taught in school)
tell application "IndigoServer"
set value of variable "nestTemp" to nestTemp
set value of variable "nestHumid" to nestHumid
set value of variable "nestCooling" to nestCooling
set value of variable "nestHeating" to nestHeating
set value of variable "nestFan" to nestFan
set value of variable "nestTargetTemp" to nestTargetTemp
set value of variable "nestLeaf" to nestLeaf
end tell
Users browsing this forum: No registered users and 8 guests