Bill,
This is the plugin as I have it so far. To configure it you need to put the thermostat Nest ID in the Id field of the device. You also need to have the projectID, clientID, clientSecret and refreshToken defined in he collection settings. When HR starts it gets the accessToken from the refreshToken and puts it in a variable.
I use some resources for colors which I do not know how to export:
AccentBrush8, color {ThemeResource AccentColor}, opacity 0,8
AccentBrush8_heat, color #FFF78D20, opacity 0,8
AccentBrush8_eco, color #FF00B050, opacity 0,8
Right now everything works but it is very very slow, unfortunately.
In addition, not only the token is valid for only 1 hour, but, as you mentioned, there is a limit of calls you can make per minute. So I defined a PollingInterval = 30000 which should be ok if the first call defines all the HR data. Whenever you make a change in HR, I update HR fields and the problem is how to handle the Setpoint temperature.
It is very interesting that Nest has several Setpoints: for heat, cool, and eco, as well as when the thermostat is off, to prevent the house going to cold… That is quite hard to handle because all these temperatures are not defined (I made some attributes for the Eco setpoint and temperature), but the problem is if the thermostat is in Eco mode or Off, when you Get the parameters the heating Setpoint is not defined! So I tried to define a special field to update very fast the HR field by using the stored old Setpoint if defined, but I did not succeed. So I just wait until the onPoll does its job. I also thought about calling the onPoll after the onChangeRequest to force the update…
If you have some suggestions, and even examples I could learn from, especially about how to handle the PollingInterval, the onPoll and the refresh token I would really appreciate it. In addition if you have some suggestions about speeding up the loading proces…
Thank you so much!
GoogleNestThermostat.plugin (7.1 KB)
ThermostatDetails_Nest.xaml (18.1 KB)
ThermostatTile_Nest.xaml (10.2 KB)