Motion and door switch controlling light


#3

One challenge I see with this is:
What if someone grabs that tissue in 15 seconds… They pop in, grab it, and close the door on the way out. At the 20 second mark, the door will be closed, so the program will think the toilet is currently being used. AKA, Leave the light on until the door opens next.

It almost sounds like you want the motion sensor to be disabled the instant motion is detected.
(and ironically, re-enabled the instant the room is empty)


The trick though, will be in “guesstimating” the times used to determine whether the room is occupied or not. Unfortunately, I do not see a 100% success rate for all users & cases. You are going to have to choose a cutoff time at some point.

  • If the delay is too long, then the quick pop-ins may leave the light on for hours at a time.
  • If the delay is too short, then means slow walkers may be in the dark at the 2 min mark (until they wave their hand)

#4

Well thinking about it - the door should never be shut, unless someone is in the bathroom… Um… Needing privacy! LOL and it’s just two of us here - we both know it. If we have guests we can tell them.


#5

And I mean - worst case, and would be written in the piston, is if somehow, someone’s in the bathroom and the light turns off - they can just turn on the switch (which has a small green LED) and the light stays on until it’s turned off with the switch.


#6

This is a key component, and will make the coding much easier!!!

I am tied up at the moment though…


Starting thoughts?

IF Door opens, Then Turn on Motion Sensor
IF Door closes, Then Turn off Motion Sensor


#7

ok I have to ask,
without using some sort of a variable and/or sim switch, how do you turn ON/OFF a motion sensor???


#8

Yea, those were my starting thoughts… but I also have a taboo idea on the back burner… Honestly, I’d rather not spend time elaborating that complexity though, unless @withay likes this structure:

  • IF Door opens, Then Turn on Motion Sensor
  • IF Door closes, Then Turn off Motion Sensor

If not, then we keep brainstorming…

If so, then I will likely elaborate in another 36 hours…
(Wednesdays are a bit crazy for me here)

Feel free to step in anyone…


#9

Maybe have one piston watching the motion sensor and a separate piston watching the door. to ‘turn off’ the motion sensor, pause the piston. to ‘turn on’ the motion sensor, resume the piston.


#10

That makes perfect sense but I know @WCmore and he normally doesn’t like pausing and resuming a piston :)) That’s why I was curious.


#11

Well, if she wants to go that route, I have a “secret weapon” that can resolve that…
but it will increase from two pistons into three.

I am waiting on feedback before elaborating…


#12

Greets! Sorry - busy 'round these here parts! Ok, so:

IF door IS sensor IS open, Motion Sensor is On
IF door IS sensor IS closed, Motion Sensor is OFF

Is what you’re saying, yes? Mmmm… I’m not in love with it. May I (I’m “he” btw) see your secret weapon? That didn’t at ALL sound risque. :slight_smile:


#13

It will take three pistons, and a bit of time to explain, with warnings etc.

Honestly, if you do not like the core concept:

  • IF Door opens, Then Turn on Motion Sensor
  • IF Door closes, Then Turn off Motion Sensor

Then I would rather not put this out there.


#14

Let me mull this over a bit and I’ll come back. I have to lay out in my head how it would affect what I want to do.


#15

For what it’s worth, I usually do not ever recommend “Disabling” a motion sensor… The only reason I have even considered it is because your original post sounds like you want the motion sensor to be 100% dumb when the door is closed.

Of course, you know your long term goals better than I do… so I may be way off


#16

Multiple pistons are sometimes necessary.

I have 5 separate pistons for my garage lights: Garage Door Opens; Garage Motion, Back Hall Door Opens (which leads into the garage); Garage Lights Automation and Garage Lights Control.

The first 3 will trigger something in the “Garage Lights Automation”. Then, the Garage Lights Automation will trigger something in the “Garage Lights Control”.

This is because when a Door Opens, or Motion is Active, the lights come on. When a Door Closes, or Motion becomes Inactive, a 10 minute timer is set for the lights to go off. But, if another even happens (lets say the Back Hall Door opens or there is motion), the 10 minute timer is interrupted (using Cancel All Pending Tasks), until another Close or Inactive event happens.

This was necessary, because too many times the lights would turn off on me at night as I was still in the garage.

I may post these 5 somewhere if anyone seems interested.

This worked so well, that I ended creating a “Lights Control” piston for each room (Living Room Lights Control, Rec Room Lights Control…etc). Then, certain events can trigger something already setup in the Lights Control.


#17

I would love to see them…


#18

Yeah at this point, going back to what I originally put as my goals, I’d like to see them too! :slight_smile:


#19

While we wait for @dejavux2
I’m going to draft you a piston(s)
but let me ask you first, do you mind doing this with variables??? and/or 2-3 pistons???


#20

LOL Honestly, if it does all that I said I wanted it to do, I don’t mind what it takes as long as it’s not precarious, and I can learn from it.


#21

When something is this “intuitive” and dealing with “seconds” it maybe just slightly precarious but I’ll do my best. (not a coder so hang tight:))))))
I’m busy next few hours but I’ll draft something today and we’ll see where it goes.


#22

Haha slightly is probably fine! It’s a convenience thing, as most everything I have is, so no rush - I greatly appreciate anything!!