New binding for Nest thermostats and smoke+CO detectors

593 views
Skip to first unread message

watou

unread,
Mar 5, 2015, 12:15:46 PM3/5/15
to ope...@googlegroups.com
There is a new Nest binding available, and that will be part of the future 1.7 release. For preliminary builds please see the CI server at Cloudbees (a build after #871).  The binding has been tested on openHAB 1.6.2 and most likely works with earlier openHAB releases.

All of the thermostats, smoke+CO detectors (and structures that contain them) managed under your nest.com account are accessible.

For Nest Learning Thermostats, this binding lets you see all of the information that is available via the Nest API (30 properties, including ambient temperature and relative humidity), and lets you change your home/away status, HVAC mode, target temperatures, and fan timer.

For Nest Protect smoke+CO detectors, you can monitor all 14 different properties, including smoke and CO alarm states, battery state, and overall color state (green, yellow, red, gray).

The wiki page is here.  It currently lacks example sitemaps, but I would love to see what people come up with.

watou

.

unread,
Mar 7, 2015, 2:06:03 PM3/7/15
to ope...@googlegroups.com
Watou - thanks so much for putting this together! I will begin testing with it ASAP.
.

watou

unread,
Mar 7, 2015, 9:19:44 PM3/7/15
to ope...@googlegroups.com
I am eager to have your feedback.  Thanks, watou

.

unread,
Mar 9, 2015, 2:28:04 PM3/9/15
to ope...@googlegroups.com
Hi,

I am facing some trouble getting started with this.  I grabbed the latest v1.7.0 Nest addon from CloudBee's, installed it on my v1.6.2 server, and closely followed the wiki instructions, but am experiencing the following errors repeatedly in nest.log:

2015-03-09 14:17:59.300 TRACE o.o.b.n.internal.NestBinding[:181]- Added event (item='HVAC_Temp_Scale', newState='Uninitialized') to the ignore event set
2015-03-09 14:17:59.300 ERROR o.o.b.n.internal.NestBinding[:205]- Unable to get state from data model
org.apache.commons.beanutils.NestedNullException: Null property value for 'thermostats(Great Room).humidity' on bean class 'class org.openhab.binding.nest.internal.messages.DataModelResponse'
        at org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:755)
        at org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean.java:846)
        at org.openhab.binding.nest.internal.messages.DataModel.getProperty(DataModel.java:287)
        at org.openhab.binding.nest.internal.NestBinding.getState(NestBinding.java:203)
        at org.openhab.binding.nest.internal.NestBinding.readNest(NestBinding.java:172)
        at org.openhab.binding.nest.internal.NestBinding.execute(NestBinding.java:140)
2015-03-09 14:17:59.300 TRACE o.o.b.n.internal.NestBinding[:174]- Updating itemName 'HVAC_Humidity' with newState 'Uninitialized'
2015-03-09 14:17:59.300 TRACE o.o.b.n.internal.NestBinding[:181]- Added event (item='HVAC_Humidity', newState='Uninitialized') to the ignore event set
2015-03-09 14:17:59.301 ERROR o.o.b.n.internal.NestBinding[:205]- Unable to get state from data model
org.apache.commons.beanutils.NestedNullException: Null property value for 'thermostats(Great Room).last_connection' on bean class 'class org.openhab.binding.nest.internal.messages.DataModelResponse'
        at org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:755)
        at org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean.java:846)
        at org.openhab.binding.nest.internal.messages.DataModel.getProperty(DataModel.java:287)
        at org.openhab.binding.nest.internal.NestBinding.getState(NestBinding.java:203)
        at org.openhab.binding.nest.internal.NestBinding.readNest(NestBinding.java:172)
        at org.openhab.binding.nest.internal.NestBinding.execute(NestBinding.java:140)
