Having trouble setting variable


#1

1) Give a description of the problem
There’s one variable in this piston that won’t update called “Windows”

2) What is the expected behavior?
Trying to set variables based on contact status

3) What is happening/not happening?
The windows variable will not update even though the Settable contact sensor that’s included in the statements to set variables updates just fine

**4) Post a Green Snapshot of the piston!

Here’s the statements for setting variables. They’re at the top and bottom - sorry it’s a mess.

5) Attach any logs (From ST IDE and by turning logging level to Full)
2/25/2018, 7:06:50 PM +282ms
+1ms ╔Received event [Bedroom Door].contact = open with a delay of 1073ms
+175ms ║RunTime Analysis CS > 25ms > PS > 72ms > PE > 79ms > CE
+176ms ║WARNING: Results may be unreliable because the parent app’s version (v0.3.000.20180224) is newer than the child app’s version (v0.2.102.20180116). Please consider updating both apps to the same version.
+179ms ║Runtime (45484 bytes) successfully initialized in 72ms (v0.2.102.20180116) (177ms)
+180ms ║╔Execution stage started
+196ms ║║Condition #2 evaluated false (11ms)
+197ms ║║Condition group #1 evaluated false (state did not change) (13ms)
+202ms ║║Comparison (enum) open changes_to (string) closed = false (0ms)
+204ms ║║Cancelling condition #8’s schedules…
+206ms ║║Cancelling statement #11’s schedules…
+240ms ║║Executed physical command [Upstairs Contacts].open() (31ms)
+241ms ║║Executed [Upstairs Contacts].open (32ms)
+246ms ║║Executed virtual command [Upstairs Contacts].setVariable (3ms)
+247ms ║║Condition #8 evaluated false (48ms)
+248ms ║║Cancelling condition #7’s schedules…
+249ms ║║Condition group #7 evaluated false (state changed) (50ms)
+267ms ║║Cancelling statement #17’s schedules…
+289ms ║║Executed physical command [Downstairs Contacts].open() (19ms)
+290ms ║║Executed [Downstairs Contacts].open (21ms)
+295ms ║║Executed virtual command [Downstairs Contacts].setVariable (2ms)
+296ms ║║Condition #14 evaluated false (44ms)
+297ms ║║Condition group #13 evaluated false (state did not change) (46ms)
+316ms ║║Comparison (enum) open changes_to (string) closed = false (0ms)
+319ms ║║Cancelling statement #23’s schedules…
+342ms ║║Executed physical command [Home

*Yes I know there’s the error about updating smartapp versions but if you could take a look it’d be appreciated


#2

Your logs show the bedroom door contact as the trigger.

The required trigger to set your windows variable is both window contacts changing to closed.


#3

So you’re saying in order to set the variable then both windows need to change to closed and not just one? Ok then how come the virtual contact sensor changes to the correct status? May I ask for any advice you could provide?


#4

No, only one has to change to closed, with the other already closed… but your log shows a door closing not a window???


#5

The simulated contact commands you are seeing are mainly coming from the ‘when falae’ Statements in other parts of your piston.

Your simulated living room contact doesn’t appear to be changing.


#6

Think I may just start over on this one, but one question I’ve got and think already know the answer to is should I be using is/are or change to?


#7

Finally got it but only using is/are statements. Not sure I fully understand why because I’ve been under the impression you’re supposed to use triggers in order to get pistons to work and have had pistons not work in the past by only using conditions.


#8

You still have a trigger…at the bottom of the piston. If any of the contacts change then the entire piston will run from the top down all the way to that point and it will evaluate everything along the way there.

So you are using a Trigger (you can tell by the lightning bolt next to it on the number line).

Essentially you could accomplish the same thing with one trigger and say “On evens from” and then list all the contact sensors you want to have be triggers.

You’re missing Contact sensor 5 in your list though…so you may want to verify that one does something if is the one that changes.


#9

Oh so that’s what that lightning bolt means! You said I’m missing contact 5 in my list - where at in the piston?


#10

See that’s the one thing I don’t care for with the anonymized pistons is they make it confusing to go back and look. I’ve re-checked the piston and believe all the ones needed to be there are included. There’s 4 real contact sensors and 4 virtual. I’d still appreciate your feedback though - thanks!


#11

Sorry, I misread. it’s in there. You’re all good.

And yes, the lightning bolt is the indication of the line(s) that are going to act as Triggers.

Just so you know, you can actually create a piston with no triggers and then WC will turn the Conditions into Triggers. Some people prefer to do it that way (I’m personally not one of them…but some like it better).

But for what you’re doing this works very well.


#12

Yeah I’d prefer to create most of my pistons with conditions instead of triggers. I’m not sure why - think it’s mostly because I didn’t fully understand the difference between them before. Thanks for your input. It’s always a learning experience with webCoRE.


#13

Great write-up… Very helpful.