kevinvincent / ha-wyzesense

A Home Assistant Component to interface with the WYZE Sense hub and sensor system
368 stars 97 forks source link

Shorter reporting time / re-triggering of motion sensors? #180

Open iankaufmann opened 3 years ago

iankaufmann commented 3 years ago

Just curious if it is in any way possible to shorten the window of time before the motion sensors re-trigger.

It's mentioned in (https://github.com/kevinvincent/ha-wyzesense/issues/137) that it's 40s by default.

Is that something that is just part of the firmware, or could it possibly be tweaked?

I have a use case where I basically just want to know if something walked past it and would like it to re-trigger within a few seconds.

Maybe there is a different product that would be better suited to this, but I have 5 of these motion sensors sitting unused...

Mincka commented 3 years ago

I don't think so. There are tweaks for the Xiaomi motion sensors to go as low as 5 seconds but I don't have these yet. The Philips Hue mention sensor is great and reliable but way more expensive. The cool down period is set to 10 seconds, which is great.

iankaufmann commented 3 years ago

Darn. I was hoping it could possibly be a behavior controlled by the bridge that could be set somehow.

I'm struggling to find a product that does what I'm looking for.

I pretty much just want a wireless "trigger".

I want it to trigger like a motion sensor does, but not continue to track motion or have any sort of delayed off.

I guess even 5s would be acceptable, but the Xiamoi motion sensors are too bulky.

Ideally it would just send a MQTT message every time you walk by it.

I understand that the cooldown period extends battery life... but if you are only activating it a hand full of times per day, I don't see how that would be a huge savings.

Mincka commented 3 years ago

Maybe you could go for DYI with an ESP32 (like D1 mini, $3) and a PIR: https://randomnerdtutorials.com/esp32-pir-motion-sensor-interrupts-timers/

iankaufmann commented 3 years ago

That's a thought for sure... I just would obviously prefer the form-factor of these awesome little wyze motion sensors!

I came across this: https://community.home-assistant.io/t/dual-laser-tripwire-with-mqtt/139074

The tripwire concept seems to be exactly what I'm going for. I just ordered a couple of those VL53L0X sensors to play with. If I can manage to do a fairly long wire run between the sensor and the D1, I could maybe make it work where I want to put it (which unfortunately is nowhere near an outlet).

ctrl50 commented 3 years ago

you could use node-red. when it triggers just start the node-red flow however you want. at that point you are free to turn on or off any entity as you please, with timers, or delays, or .. Anything is possible lol

Mincka commented 3 years ago

node-red cannot help at all for what the OP wants. The sensor will not be able to trigger again before the 40 seconds cooldown period.

jes1417 commented 3 years ago

I think this actually might be possible, a while back when I ordered some more sensors and was setting them up I short pressed the button on the motion sensor and I noticed the light was flashing everytime I would move in front of it instead of every 40 seconds like normal. I asked in the forums and got a response that it's an undocumented feature that if you short press the button it goes into a instant detect mode where as a 3 second press gets you the standard 40 second mode.

Here is the link to the forum response.

https://forums.wyzecam.com/t/motion-sensor-red-light/88209

Is there anyway we can see how these report to the hub and add in a feature to detect these changes faster?

iankaufmann commented 3 years ago

Wow, you're right! It seems like it would do exactly what I want if only the trigger would make it back to Home Assistant.

I gave it a try and if you push the button once, the motion sensor does appear to go into a rapid trigger mode... it picks up every movement and blinks the light.

However, it doesn't send that data back to HA. Even when I tried triggering the sensor, then manually setting it's state back to "off" in the developer tools immediately after, triggering the sensor again doesn't change the state back to "on".

I wonder if it's possible to tweak the bridge into triggering quickly.

What I'm trying to do is have a setup in my bathroom where there is one sensor over the door and one in the room. The one over the door is the one I would like to have a very fast trigger time, which is responsible for turning the lights on... and then the one in the room works regularly and keeps the lights on with movement detected.

The problem right now is that the one over the door has the 40 second cool down, so if you exit the bathroom and manually turn off the lights... then go back in within the 40 seconds, it doesn't re-trigger.

I can think of several places I'd use a similar setup if we can get the rapid triggering to work!

Mincka commented 3 years ago

I don't get why you don't use a contact sensor for the door. It would be much easier and reliable to turn on the lights quickly. Use it only to turn on lights when the state goes from closed to open. Combine it with a motion sensor to keep the lights on. If the door is closed and there is no motion during 40 seconds (worst case scenario) or more, turn off the lights. It seems you control the light with a smart switch so I think you will turn off the lights manually when leaving anyway.

iankaufmann commented 3 years ago

Sure, could use a contact sensor but then you'd have to always close the door. It's the bathroom in the master bedroom and we generally leave it open since you go in and around the corner and it makes the space feel more open.

I use that setup in other areas where the door is typically closed, but that just isn't the solution for the way we use the space.

The main purpose of the motion is for when you are headed in there in the middle of the night.

I can also think of plenty of other situations where walking past a sensor and having it trigger every time without the cool down would be useful... Using it more like a tripwire than a motion sensor.

Either way, none of this is important. Doing this stuff can make things more complicated than it needs to be, it's just fun to mess around with.

jes1417 commented 3 years ago

@iankaufmann I use them for led strips going the length of my stairs, I have one on top and one on bottom. With the 40 second cool down sometimes the lights turn off and the sensor is still reporting motion so they won't trigger again and leaves us in the dark.

iankaufmann commented 3 years ago

@iankaufmann I use them for led strips going the length of my stairs, I have one on top and one on bottom. With the 40 second cool down sometimes the lights turn off and the sensor is still reporting motion so they won't trigger again and leaves us in the dark.

Exactly... if you have some other means of detecting when there is NOT motion, then the trigger for motion ON should be short and repeatable within a short window. The struggle is those times when you enter, turn the lights off, and then try to re-enter but it doesn't trigger due to the cooldown.

I did order some VL53L0X sensors to try to build a trip-wire but I haven't done it yet. It also requires an ESP board and a power supply so it's not anywhere near as elegant as if we could just get it to work with the Wyze form factor.