Nest Set Point Update with AppleScript

Posted on
Sun Nov 15, 2015 4:22 pm
Jpaction offline
Posts: 36
Joined: Jun 18, 2011

Nest Set Point Update with AppleScript

I am trying to update my Nest Heat Set Point using a variable and AppleScript. Everything complies fine but the update doesn't happen. Any help would be great.

--Script--
set theSetPointHeat to heat setpoint of device "Hallway Thermostat" as integer
set theHeatPoint to value of variable "TempSetPointHot" as integer

set heat setpoint of device "Hallway Thermostat" to theHeatPoint
repeat 3 times -- theHeatPoint is not equal to theSetPointHeat
set heat setpoint of device "Hallway Thermostat" to theHeatPoint
end repeat
delay 5
set theSetPointHeat to heat setpoint of device "Hallway Thermostat" as integer
set theHeatPoint to value of variable "TempSetPointHot" as integer
if theSetPointHeat = theHeatPoint then
log "The Device Heat Point Is " & theSetPointHeat & " The Variable Heat Point Is " & theHeatPoint as text
else
log "The Device Heat Point Is " & theSetPointHeat & " AND DOESN'T Equal The Variable Heat Point Which Is " & theHeatPoint as text
end if

--End Script--

Posted on
Mon Nov 16, 2015 12:15 pm
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Nest Set Point Update with AppleScript

[MODERATOR NOTE] moved to the 3rd party Nest Plugin forum.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Dec 08, 2015 5:29 am
Chameleon offline
Posts: 611
Joined: Oct 04, 2014

Re: Nest Set Point Update with AppleScript

jay (support) wrote:
[MODERATOR NOTE] moved to the 3rd party Nest Plugin forum.


Thanks Jay - I'll try to help with my impressive zero knowledge of Applescript lol :shock:

Anyway - sorry for the delay in replying it's been a busy few days.... :mrgreen:

I'd check out this post where Jay explained the use of AppleScript and Thermostats - it seemed quite good to me and gave me a starting point to explore your issue

http://forums.indigodomo.com/viewtopic.php?t=7934&f=4

I also answered a similar question for another user who was trying to do the same thing and he got it to work this way...

http://forums.indigodomo.com/viewtopic.php?f=170&t=14359#p98838

Still rather than just giving you links I had a go with my limited knowledge of AppleScript I got this to work:

Code: Select all
set currentHeatPoint to heat setpoint of device "Family Room"
set heatSet to value of variable "NESTTemp"
set heat setpoint of device "Family Room" to heatSet
set newHeatPoint to heat setpoint of device "Family Room"

if newHeatPoint * 1.0 = heatSet * 1.0 then
   log "The Device Heat Point Is " & newHeatPoint & " The Variable Heat Point Is " & heatSet as text
else
   log "The Device Heat Point Is " & newHeatPoint & " AND DOESN'T Equal The Variable Heat Point Which Is " & heatSet as text
end if


A few points:

    1. I didn't use the integer part of the command because the NEST API uses float most of the time and I suspect that isn't helping

    2. I used (variable*1.0) instead of just variable to make sure that we're comparing one float (x.x) with another

    3. The NEST Home will update the Setpoint on the next refresh of the API using this approach. That means that a delay of 5 seconds may or may not be enough for the change to occur and so the result of the condition at the end may or may not be true depending on how long it takes for the refresh to happen. That's one of the issues using the NEST API because they don't like you calling the API more than once a min. In the actual plugin I force an update so the change appears to happen a lot quicker!

However, having added this as an embedded script in my test system I can confirm that the setpoint does change with this code - just not immediately... you need some patience :D

Hope that helps

Mike

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 8 guests

cron