Triggering Nest at night -- will this work?


#1

1) Give a description of the problem

I wrote these pistons, I think they are good but it’s a little hard to track with the Nest app. Hoping someone can confirm the code looks okay.

2) What is the expected behaviour?

Certain summer nights are extra hot and our upstairs bedroom gets really hot overnight. I wanted a way to “jog” Nest into running AC periodically throughout the night, only when we need it. So the idea is when the global variable “hotNight” is True (this is triggered by the 1st piston, initiated by the user via Apple Shortcuts), then in the 2nd piston SmartThings will turn my Nest Thermostat mode to cooling/AC and set the temp to 2 degrees lower than the current temp in order to make sure it actively cools overnight. It will get triggered like this at midnight, 2am, and 4 am. Then at 5am the global variable will reset, so this behavior won’t happen again until a user runs the 1st piston again.

3) What is happening/not happening?

It seems to be working according to the logs, I think, but I am not that familiar with expressions and not sure if I have that portion of the code correct. It’s also hard to tell in the Nest app if and when and how long it actually cooled overnight.

4) Post a Green Snapshot of the pistonimage

5) Attach logs after turning logging level to Full

|ms|╔Received event [Home].time = 1563613200000 with a delay of -829ms|
| --- | --- |
|+158ms|║Runtime (40186 bytes) successfully initialized in 105ms (v0.3.10c.20190522) (156ms)|
|+159ms|║╔Execution stage started|
|+220ms|║║Executed [Nest Thermostat - Hallway].cool (3ms)|
|+582ms|║║Executed [Nest Thermostat - Hallway].setCoolingSetpoint (351ms)|
|+586ms|║╚Execution stage complete. (426ms)|
|+588ms|║Setting up scheduled job for Sun, Jul 21 2019 @ 12:00:00 AM CDT (in 72000.241s), with 2 more jobs pending|
|+596ms|╚Event processed successfully (596ms)|
|7/20/2019, 1:59:59 AM +618ms|
|+1ms|╔Received event [Home].time = 1563606000000 with a delay of -382ms|
|+389ms|║Runtime (40188 bytes) successfully initialized in 124ms (v0.3.10c.20190522) (386ms)|
|+390ms|║╔Execution stage started|
|+476ms|║║Executed [Nest Thermostat - Hallway].cool (4ms)|
|+1276ms|║║Executed [Nest Thermostat - Hallway].setCoolingSetpoint (789ms)|
|+1489ms|║╚Execution stage complete. (1099ms)|
|+1491ms|║Setting up scheduled job for Sat, Jul 20 2019 @ 4:00:00 AM CDT (in 7198.892s), with 2 more jobs pending|
|+1499ms|╚Event processed successfully (1499ms)|
|7/19/2019, 11:59:59 PM +279ms|
|+1ms|╔Received event [Home].time = 1563598800000 with a delay of -721ms|
|+158ms|║Runtime (40179 bytes) successfully initialized in 97ms (v0.3.10c.20190522) (155ms)|
|+159ms|║╔Execution stage started|
|+200ms|║║Executed [Nest Thermostat - Hallway].cool (4ms)|
|+664ms|║║Executed [Nest Thermostat - Hallway].setCoolingSetpoint (450ms)|
|+670ms|║╚Execution stage complete. (512ms)|
|+672ms|║Setting up scheduled job for Sat, Jul 20 2019 @ 2:00:00 AM CDT (in 7200.05s), with 2 more jobs pending|
|+681ms|╚Event processed successfully (681ms)|

#2

With your current wording, the log is not super helpful… but you could always add your own custom “Log to console” commands to help verify how well it is working.

Maybe something like this:


Here is a closeup of line 37:

temp


#3

Just an FYI on Nest. No one knows at this point what Nest integration will exist with ST when the Works with Nest API ceases on August 31, 2019. :frowning:


#4

Thanks, this is very helpful.


#5

Yeah, I heard that, I’m not happy about it either! :rage:

Thanks for the reminder though, I didn’t know it was coming so soon.