2015-03-09 14:17:59.301 TRACE o.o.b.n.internal.NestBinding[:174]- Updating itemName 'HVAC_LastUpdate' with newState 'Uninitialized'
2015-03-09 14:17:59.301 TRACE o.o.b.n.internal.NestBinding[:181]- Added event (item='HVAC_LastUpdate', newState='Uninitialized') to the ignore event set
2015-03-09 14:17:59.301 ERROR o.o.b.n.internal.NestBinding[:205]- Unable to get state from data model
org.apache.commons.beanutils.NestedNullException: Null property value for 'thermostats(Great Room).away_temperature_low_f' on bean class 'class org.openhab.binding.nest.internal.messages.DataModelResponse'
        at org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:755)
        at org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean.java:846)
        at org.openhab.binding.nest.internal.messages.DataModel.getProperty(DataModel.java:287)
        at org.openhab.binding.nest.internal.NestBinding.getState(NestBinding.java:203)
        at org.openhab.binding.nest.internal.NestBinding.readNest(NestBinding.java:172)
        at org.openhab.binding.nest.internal.NestBinding.execute(NestBinding.java:140)
2015-03-09 14:17:59.301 TRACE o.o.b.n.internal.NestBinding[:174]- Updating itemName 'HVAC_Away_Temp_Low' with newState 'Uninitialized'
2015-03-09 14:17:59.301 TRACE o.o.b.n.internal.NestBinding[:181]- Added event (item='HVAC_Away_Temp_Low', newState='Uninitialized') to the ignore event set
2015-03-09 14:17:59.302 TRACE o.o.b.n.internal.NestBinding[:264]- Received update (item='HVAC_Temp_Scale', state='Uninitialized')
2015-03-09 14:17:59.302 DEBUG o.o.b.n.internal.NestBinding[:288]- We received this event (item='HVAC_Temp_Scale', state='Uninitialized') from Nest, so we don't send it back again -> ignore!
2015-03-09 14:17:59.302 ERROR o.o.b.n.internal.NestBinding[:205]- Unable to get state from data model



Here are my item definitions:



/* NEST BINDING */
String HVAC_Home_Away "Home/Away [%s]" <present> { nest="=[structures(Home).away]" }
DateTime HVAC_LastUpdate "Last Connection [%1$tm/%1$td/%1$tY %1$tH:%1$tM:%1$tS]" <calendar> {nest="<[thermostats(Great Room).last_connection]"}
String HVAC_Mode "HVAC Mode" <climate> { nest="=[thermostats(Great Room).hvac_mode]" }
String HVAC_Temp_Scale "Temp Scale [%s]" { nest="<[thermostats(Great Room).temperature_scale]" }
Number HVAC_Temp "Ambient Temp [%.1f °F]" <temperature> { nest="<[thermostats(Great Room).ambient_temperature_f]" }
Number HVAC_Humidity "Humidity [%d %%]" <humidity> { nest="<[thermostats(Great Room).humidity]" }
Number HVAC_Target_Temp "Target Temp [%.1f °F]" <temperature> { nest="=[thermostats(Great Room).target_temperature_f]" }
Number HVAC_Target_Temp_Low "Min Temp [%.1f °F]" <temperature> { nest="=[thermostats(Great Room).target_temperature_low_f]" }
Number HVAC_Target_Temp_High "Max Temp [%.1f °F]" <temperature> { nest="=[thermostats(Great Room).target_temperature_high_f]" }
Number HVAC_Away_Temp_Low "Min Away Temp [%.1f °F]" <temperature> { nest="<[thermostats(Great Room).away_temperature_low_f]" }
Number HVAC_Away_Temp_High "Max Away Temp [%.1f °F]" <temperature> { nest="<[thermostats(Great Room).away_temperature_high_f]" }


I have tried the following:

  • Removed custom structure/device naming (i.e. changed 'Great Room' to 'Family Room', and updated the items to match.
  • Deleted existing client and created a new client on developer.nest.com, updated openhab.cfg Nest Binding settings to match
  • Verified it's not an auth/permissions issue, to the best of my knowledge anyway :)

Any suggestions on how to resolve?

TIA,
.

.

unread,
Mar 9, 2015, 2:49:29 PM3/9/15
to ope...@googlegroups.com
Fixed!

Problem was the thermostat name.  Even though I removed the custom labels while diagnosing, it may have not updated on the server side immediately...

Resolution was to use 'Family Room %28Great Room%29', following the "handling special characters" section in the nest binding wiki page.  Item definitions look like this:

Number HVAC_Temp "Ambient Temp [%.1f °F]" <temperature> { nest="<[thermostats(Great Room).ambient_temperature_f]" }

Now it works!  Excellent :)

