Motion sensor for light not working with night mode


#1

1) Give a description of the problem
I’m a new user with webcore. I have one working piston, trying my 2nd one now. I would like to create a piston to turn on some outside lights only when it’s dark/night. My piston is turning them on anytime during the day or night.

When I get that kink worked out I would like to know how to control if the lights are already on, I don’t want the motion sensor to turn them off after X minutes. We may turn the lights on manually and leave them on.

2) What is the expected behavior?
Don’t turn the lights on during daylight hours and don’t turn them off if they were already turned on manually

3) What is happening/not happening?
they are being turned on during the day


#2

You need to set Task Cancellation Policy (TCP) to NEVER.
Click on the WITH. Go to the settings cog at the bottom and click on it.
Now set TCP to never.
Also if you want to turn your lights on only when it’s dark, you can either set a restriction or condition for -
Time is between sunset and sunrise.
Then get rid of your while Home,Night or away.

Also for the lights already on senario, have a restriction IF light is OFF. I’ll post a piston if you wish.

PS. You can import this using the code and then amend for your devices if you wish.


#3

You also have if Motion Changes. So, this piston will also trigger when motion goes to ACTIVE not just changes. Right now, it will turn the light on when motion goes inactive as well.


#4

I’m struggling with this automated editor. I don’t understand it. How do you build a compound If statement like you did? I don’t see the option to add the Time between clause.

Also my sensor is not giving me an option for active, it only offers changed.


#5

What to compare : Choose virtual device/TIME
this will give you more options.

IS ACTIVE
Choose IS (as a condition)
After that you will see more options.


#7

It’s not working now, I have it setup as suggested. I am wondering if the sunset and sunrise are using the correct time zone? Not sure how to tell. This is what the trace looks like, I don’t know how to read it.


#8

I think the logic is wrong from the example, it should be not between sunrise and sunset.

Let me try that …


#10

In my experience,
Using the trigger FIRST and the condition SECOND works better. (I don’t know the reason behind it)

IF motion Sensor 1 motion is active
and
Time is between X and Y
and
Switch 3 is OFF
do this do that


#11

It appears to be working now with changing the condition from not between sunrise and sunset.

I also got the Task Cancellation Policy set to Never but I’m really fuzzy on that thing. I googled it and it’s still not computing in my head.

I need to test during the day and a couple of times it would not turn on. Not sure why.


#12

Let me try to explain that if I can,

Lets say you have a trigger but you need some wait time or a condition after…

IF motion sensor changes to active
WAIT 5 minutes
TURN the light ON

Now the piston will run when the sensor is activated and your 5 minutes timer will start. BUT within few seconds the trigger will no longer be TRUE. Meaning, sensor changed to active but now IT IS active (no longer CHANGES TO)… Your piston still looks for CHANGES TO active to get executed again.
so you will see your timer go down from 5 minutes BUT around 4 minutes and 45 seconds IT WILL STOP.
And your light WON’T turn ON
If you add set the policy to NEVER CANCEL, even though your piston is no longer trigered, the TIMER WILL NEVER STOP until it reaches down to ZERO and turns the light ON…

Just imagine this,
PISTONS RUNNING without never cancel:
While you are talking to your mother in law, you start telling her what you feel and see her face dropping, you change the subject to make her feel better and stop telling her what you really feel…

NEVER CANCEL,
You sent her an email while you were drunk and told her everything. You can no longer stop her from reading that email or erase that email from her inbox even if you feel so bad about it LOL

This would be the only way I could explain:))))) LOL


#13

Okay…first of all, I would not use IS. That is a condition and you want to use the trigger Changes to. If you want something to happen only after motion has been active for 5 mins, uses the Stays function. Don’t build in so many Waits. Waits are going to screw you up because of conditional state changes in the piston. All of my motion pistons are backed on changing to Active and Staying Inactive. here’s a couple examples.

I don’t understand why you need a wait time after a trigger of motion on. But a wait is not a condition. It is an action. If you want to combine Triggers and Conditions, you can. But remember, if you use all condition, like using IS all the time, then ALL your conditions become TRIGGERS as well. So, if you want to have some things be triggers and some be conditions, then write it that way. Using the trigger functions for the triggers and condition functions for the conditions. They’re even broken up that way in the dashboard. Right now, you have the time function in your piston is also a tirgger. See the little lightning bolt next to the time function? I don’t think you want the time to be a trigger but only a condition, right? So, I would use the changes to active in the first part and leave the time is between in the second part. you also don’t need the parens, but they’re not hurting anything either. But you don’t need them in this case.


#14

In my example I have used 2 conditions. As I have used conditions ONLY then they have BOTH subscribed as can be seen by the lightning bolts on the left.
If you mix triggers and conditions, always put the trigger first. If you do mix them you can also change the settings of conditions to Always Subscribe if you wish.

As for using IS I use this exclusively for this type of piston and it works just fine.
There are lots of ways to accomplish the same thing. The best way to learn is to experiment.
Have fun…


#15

If you use conditions and triggers, the conditions no longer act as triggers, they act only as conditions. Or else, what would be the point of having the two?


#16

Totally agree. That’s why I posted what I did.