Need help with a piston to raise my shades in the morning based on lux and contact sensors


#1

1) Give a description of the problem
I need to create a piston that will raise my shades in the morning. I have a luminance sensor and a contact sensor on the bedroom doors, and there are 4 bedrooms. I want to set this up so that once a certain luminance value is reached, it then checks the bedroom door to see if it has been open for at least five minutes. If so, then the shade goes up for that bedroom goes up. I want this to only run once per day. I know the example only has 2, I thought I would get it working for two rooms then scale up. Thanks in advice for the help/advice.

2) What is the expected behaviour?
If luminance >= 175 lux and contact sensor stays open for 5 minutes, raise the blind

3) What is happening/not happening?
Nothing is happening after the luminance gets past 175.

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

5) Attach logs after turning logging level to Full
5/29/2019, 6:44:06 AM +906ms
+2ms ╔Starting piston… (v0.3.108.20180906)
+783ms ║╔Subscribing to devices…
+861ms ║║Subscribing to Door Master Bedroom.contact…
+883ms ║║Subscribing to Door Guest Room.contact…
+1042ms ║║Subscribing to Aeotec MultiSensor 6…
+1044ms ║║Subscribing to Shade Door…
+1047ms ║║Subscribing to Shade Master…
+1049ms ║║Subscribing to Shade Guest East…
+1051ms ║║Subscribing to Shade Guest North…
+1052ms ║╚Finished subscribing (288ms)
+1105ms ║Comparison (integer) 100 is_greater_than_or_equal_to (integer) 175 = false (5ms)
+1125ms ║Comparison (string) :462103c2816251d4e40f46ba791cf9c6: is_any_of (string) :276353f22fd1d269eb3cb1a70c2530e5:,:462103c2816251d4e40f46ba791cf9c6:,:34edb8be918e271594df1b4ee7676451: = true (6ms)
+1151ms ║Comparison (enum) open stays (string) open = true (5ms)
+1173ms ║Comparison (enum) closed is (string) closed = true (4ms)
+1204ms ║Comparison (enum) open stays (string) open = true (3ms)
+1225ms ║Comparison (enum) closed is (string) closed = true (3ms)
+1242ms ╚Piston successfully started (1240ms)

REMOVE BELOW AFTER READING
If a solution is found for your question then please mark the post as the solution.


#2

Normally, triggers are top level (far left) and conditions are indented. Yours is set up the exact opposite.

Untested, but here is where I would begin.

The piston below will only open the blinds once a day… I had to use two triggers because we don’t know which is going to happen first… (Door opening or getting bright)

temp2

The two inverted Triggers above should cover both scenarios:

  • Fire 5 minutes after it gets bright (if the door is open)
    - OR -
  • Fire 5 minutes after you open the door (if it is bright enough)

Note:
The first WITH block needs TCP set to Never for this logic to work.
Also important to note that each room should be in it’s own piston.


Edit:
If it were me, I would be very tempted to remove the WAIT from the first block. My logic is, it will be extremely rare that the illuminance will climb to that specific brightness within 4 minutes of you opening the door. (although keep the “5 min” in the second block)

If you decide to remove the WAIT line, then the “IF Contact is open” can be merged with the top IF…


#3

Thanks WCmore. Shortly after posting this, I did have the same thought that each room should have its own piston for the shade control. I tried coding your example, but I can’t figure out how to get the line in where I set LastRun = $day. It does not seem to be an action that I can select. I should be able to set it with add an action, but I don’t see the variable LastRun anywhere in the drop down list. Here is what I have so far…


#4

Nevermind, I figured out how to set the variable… :grinning:


#5

Here is what I have so far. With rises above, if the door is closed when the lux crosses over 175, It’s not going to trigger again. So I set it to greater than instead, and that works, but it waits five minutes after the lux hits 175 before opening the shades, even if the door has already been open more than five minutes. I guess it’s not really that big of a deal. Any suggestions?


#6

Messed around with it abit more, and added some functionality where if the temp in the room reaches 76 or higher and no one is home, the shades close 1/2 way to reduce the solar heat gain.


#7

So it did not work this morning. The door was opened for five minutes before the lux sensor hit 150. How can I get the contact sensor trigger to fire again after the lux value statement becomes true?

5/31/2019, 6:16:16 AM +224ms
+2ms ╔Received event [Door Master Bedroom].contact = open with a delay of 117ms
+171ms ║RunTime Analysis CS > 28ms > PS > 111ms > PE > 32ms > CE
+173ms ║Runtime (42141 bytes) successfully initialized in 111ms (v0.3.108.20180906) (171ms)
+174ms ║╔Execution stage started
+191ms ║║Comparison (integer) 61 is_greater_than (integer) 150 = false (2ms)
+193ms ║║Condition #2 evaluated false (12ms)
+195ms ║║Condition group #1 evaluated false (state did not change) (14ms)
+206ms ║║Condition #11 evaluated false (8ms)
+208ms ║║Condition group #10 evaluated false (state did not change) (9ms)
+210ms ║╚Execution stage complete. (36ms)
+212ms ╚Event processed successfully (211ms)


#8

You deleted that part from my previous example.

Here it is again:

temp


#9

So if you use a trigger, like rises above, that would only become true once, as the value rises above 174, right? The sensor reports the lux every 4 minutes. So if it reports it as 173 its false, next time is 175(would be true), and the next time it changes to 180, that would be false, right? The problem I have with that is that some mornings I won’t open the door until after the lux is over 175(this sensor is outside, and usually will not drop that low again till close to sunset).

The other need that I have is for the door to be open for five minutes before raising the blinds. This is because if two people are sleeping in the room and one wants to leave and let the other sleep, as soon as they open the door, the blinds would go up. I’d like a five minute window so that if the door is closed within 5 minutes, it aborts the raising of the blinds. Another use case for this is if my kids are sleeping in, and I just want to open the door to check on them. Don’t necessarily want the blind to go up and wake them up. I’m not sure what I have now will cancel the open if I shut the door within 5 minutes. Here’s what I have so far…


#10

You changed the two triggers I posted into conditions, so now all of your conditions are treated as triggers. This means that piston “2vvb” is executed by four different devices and eight different events. (notice all the lightning bolts in the left margin?) This will constantly force your piston to run from top to bottom.

You might get this to work, but I am still a fan of this method.

It uses only two triggers, and it covers both scenarios you are looking for.


#11

Thanks for the help WCmore, here is what I ended up with. I put the wait randomly in there cause I think I’m having some issues with the zrtsi controller that operates the shades, when it receives alot of commands at the exact same time. I’ll eventually add logic to also partially close the shade in the winter, when the room cools off and the sun is not out.