[App] Motion controlled switch with light threshold

I wrote an implementation of this as well. There are a few distinct requirements for Motion activated lights:

  1. turn on when motion is detected
  2. turn off when no motion is detected after some timeout
  3. Do not interfere with manually activated lights (tricky and less than obvious)

That last one can be broken into the following two requirements:

  • 3.1 A light that is already on should not be affected by time outs.
  • 3.2 A light that is switched on within the time-out period should have its timer cancelled, and therefore stay on.

I thought about this a lot and tested it in my home for months. You can read the whole post here

live gets a lot easier when you just deactivate manual switches :wink:

I guess we have different needs. For me, manual control should only temporarily override, i.e. if the light was manually turned on when it’s dark, it should still be turned off when the sun comes up. I also mainly use motion detectors so I very selldom need to override manually. And, the whole point with a “smart” home for me is that it should act as I wan’t it to, without any need for manual control… :wink:

2 Likes

It is impossible to automate all aspects… no matter how hard you try haha
Manual could mean using Google Assistant to turn on a light. If a motion sensor times out after 5 minutes it would be really annoying to have to turn it on again. that’s what i meant.

Im working on priority locks as well where for example your sunrise automation has higher priority to a manual light whilst a low priority motion sensor timeout cannot affect the manual light. HA is introducing attribution in the next release, would be cool to see how it can be applied!

that only depends on your wishes.
i dont use motion detection in a room where the lights should stay on (livingroom, diningroom)
i dont see the use for that because the lights in those rooms turn on as soon as it is to dark and they turn off as soon as i go to bed.
in hallways and bathrooms i dont use manual control at all. the motion detector does its work there.

so in that case there are no conflicts :wink:

We are comparing different things here. There are different ways to do it. Some are simple, others more complex. The more complex ones tend to capture more requirements

What happens when you go on holiday?

Manual override is inevitable and I want to build a system that can gracefully handle it by design. (Not saying it’s there yet, definitely not haha)
I might write a post about some of these comments, I have a few ideas.

the same.
the advantage is that i dont need to create or use complex simulation programming.

no it isnt. the only moments that i needed that in the last 2 years, is when something went wrong with the automation. but you cant program for that :wink:

manual override is there to use when the program fails. if that happens while the program is running, then there is an error that needs to be corrected.

lets say you are on the toilet and dont move for 5 min and the lights go out.
then you know that you need to change the timeframe, or a second motiondetector.

i dont even use such short timeframes, because they can be annoying.

there are 2 ways that people look at automating.

  1. it should bring convienience. (there is almost none that find that important)
  2. it should save power. thats why people use short delays in motion detection.

the second 1 is most of the time interfearing with the first. and its probably the one that creates trouble for many.
but not only that. its something completely irrelevant in my eyes.
almost all of us are spending more money on automation then you could save in 25 or more years using LED light. your devices wont last that long, so you need to buy more.
in the end we all just need to realise: automating stuff will cost us money, not save it.
and the world isnt better of because we are automating. the power we can save has less impact then the stuff we use.

realising that makes that there is only 1 thing that is important. convienience.
so why turn of a light in a situation that there is a possibility that it annoys me?
thats why my livingroomlights are always on when its dark and i am awake.
and when i am not there they are always on untill a certain time.
and thats why i dont need manual override :wink:

1 Like

Hey Danny,

I have since modified my script a bit more. It doesn’t turn the lights on if they are already on. This means if for some reason I am doing something and have turned the lights on brighter or changed the color manually the script will not override the light until it has gone off (due to lack of movement)

I think I agree with pretty much everything you say here :slight_smile:
Not everyone has the same needs.

Also its not black and white. I automate for convenience and also power saving. I agree its like security and usability. Its a fine line.

I think I have been able to save power and make my home more convenient…

Also I agree at least in my case and short term there is no way I am going to make back all the money spent in power saved :slight_smile: but I also look at it as a way to learn new things (for example some Python) so that way I also justify it as “Training”!

1 Like

i also save power by automating, but not with lights but with heating.
and there its worth it.

saving a few hours of heating is the same as all the lights use all year long.

That’s a good start. next step would be to not turn off the light if you control it while the motion is timing out.
(i.e. light was turned on by motion sensor, you manually control the light somehow, for example change brightness. in that case you want the motion timer to stop itself as to not turn the light off.
It’s unlikely but i’ve seen it happen. especially when the time out is long like 10 minutes.

I say manual but it applies to other automations as well. If your motion light is activated and a timer for 10 minute starts, but you start playing a movie which triggers an automation to dim your lights then you surely don’t want the motion timeout to turn them all off some 8 minutes later (this has happened to me and was very confusing at the time). The situation is shifted from simple “provide lighting so i can see” to “provide home cinema lighting”. That is where the conflicts start to happen.
So the use case is not simply “manual override”.

Again it’s not black or white :slight_smile: I do something in between. I have a check for if my tv is “home” before I switch off my lights due to inactivity in the lounge. If it’s on I start a new delay.

This works pretty well for me.

1 Like