Trying to close curtains with a boolean variable


#1

1) Give a description of the problem
This one is really bugging me.
opening the curtains in the morning works fine.
Around sunset, i have a Wait random that countdowns fine, and instead of a close command, sets a boolean variable to true, then i have a check IF window is closed, and variable IS true, close the curtains.
I’ve tried IF variable BECOMES TRUE/IS TRUE/STAYS TRUE and window is closed, then close the curtains, but nothing.
Is it true that you can’t trigger an action on a variable becoming true?

If this is true, can anyone suggest a random wait, check if a window contact is closed THEN perform a close of curtains.

2) What is the expected behavior?
(PUT YOUR INFO HERE)

3) What is happening/not happening?
Curtains aren’t closing! ever! random wait occurs, Boolean changes to true, but nothing is triggering the curtains like it should.

**4) Post a Green Snapshot of the piston![image|45x37]

**5) Attach any logs (From [ST IDE](https://graph-na02-16/11/2018, 16:35:58 +168ms
+1ms ╔Received event [Home].time = 1542382559456 with a delay of -1289ms
+196ms ║Runtime (46930 bytes) successfully initialized in 76ms (v0.3.108.20180906) (194ms)
+198ms ║╔Execution stage started
+259ms ║║Executed virtual command [D Drapes].setVariable (4ms)
+266ms ║╚Execution stage complete. (69ms)
+269ms ║Setting up scheduled job for Sat, Nov 17 2018 @ 8:00:00 AM CET (in 55441.564s), with 1 more job pending
+278ms ╚Event processed successfully (278ms)
16/11/2018, 16:22:59 +177ms
+0ms ╔Received event [Home].time = 1542381780000 with a delay of -824ms
+179ms ║Runtime (46929 bytes) successfully initialized in 78ms (v0.3.108.20180906) (178ms)
+180ms ║╔Execution stage started
+277ms ║║Executed virtual command [D Drapes].wait (1ms)
+279ms ║║Requesting a wake up for Fri, Nov 16 2018 @ 4:35:59 PM CET (in 780.0s)
+286ms ║╚Execution stage complete. (106ms)
+289ms ║Setting up scheduled job for Fri, Nov 16 2018 @ 4:35:59 PM CET (in 779.991s), with 2 more jobs pending
+296ms ╚Event processed successfully (296ms)


#2

You only have two triggers, the variable and Dimmer 8 changing. So, you need to change some of your conditions to triggers. The lightning bolt on the left of the frame will show you where each of the triggers is for your piston.


#3

Hey @Ryan780 all the blocks work except the first block, and it has a lightening bolt next to IF variable is true.
I also tried IF variable changes to true, I still get a lightening bolt. But no action happens.

2nd block All the other blocks are fine, if Dimmer 8 changes set piston state
3rd block, at 0800 open Dimmer 8 (if contact is Closed)
4th block, 30 minutes before sunset using Dimmer 8 wait randomly, set variable to true.

But it’s the first block, when variable is true, or becomes true, close Dimmer 8 (if contact is Closed). And it has a lightening bolt! Do I need another lightening bolt?

I just need to check the window is Closed, before I activate Dimmer 8, hence the variable.


#4

Why do you need a variable to check if the window is closed? How are you setting that variable? With a contact sensor? Why not just use that?

Rather than trying to debug your piston which, quite honestly, I cannot follow, why don’t you tell me in words what you are trying to accomplish. Like I want the curtains to close when…


#5

Sure thing @Ryan780, Basically i would like the curtains to close IF the window/contact sensor is closed.
That’s why i put the variable in there after the random countdown, IF variable becomes true, and window/contact sensor is closed, then close the curtains.

If i did the random countdown ON the window/contact sensor, and the window opened or closed, the random countdown would stop no?

Anyway something REALLY curious, and i think you may have some experience of this, WITHIN my piston, DURING the time when the variable becomes TRUE (and curtains fail to close lol) IF I click TEST on the piston, the curtains close! what does that mean? Hopefully i’ve been clear. Really need this to work.


#6

I even put in THREE close commands just now to try to trigger something, but NADA, NIENTE, NOTHING!

Only thing that works is manually clicking TEST on the piston during variable true!!

17/11/2018, 11:59:52 +609ms
+2ms ╔Received event [D Drapes].windowShade = closing with a delay of 183ms
+168ms ║Runtime (47013 bytes) successfully initialized in 75ms (v0.3.108.20180906) (166ms)
+169ms ║╔Execution stage started
+190ms ║║Hey the Drapes didn’t close! i thank you.
+197ms ║║Executed virtual command log (6ms)
+206ms ║║Executed virtual command setVariable (6ms)
+274ms ║║Executed virtual command setState (0ms)
+284ms ║╚Execution stage complete. (115ms)
+286ms ║Setting up scheduled job for Sun, Nov 18 2018 @ 8:00:00 AM CET (in 72007.106s), with 1 more job pending
+299ms ╚Event processed successfully (299ms)
17/11/2018, 11:59:52 +20ms
+1ms ╔Received event [Home].test = 1542452392020 with a delay of 0ms
+154ms ║Runtime (47005 bytes) successfully initialized in 72ms (v0.3.108.20180906) (151ms)
+155ms ║╔Execution stage started
+319ms ║║Executed [D Drapes].close (135ms)
+327ms ║║Executed virtual command [D Drapes].setVariable (3ms)
+384ms ║║Executed [D Drapes].close (55ms)
+420ms ║║Executed [D Drapes].close (33ms)
+428ms ║║drapes closed
+430ms ║║Executed virtual command [D Drapes].log (2ms)
+473ms ║╚Execution stage complete. (317ms)
+477ms ║Setting up scheduled job for Sun, Nov 18 2018 @ 8:00:00 AM CET (in 72007.504s), with 1 more job pending
+489ms ╚Event processed successfully (488ms)


#7

I don’t understand why you have the countdown in there…and a random one at that. That doesn’t make a whole lot of sense to me. After you close the window, you don’t want the curtains to close right away but some random time after that? Why is that?

Also, you want the only trigger for the curtains to close to be the contact sensor? Then make it a lot simpler.

If contact sensor closes
Wait 5 seconds (to get out of the way)
Close curtains.

Done…very simple. Why all the countdowns and variables and stuff?


#8

The random countdown is for burglars studying my house, i want it to seem lived in when i’m not home.

Sometimes that window never opens during the whole day, so i can’t use if contact sensor closes, or when contact sensor closes.

and i can’t close the curtains if the window is open because it may damage the curtains! so as you can see i’m in a real pickle!

the 0800 part always works, never missing a beat.

It’s just trying to close the curtains around sunset.

i cant put the random wait under “but only if contact is closed” because it will stop the wait if window opens.
i need the evaluation at the point of the close command, to make sure the window/contact sensor is closed.
Hence end of random wait, set variable true, THEN IF variable is true AND window is closed, close curtains.
in my mind it’s so simple it’s just that webcore can’t trigger off a boolean variable becoming true.


#9

Success. I’m going to give you the solution @Ryan780 because you took the time to write, asked me questions and made me think. The solution i’ve successfully reproduced, is by simply changing the variable to a global variable, IF @Close_the_Drapes changes to true… that works! Oh navigating the vagaries of WebCoRe…


#10

I would ask, who’s closing your window if you’re not home? And why have your drapes open if you’re not home? If they’re open, people can look in and see you’re not there.


#11

Valid questions. Luckily I’m not on the ground floor, and also the window isn’t in a prominent position. It’s more to mess with the neighbours. It gives a lived in feel. Plus I suppose I could have a separate rule for when I’m away, and the window never gets opened, but this piston covers all scenarios. Plus I don’t have to worry about the drapes getting caught on an open window. So I’m a very relieved man.


#12

I find this so refreshing… It is easy to just hand someone a completed piston… but it can often be quite a challenge to get someone to think, or look at things differently.

Kudos to both parties. :+1:


#13

The solution?!? You were the one asking the question in the first place! If you had the answer, then why bother asking the question. Kudos?!? No kudos! Asking a question so you can give the answer?!?


#14

I was giving kudos to you both because @alwas was recognizing your time and effort by giving you the solution. I think he reached a solution after reading your messages, so he wanted to acknowledge your contribution. (even if it wasn’t verbatim)

Consider it a win. You helped him to look at his piston in a whole new light