All the best,
.

watou

unread,
Mar 9, 2015, 4:12:42 PM3/9/15
to ope...@googlegroups.com
Thanks for the followup.  If you have any suggestions about how to improve the wiki regarding structure and device names, please let me know.  

I think, despite issues like these, that using simple names instead long ID strings in the binding configuration strings is the better way to go, but any feedback that can avoid what you experienced would be appreciated.

Regards,
watou

James Vincent

unread,
Mar 22, 2015, 12:59:35 PM3/22/15
to ope...@googlegroups.com
Hey all, great work on this binding!

I'm getting an error when trying to hook mine up. It is pulling the current temperature back etc, but I cannot control the temperature and I'm seeing an error.

I'm unsure where I get the 'structure' name from? When I login to nest, my 'account' is called Casa Venicio, I assume this is the structure?


The error I'm seeing is below;


2015-03-22 16:52:34.144 [ERROR] [.o.b.nest.internal.NestBinding] - Unable to get
 state from data model
org.apache.commons.beanutils.NestedNullException: Null property value for 'struc
tures(Casa Venicio).away' on bean class 'class org.openhab.binding.nest.internal
.messages.DataModelResponse'
        at org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(Prop
ertyUtilsBean.java:755) ~[commons-beanutils-1.8.3.jar:1.8.3]
        at org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUt
ilsBean.java:846) ~[commons-beanutils-1.8.3.jar:1.8.3]
        at org.openhab.binding.nest.internal.messages.DataModel.getProperty(Data
Model.java:290) ~[bundlefile:na]
        at org.openhab.binding.nest.internal.NestBinding.getState(NestBinding.ja
va:203) [bundlefile:na]
        at org.openhab.binding.nest.internal.NestBinding.readNest(NestBinding.ja
va:172) [bundlefile:na]
        at org.openhab.binding.nest.internal.NestBinding.execute(NestBinding.jav
a:140) [bundlefile:na]
        at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.e
xecute(AbstractActiveBinding.java:156) [org.openhab.core_1.6.1.jar:na]
        at org.openhab.core.service.AbstractActiveService$RefreshThread.run(Abst
ractActiveService.java:173) [org.openhab.core_1.6.1.jar:na]
2015-03-22 16:52:34.145 [INFO ] [runtime.busevents             ] - hallway_humid
ity state updated to 35
2015-03-22 16:52:34.149 [INFO ] [runtime.busevents             ] - hallway_last_
connection state updated to 2015-03-22T16:37:39
2015-03-22 16:52:34.153 [INFO ] [runtime.busevents             ] - hallway_hvac_
mode state updated to heat
2015-03-22 16:52:34.154 [INFO ] [runtime.busevents             ] - home_away sta
te updated to Uninitialized
2015-03-22 16:52:34.159 [INFO ] [runtime.busevents             ] - hallway_targe
t_temperature_high_c state updated to 24.0
2015-03-22 16:52:34.160 [INFO ] [runtime.busevents             ] - hallway_away_
temperature_low_c state updated to 9.0
2015-03-22 16:52:34.165 [INFO ] [runtime.busevents             ] - hallway_ambie
nt_temperature_c state updated to 19.5
2015-03-22 16:52:34.166 [INFO ] [runtime.busevents             ] - hallway_tempe
rature_scale state updated to C


My items are as;


/* Nest binding Items */

String home_away "Home/Away [%s]" <present> { nest="=[structures(Casa Venicio).away]" }
DateTime hallway_last_connection "Last Connection [%1$td/%1$tm/%1$tY %1$tH:%1$tM:%1$tS]" <calendar> {nest="<[thermostats(Hallway).last_connection]"}


