Please Help With creating My First Piston!


#1

1) Give a description of the problem
I need some help on coding some lights before I give up and get out of home automation. I’ve tried to use smartthings to code this but it hasn’t worked and my wife is not happy with the results.

I have smart light switches and motion sensors in our kitchen, living room and outside lighting. I also have a door sensor on the front door.
What I am trying to achieve is:
From 6:00am to 11:00pm when motion is sensed in the kitchen, the kitchen lights turn on and then turn off when there is no motion after 10 minutes. I also would like the light to turn at night when motion is sensed outside and if the door I opened or knocked on. All these triggers would turn off after 10 minutes. Lastly I would like the wall switches and the Smartthings app to override the code for the unique situations and remain in that state until I tell it to return to the automation part. Currently, when I try to turn a light off, either by app or wall switch, the light comes right back on because of the motion. Likewise, there will be situation when I would like the lights to remain on all the time.

From 11:00pm to 6:00am, when motion is sensed (inside or outside or door opened), I would like the lights to come on at 20%(Inside motion sensor) and 100% if the door is opened and turn off after 5 minutes. I would also like the wall switches and app to override the automation until I reset everything.

2) What is the expected behaviour?
On with motion, Off after x time with no motion, dimmer set by time of day, override with switch (On/Off) Multiple sensors trigger lighting

3) What is happening/not happening?
Not sure where to begin.


#2

I’m not at home right now so I can’t completely address this but I would recommend that you divide your tasks into multiple simple pistons - such as getting the motion sensor in the kitchen working with those lights and then work from there with a new piston. Coding and debugging is much easier that way, and this community has an easier time helping you. You can then combine multiple pistons into one if you want.


#3

You will likely need to employ variables and/or SimSwitches to get this portion working.
(I usually over-ride using Simulated Switches since that lets me use my voice or programming to toggle)

There’s a real good example using variables in this thread.


#4

I will take a look at it soon but not home right now.