Using Capture & Restore with T-Stat Attributes


#1

1) Give a description of the problem
I want my T-Stat to shut off the A/C when my patio door is open > 1 minute. When the door gets closed, I need the T-Stat to come back on to same settings it was set to when it went off. Using Capture & Restore for attributes seems like it should work.

2) What is the expected behavior?
See above

3) What is happening/not happening?
T-Stat goes to OFF as it should. It doesn’t turn back on as it should. Probably because of where I put the nested IF statement(??)

**4) Post a Green Snapshot of the piston

5) Attach any logs (From ST IDE and by turning logging level to Full)


#2

Can’t nest triggers. The door can not be open for 1 minute and closed at the same time. Pull that nested if statement out and set it below your first if statement.

Also you don’t need 2 with statements for your actions. You can just add the turn off to the first with action


#3

Thanks @c1arkbar… is this what you meant? But my concern here was with the syntax of “stays open” and “changes to closed”. Am I ok with these? Thanks again!
EDIT- Tried… this turned the tstat off as it should but did not turn it back on.


#5

That is what I was talking about. Do you have any logs for when this? Might find out why it’s not turning off


#6

I have ‘trace’ running and logging set to FULL. How do I capture the logs to post them… just copy/paste? I see there may be a problem with the catured data
51 PM


#7

instead of using the baked in version you might just need to set your own variables and then use those to restore from.


#8

I think I realized that I needed to change the order of operations becaise if the door was closed, it wouldn’t ever capture the tstat’s attributes. So I changed it to this, but still not working. Oh, I also thought maybe I needed to define the variables so I tried temperature as an integer and thermostatOperatingState as text.