String hallway_hvac_mode "HVAC Mode" <climate> { nest="=[thermostats(Hallway).hvac_mode]" }
String hallway_temperature_scale "Temperature Scale [%s]" { nest="<[thermostats(Hallway).temperature_scale]" }
Number hallway_ambient_temperature_c "Home Temperature [%.1f °C]" <temperature> { nest="<[thermostats(Hallway).ambient_temperature_c]" }
Number hallway_humidity "Humidity [%d %%]" <humidity> { nest="<[thermostats(Hallway).humidity]" }


Number hallway_target_temperature_c "Target Temperature [%.1f °C]" <temperature> { nest="=[thermostats(Hallway).target_temperature_c]" }
Number hallway_target_temperature_low_c "Minimum Temperature [%.1f °C]" <temperature> { nest="=[thermostats(Hallway).target_temperature_low_c]" }
Number hallway_target_temperature_high_c "Maximum Temperature [%.1f °C]" <temperature> { nest="=[thermostats(Hallway).target_temperature_high_c]" }
Number hallway_away_temperature_low_c "Minimum Away Temp. [%.1f °C]" <temperature> { nest="<[thermostats(Hallway).away_temperature_low_c]" }
Number hallway_away_temperature_high_c "Maximum Away Temp. [%.1f °C]" <temperature> { nest="<[thermostats(Hallway).away_temperature_high_c]" }

/* Nest binding Items */

watou

unread,
Mar 24, 2015, 4:38:41 AM3/24/15
to ope...@googlegroups.com
I think your structure name is "Home" (and the long name is Casa Venicio). It might make sense for me to add a feature that, when enabled, logs all of the available ways to address your data.

R Smith

unread,
May 22, 2015, 4:47:48 PM5/22/15
to ope...@googlegroups.com
Am having a similar trouble too

i have the following

1. in my openhab_default.cfg

############################## Nest binding ########################################
#
# Data refresh interval in ms (optional, defaults to 60000)
# nest:refresh=60000

# the Client ID for the client you created
nest:client_id=(my id here)

# the Client Secret for the client you created
nest:client_secret=(my id here)

# the PIN code that was generated when you authorized your account to allow
# this client
nest:pin_code=(my pin code here)

2. in my items file


String HVAC_Home_Away "Home/Away [%s]" <present> { nest="=[structures(Home).away]" }
DateTime HVAC_LastUpdate "Last Connection [%1$tm/%1$td/%1$tY %1$tH:%1$tM:%1$tS]" <calendar> {nest="<[thermostats(Living Room).last_connection]"}
String HVAC_Mode "HVAC Mode" <climate> { nest="=[thermostats(Living Room).hvac_mode]" }
String HVAC_Temp_Scale "Temp Scale [%s]" { nest="<[thermostats(Living Room).temperature_scale]" }
Number HVAC_Temp "Ambient Temp [%.1f °F]" <temperature> { nest="<[thermostats(Living Room).ambient_temperature_f]" }
Number HVAC_Humidity "Humidity [%d %%]" <humidity> { nest="<[thermostats(Living Room).humidity]" }
Number HVAC_Target_Temp "Target Temp [%.1f °F]" <temperature> { nest="=[thermostats(Living Room).target_temperature_f]" }
Number HVAC_Target_Temp_Low "Min Temp [%.1f °F]" <temperature> { nest="=[thermostats(Living Room).target_temperature_low_f]" }
Number HVAC_Target_Temp_High "Max Temp [%.1f °F]" <temperature> { nest="=[thermostats(Living Room).target_temperature_high_f]" }
Number HVAC_Away_Temp_Low "Min Away Temp [%.1f °F]" <temperature> { nest="<[thermostats(Living Room).away_temperature_low_f]" }
Number HVAC_Away_Temp_High "Max Away Temp [%.1f °F]" <temperature> { nest="<[thermostats(Living Room).away_temperature_high_f]" }

(i tried replacing living room with hallway but still the same problem)

3. in my site map

Frame label="Nest" {
                Text item=HVAC_Temp label="Ambient Temp [%.1f F]"
        }

this is what i get in my log

