[DEPRECATED THREAD] webCoRE design process

The WebCoRE integration is not complete

Ah got it. Thanks!

So my closet door isnā€™t always in view of the motion sensor. If it gets opened without motion being sensed, I want the light to come on, wait 2 minutes and turn off (if vanity power is off). If motion is sensed even without the door changing position, I want the light to come on or stay on. Even if the door gets closed, I want the light to remain on until no motion.

My problem is no matter which way I write the piston, I can either turn on the light with the door or motion, but the timer only starts to turn off the light if motion gets activated. Iā€™m missing something simple but Iā€™m not sure what. Iā€™ve re-written this piston so many ways that right now I canā€™t even figure out how fix it.

This will turn the light on if the door opens, but it wonā€™t turn it back of if no motion is sensed. It will turn on with motion (and stay on with motion). How do I get the timer to start if only the door opens but no motion, but cancels the timer if motion is sensed?

Many thanks, Iā€™m going to sleep on it for nowā€¦

This is my piston for the same thing, minus the door contact - all you would have to do is add the contact sensor into the if conditions.

okā€¦ I got it working. You need to use ā€œTileSetLevelā€ to set the volume of the track. I have found that when you use ā€œPlay Trackā€ or ā€œSpeak Textā€ and insert a number for the volume, you get the error. Thanks again for the helpā€¦

Hereā€™s the whole piston after I fixed the missing parameter.

So I tried your piston, just changing night mode to door contact changes in last 5 seconds. It will turn on the light, but since that evaluates as true, it never goes to the else to start a timer.

@Thayios, @whyintheworld I recommend using a wait in the else, instead of another condition (stays).

Look at these two I posted some days ago:

Look at his stuff above, heā€™s got the same thing youā€™re looking for.

Wouldnā€™t both of those pistons conflict? Maybe I just donā€™t understand how they would interact with each other. Would the motion piston cancel the door open piston?

If the door is opened it looks like it will just start a timer to turn off the light. I want the motion to extend that time IF there is motion detected after the door is opened. If there is no motion detected, then yes I want it to turn off the light after the wait.

Let me explain furtherā€¦ My wife often opens the door and uses the full length mirror that is on the door to get ready. In those cases, she will trigger the motion and as long as there is motion, I want the light to stay on. However, when she walks away she forgets to close the door and I want the light to go off. Easy peasy, just use the motion sensorā€¦

However, other times she will open the door just enough to access the very front of the closet and while the motion sensor ā€œseesā€ that area, it doesnā€™t always trigger and leaves it dark in the closet. So I want the door to also trigger the light. Of course, I want the timer to start to turn off the light if the door remains open with no motion sensed.

Lastly I want the light to remain on if there is motion and the door is closed, because when we get ready and either of us is still in bed, we close the door to the closet while we are inside so the light doesnā€™t shine on the person in bed.

But many thanks for the link to that thread, somehow I hadnā€™t found it yet.

They are distinct examples, one works off motion, the other one a door opening. If you want the light to open on either motion or door, you need to combine them into one.

That is where Iā€™m failingā€¦ When I try to combine it, the door opening will turn on the light but I canā€™t figure out how to get it to turn off if there is never a motion event.

If I make the door a condition then once it is open it always evaluates as true and never moves on to the else regardless of the state of motion.

If I make the door a trigger, it ignores motion as a method to turn on the light if the door had been left open and also ignores motion to reset the timer.

The worst part is that Iā€™m sure this is easy, but Iā€™m just missing what Iā€™m screwing up. But I have re-written this piston probably 30 ways and still havenā€™t gotten it right yet. I just canā€™t let my dad find out, he will never let me live it downā€¦ He has always been amazed at my lack of understanding of logical expressionsā€¦

Here is one of my latest versions of the piston. Again, as soon as the door opens it turns on the light, but ignores all motion and never moves on to the else because once the sensor changed to open it never goes to false. (you can ignore the contact sensor statements in the else because they didnā€™t change anything. It never got to those evaluations. I accidently left them in there from when I took all door evaluations out of the original IF trying to force the off portion to run)

So my mistake is that a piston only runs when an event occurs and only evaluates on an a state change. So the door opening is an event and turns on the light. However, there is never a second ā€œeventā€ or state change with the door to cause it to evaluate false. I mistook the condition of ā€œchangeā€ to re-evaluate after the specified time period (in my case 5 seconds).

The difference being that a motion event has a second state change when it goes to in-active, whereas the door remaining open never has another change in state.

So I need a way to make the state change so the piston will re-evaluate or I need to start a timer in the IF via the true/false action but be cancelable based on motion state changeā€¦?

I canā€™t for the life of me get this to clear on my pistons:

Iā€™m choosing PUSH notifications from the ST contact book:

Any ideas? It was working up until the recent new SmartApps were added.

That is because it is currently broken after some changes were made. Just need to use send SMS for now until it gets fixed.

1 Like

Gotcha, okay. Wasnā€™t aware of that. Thanks for info.

Many thanks to Adrian. He re-worked this piston for me and of course it works now. I did tweak it just a bit more to make it fit the rest of my variables, but it does work now.

1 Like

For my ambience lights, I like to use only certain colors which are placed into global variables such as ā€œ@Dark_Green = #013220ā€. In the piston, I have a variable that randomly selects a color or global variable. What I am trying to do is, is to get the random color that is used and have it be sent in a push notification converted to a color name. With the piston in the current state, my push and piston state just get a random color. Is there an easy way or an expression I am missing to make this easy? Right now I am thinking of taking the color of one of the lights that turn on and converting that to a word, such as if ā€œLight Colorā€ is #013220 then that equals Dark Green. Thoughts?

I could add a function ā€œevalā€ or maybe some better name, to which you could pass a variable name and it would return its value. Then you would select a random of color names, then eval(ā€™@ā€™ + name) to get the actual colorā€¦ this way you would have both the color and the name

1 Like

That would be great and save a lot of time. Thanks for all that you do!