Logs (I put some error lines in bold:

11/19/2017, 10:00:26 PM +38ms
+1ms ╔Received event [Slider Door].contact = closed with a delay of 320ms
+93ms ║RunTime Analysis CS > 13ms > PS > 45ms > PE > 36ms > CE
+229ms ║Runtime (37949 bytes) successfully initialized in 45ms (v0.2.0fe.20171109) (226ms)
+230ms ║╔Execution stage started
+235ms ║║Cancelling statement #11’s schedules…
+248ms ║║Executed virtual command [Nest Thermostat - First Floor].saveStateLocally (6ms)
+257ms ║║Comparison (enum) closed stays (string) open = false (2ms)
+259ms ║║Cancelling any timed trigger schedules for condition 10
+260ms ║║Cancelling statement #10’s schedules…
+261ms ║║Condition #10 evaluated false (10ms)
+262ms ║║Condition group #1 evaluated false (state did not change) (11ms)
+269ms ║║Comparison (enum) closed changes_to (string) closed = true (1ms)
+271ms ║║Cancelling condition #9’s schedules…
+271ms ║║Condition #9 evaluated true (7ms)
+272ms ║║Cancelling condition #6’s schedules…
+273ms ║║Condition group #6 evaluated true (state changed) (9ms)
+275ms ║║Cancelling statement #7’s schedules…
+289ms ║║Could not find a command to set attribute ‘thermostatOperatingState’ to value ‘idle’
+299ms ║║Could not find a command to set attribute ‘temperature’ to value ‘71’
+300ms ║║Executed virtual command [Nest Thermostat - First Floor].loadStateLocally (20ms)
+302ms ║╚Execution stage complete. (73ms)
+312ms ╚Event processed successfully (312ms)
11/19/2017, 10:00:19 PM +388ms
+1ms ╔Received event [Slider Door].contact = open with a delay of 155ms
+93ms ║RunTime Analysis CS > 13ms > PS > 47ms > PE > 33ms > CE
+105ms ║Runtime (37944 bytes) successfully initialized in 47ms (v0.2.0fe.20171109) (103ms)
+106ms ║╔Execution stage started
+113ms ║║Cancelling statement #11’s schedules…
+126ms ║║Executed virtual command [Nest Thermostat - First Floor].saveStateLocally (7ms)
+136ms ║║Comparison (enum) open stays (string) open = true (2ms)
+138ms ║║Adding a timed trigger schedule for condition 10
+140ms ║║Condition #10 evaluated false (11ms)
+141ms ║║Condition group #1 evaluated false (state did not change) (12ms)
+149ms ║║Comparison (enum) open changes_to (string) closed = false (1ms)
+150ms ║║Cancelling condition #9’s schedules…
+151ms ║║Condition #9 evaluated false (7ms)
+152ms ║║Cancelling condition #6’s schedules…
+153ms ║║Condition group #6 evaluated false (state changed) (9ms)
+156ms ║╚Execution stage complete. (50ms)
+157ms ║Setting up scheduled job for Sun, Nov 19 2017 @ 10:01:19 PM EST (in 59.981s)
+180ms ╚Event processed successfully (179ms)
11/19/2017, 9:57:15 PM +766ms
+1ms ╔Received event [Slider Door].contact = closed with a delay of 222ms
+93ms ║RunTime Analysis CS > 13ms > PS > 50ms > PE > 30ms > CE
+109ms ║Runtime (37949 bytes) successfully initialized in 50ms (v0.2.0fe.20171109) (107ms)
+110ms ║╔Execution stage started
+117ms ║║Cancelling statement #11’s schedules…
+130ms ║║Executed virtual command [Nest Thermostat - First Floor].saveStateLocally (6ms)
+140ms ║║Comparison (enum) closed stays (string) open = false (2ms)
+142ms ║║Cancelling any timed trigger schedules for condition 10
+143ms ║║Cancelling statement #10’s schedules…
+143ms ║║Condition #10 evaluated false (10ms)
+144ms ║║Condition group #1 evaluated false (state did not change) (12ms)
+152ms ║║Comparison (enum) closed changes_to (string) closed = true (1ms)
+154ms ║║Cancelling condition #9’s schedules…
+155ms ║║Condition #9 evaluated true (7ms)
+156ms ║║Cancelling condition #6’s schedules…
+157ms ║║Condition group #6 evaluated true (state changed) (10ms)
+159ms ║║Cancelling statement #7’s schedules…
+175ms ║║Could not find a command to set attribute ‘thermostatOperatingState’ to value 'idle’
+185ms ║║Could not find a command to set attribute ‘temperature’ to value '71’
+186ms ║║Executed virtual command [Nest Thermostat - First Floor].loadStateLocally (23ms)
+190ms ║╚Execution stage complete. (79ms)
+202ms ╚Event processed successfully (202ms)
11/19/2017, 9:57:07 PM +520ms
+1ms ╔Received event [Slider Door].contact = open with a delay of 79ms
+86ms ║RunTime Analysis CS > 13ms > PS > 46ms > PE > 27ms > CE
+98ms ║Runtime (37943 bytes) successfully initialized in 46ms (v0.2.0fe.20171109) (96ms)
+99ms ║╔Execution stage started
+106ms ║║Cancelling statement #11’s schedules…
+119ms ║║Executed virtual command [Nest Thermostat - First Floor].saveStateLocally (7ms)
+129ms ║║Comparison (enum) open stays (string) open = true (2ms)
+131ms ║║Adding a timed trigger schedule for condition 10
+134ms ║║Condition #10 evaluated false (11ms)
+135ms ║║Condition group #1 evaluated false (state did not change) (12ms)
+142ms ║║Comparison (enum) open changes_to (string) closed = false (0ms)
+144ms ║║Cancelling condition #9’s schedules…
+145ms ║║Condition #9 evaluated false (6ms)
+146ms ║║Cancelling condition #6’s schedules…
+147ms ║║Condition group #6 evaluated false (state changed) (9ms)
+149ms ║╚Execution stage complete. (51ms)
+151ms ║Setting up scheduled job for Sun, Nov 19 2017 @ 9:58:07 PM EST (in 59.982s)
+172ms ╚Event processed successfully (172ms)
11/19/2017, 9:50:51 PM +461ms
+1ms ╔Received event [Slider Door].contact = closed with a delay of 575ms
+104ms ║RunTime Analysis CS > 16ms > PS > 60ms > PE > 28ms > CE
+116ms ║Runtime (37948 bytes) successfully initialized in 60ms (v0.2.0fe.20171109) (114ms)
+117ms ║╔Execution stage started
+123ms ║║Cancelling statement #11’s schedules…
+140ms ║║Executed virtual command [Nest Thermostat - First Floor].saveStateLocally (10ms)
+151ms ║║Comparison (enum) closed stays (string) open = false (1ms)
+153ms ║║Cancelling any timed trigger schedules for condition 10
+154ms ║║Cancelling statement #10’s schedules…
+154ms ║║Cancelling condition #10’s schedules…
+155ms ║║Condition #10 evaluated false (12ms)
+156ms ║║Cancelling condition #1’s schedules…
+157ms ║║Condition group #1 evaluated false (state changed) (14ms)
+165ms ║║Comparison (enum) closed changes_to (string) closed = true (1ms)
+167ms ║║Cancelling condition #9’s schedules…
+167ms ║║Condition #9 evaluated true (7ms)
+168ms ║║Cancelling condition #6’s schedules…
+169ms ║║Condition group #6 evaluated true (state changed) (10ms)
+171ms ║║Cancelling statement #7’s schedules…
+375ms ║║Could not find a command to set attribute ‘thermostatOperatingState’ to value ‘idle’
+385ms ║║Could not find a command to set attribute ‘temperature’ to value ‘71’
+385ms ║║Executed virtual command [Nest Thermostat - First Floor].loadStateLocally (210ms)
+388ms ║╚Execution stage complete. (272ms)
+398ms ╚Event processed successfully (398ms)
11/19/2017, 9:50:31 PM +564ms
+0ms ╔Received event [Home].time = 1511146232190 with a delay of -627ms
+96ms ║RunTime Analysis CS > 15ms > PS > 51ms > PE > 30ms > CE
+111ms ║Runtime (37947 bytes) successfully initialized in 51ms (v0.2.0fe.20171109) (110ms)
+113ms ║╔Execution stage started
+124ms ║║Cancelling condition #10’s schedules…
+125ms ║║Condition #10 evaluated true (2ms)
+126ms ║║Cancelling condition #1’s schedules…
+127ms ║║Condition group #1 evaluated true (state changed) (4ms)
+131ms ║║Cancelling statement #2’s schedules…
+397ms ║║Executed physical command [Nest Thermostat - First Floor].off() (261ms)
+398ms ║║Executed [Nest Thermostat - First Floor].off (263ms)
+410ms ║║Condition #9 evaluated false (6ms)
+411ms ║║Condition group #6 evaluated false (state did not change) (9ms)
+413ms ║╚Execution stage complete. (301ms)
+424ms ╚Event processed successfully (425ms)
11/19/2017, 9:49:32 PM +63ms
+1ms ╔Received event [Slider Door].contact = open with a delay of 67ms
+83ms ║RunTime Analysis CS > 12ms > PS > 43ms > PE > 27ms > CE
+93ms ║Runtime (37945 bytes) successfully initialized in 43ms (v0.2.0fe.20171109) (91ms)
+94ms ║╔Execution stage started
+100ms ║║Cancelling statement #11’s schedules…
+115ms ║║Executed virtual command [Nest Thermostat - First Floor].saveStateLocally (7ms)
+124ms ║║Comparison (enum) open stays (string) open = true (2ms)
+126ms ║║Adding a timed trigger schedule for condition 10
+128ms ║║Condition #10 evaluated false (10ms)
+129ms ║║Condition group #1 evaluated false (state did not change) (12ms)
+137ms ║║Comparison (enum) open changes_to (string) closed = false (0ms)
+138ms ║║Condition #9 evaluated false (6ms)
+139ms ║║Condition group #6 evaluated false (state did not change) (7ms)
+141ms ║╚Execution stage complete. (47ms)
+143ms ║Setting up scheduled job for Sun, Nov 19 2017 @ 9:50:32 PM EST (in 59.985s)
+165ms ╚Event processed successfully (165ms)


#9

Is this in line with the other thread I am commenting in with this exact same issue?

Do not use the baked in capture and restore. Instead use regular variables


#10

:grinning: Your other reply is above. The problem with regular variables is that… let’s say I set it up now- I’d ask for ‘heat’ mode and 71F. But when the weather changes, so would the mode and temps needed. It wouldn’t be a valuable piston if it needed a stock set of attributes (mode and temp). But ok, if capture and restore can’t be used- what other way can I get the tstat to come back on to same mode/temp it was at when it turned off?


#11

LOL- Now I see what you mean… No, there’s MY thread, plus another on identical topic by @Mightybuffalo2000
Looks like we’re both trying to capture & restore. This is really the best way to accomplish what we are trying to do.


#12

I did it. I figured it out about an hour ago.


#13

And here’s another example


#14


#15

u5fjc: Seems like you’d want to flip lines 27 and 28… no?


#16

You are right. Here is the latest one I made for someone.


#17

This is what I was talking about. You are still setting them not making them defined.