2015-05-21 21:21:07.252 [ERROR] [.o.b.nest.internal.NestBinding] - Unable to get state from data model
org.apache.commons.beanutils.NestedNullException: Null property value for 'thermostats(Living Room).humidity' on bean class 'class org.openhab.binding.nest.internal.messages.DataModelResponse'
    at org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:755) ~[commons-beanutils-1.8.3.jar:1.8.3]
    at org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean.java:846) ~[commons-beanutils-1.8.3.jar:1.8.3]
    at org.openhab.binding.nest.internal.messages.DataModel.getProperty(DataModel.java:290) ~[bundlefile:na]
    at org.openhab.binding.nest.internal.NestBinding.getState(NestBinding.java:204) [bundlefile:na]
    at org.openhab.binding.nest.internal.NestBinding.readNest(NestBinding.java:173) [bundlefile:na]
    at org.openhab.binding.nest.internal.NestBinding.execute(NestBinding.java:141) [bundlefile:na]
    at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:156) [org.openhab.core_1.6.2.jar:na]
    at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:173) [org.openhab.core_1.6.2.jar:na]
2015-05-21 21:22:07.850 [ERROR] [.o.b.nest.internal.NestBinding] - Unable to get state from data model
org.apache.commons.beanutils.NestedNullException: Null property value for 'thermostats(Living Room).humidity' on bean class 'class org.openhab.binding.nest.internal.messages.DataModelResponse'
    at org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:755) ~[commons-beanutils-1.8.3.jar:1.8.3]
    at org.apa

my help would be appreciated.

just started with openhab and having trouble getting any binding going right now, have tried xbmc and nest and both are not able to return values.

watou

unread,
May 23, 2015, 1:49:06 AM5/23/15
to ope...@googlegroups.com
Hi, Are you 100% certain that you have properly chosen the name of your thermostat, as explained here?  You may have to either rename your thermostat at nest.com, or specify its name completely by escaping characters in it (the former approach is usually simpler).

R Smith

unread,
May 23, 2015, 8:18:54 PM5/23/15
to ope...@googlegroups.com
where would i find the name, is at the top of the screen or underneath the thermostat icon (mine reads "Hallway (Nest)"

R Smith

unread,
May 23, 2015, 9:38:49 PM5/23/15
to ope...@googlegroups.com
simplified the name by removing the label to just "Hallway", everything working now.

Thanks for the great binding.

R Smith

unread,
May 24, 2015, 8:55:58 AM5/24/15
to ope...@googlegroups.com
initially everything was working fine but after 30 minutes i am unable to change the settings on the thermostat with openhab.

2015-05-24 08:50:21.455 [WARN ] [b.n.i.messages.AbstractRequest] - Method failed: HTTP/1.1 429 Too Many Requests
2015-05-24 08:50:21.462 [ERROR] [.o.b.nest.internal.NestBinding] - Error updating data model: DataModelResponse[devices=<null>,structures=<null>]

watou

unread,
May 24, 2015, 9:08:03 AM5/24/15
to ope...@googlegroups.com
Hello,

In all my development, testing and use of the Nest binding, I have never received HTTP code 429 Too Many Requests, but the API documentation describes that this is what you will receive when you exceed the API's data rate limits.  The default nest:refresh=60000 (60,000 milliseconds equals one minute) is the recommended most frequent rate at which the binding interacts with the API.  If you set it to a lower number or make lots of calls to change the thermostat's settings, I imagine you might encounter code 429.  I did not see in the Nest documentation precisely what the hard limits are, but the binding follows the documented advice.

R Smith

unread,
May 24, 2015, 9:22:10 PM5/24/15
to ope...@googlegroups.com
waited a few hours and the problem resolved.

lolodomo

unread,
Jun 20, 2015, 4:49:05 AM6/20/15
to ope...@googlegroups.com
Hi

I am curious to know if the nest cam could be managed by this binding and what are the features available for this device through the API ?

watou

unread,
Jun 20, 2015, 8:31:55 AM6/20/15
to ope...@googlegroups.com
I checked out the API docs and there has been no published update regarding the Nest Cam yet, so the binding still only addresses the thermostats and smoke+CO detectors.  If/when information or function is added for the Nest Cams, that will be added to the binding if at all possible.  We will have to wait and see what they publish for APIs though.
Reply all
Reply to author
Forward
0 new messages