Exterior lights activation commanded by motion or switch


#1

1) Give a description of the problem
(Numerous attempts using sample piston no resulted in desired behavior)

2) What is the expected behavior?
(If garage door opens or motion sensor detects motion then turn on exterior lights. If motion goes inactive for 5 mins turn exterior lights off or if the garage door changes to closed turn exterior lights off instantly.)

3) What is happening/not happening?
(Asking for the experienced coders to critic before I attempt again with this new code)

4) Post a Green Snapshot of the pistonimage
(

)

5) Attach logs after turning logging level to Full
(Haven’t ran since I’m at work. Will attempt when I get home and attach FULL log. )

REMOVE BELOW AFTER READING


#2

Definitely a Trace and log would be helpful. However, my quick suggestion is to divide this piston into two pistons - one for the motion sensor and one for the garage door. It will make debugging much easier. Once you have both working properly, then you might choose to consolidate them into one piston.

That being said, without testing, you piston may work. But what happens when you open the garage door without triggering the motion sensor? For instance, what if you open the garage door from inside? You piston will not fire because it is not set for triggering when the garage door is opened. That may not be important to you though :slight_smile:


#3

Pantheon,
Sounds like you have already found an error in the code. I infact do want the lights to come on when I open the garage door for the inside. Maybe I’m wrong but from the very little I know if split these into two pistons I would need to create a global variable to bypass the timer in the motion piston if the switch piston became active. My testing will have to wait till tomorrow. I came home from work and found our dog has passed away so I was out dealing with that. Thanks.


#4

Sorry to hear about your dog.
Depending on your skill level, you may not need to split into two pistons :wink: I have been coding for years and using webcore for a little over a year…and I am still learning new things every day. I am often tweaking my pistons because I realize a new scenario that I had not coded into a system. I am happy to help at any time…