Which is the best way to build a room presence detection system?

Any progress or update on the matter? I’m running into the limitations of PIR and it’s starting to severely limit the WAF when she’s waving her arms in the dark :frowning:!

What about adding some conditions, like if TV is on, don’t turn off the lights?

No, sorry… I haven’t had chance to look yet.

I ended up just hacking most of my Xioami PIRs to have a 5 second update time and added some Boolean input toggles to enable/disable motion sensing, to fix the issues I was having.

I still hope to try the Omron sensors for bed presence detection at some point.

If you want to try it yourself, room-assistant has support for both the Omron D6T and the GridEYE sensors built-in. Note that for the D6T you most likely will have to crimp cables yourself, while there are GridEYE boards that you can just use with normal DuPont connectors (e.g. the Sparkfun one).

I have tested both at home and ended up settling for D6Ts, since they were cheaper at the time and had a bit less noise in the data. Both are completely fine to use though. Has worked out well for me!

What board did you connect your GridEYE sensors to?

Where did you source either sensors from?

Seems to be a fair few people trying to solve room presence detection.
Right now there are a few approaches:

  1. Track the phone/device from a few nodes in the house (room-assistant on Rpi)
    Use that for either triangulation or supplement existing sensors. BLE using the beta RA app makes this snappy, but not easy to configure

  2. Track the nodes distances from phones
    (ESP32 MQTT room presence)
    iOS app with an AI model for training, uses battery on the phones.

  3. FIND3 - positioning for android phones only.

  4. Bayesian / complex sensors and automations, to infer room location

  5. Complex sensing with thermal (eg grideye).

I wonder if it’s possible to create a discord channel in the HA discord server to bring everyone’s ideas together? @frenck is this possible? There are some very smart people with some great approaches and I think it could be beneficial to collaborate and evolve (especially if say the HA mobile apps could have BLE broadcast enabled (opt-in of course) to make the process simpler?

It would be cool to have a couple of supported/integrated options for HA using the app (although a lot more testing is needed to dial these solutions in)

Thoughts?

5 Likes

I started to work on a esphome custom component yesterday. For counting people using the VL53L1X time of flight sensor. I ordered some sensors as well. So will test and enhance the code the coming time. https://github.com/DutchDeffy/esphome_custom_component_VL53L1X_people_counter

Hi @DutchDeffy,

I’m happy to hear that you started to work on a custom component for the sensor. I did a little more research about it and started building a prototype. I’m using an already existing project which you can find here: https://github.com/Andrea-Fox/peopleCounter.

My current status:
I bought an ESP8266 (Node-MCU) and a VL53L1X sensor and tested it for a week. It works very well which is why I’m close to go into serial production for every door I have.
The major disadvantage of the project is the energy consumption. Until now I have no solution on how to reduce it, since the sensor needs to be online all the time. Therefore, using a battery as power source is not suitable (except you want to change it every week or month), which can become a problem if there is no socket nearby. If you also come to this point let me know - maybe we find a proper solution here.

Except the power issue the algorithm (+sensor) works amazing and reliable and has a lot of advantages compared to e.g. a PIR sensor. Counting the number of people in the room means that you can turn on and off your light with no delay and not having to wear a phone or anything else with you.

Wow awesome! We should get everybody to one place as @jaburges suggested. Personally, I think this is a really powerful tool that has a lot of potential. Also with the ‘little’ pandemic situation the world is currently dealing with. For the power problem, you could use a very big battery bank as you said or a long power cable something like power over ethernet or such.

1 Like

My conclusion on presence (or occupancy) detection is that nothing will approach good sensors. I hope that in the near future professional sensors get cheaper and you only have to place one device that reports if and how many people are in a room.

Like these for example:
https://www.steinel.de/en/lights-sensors/serien-lights-sensors/true-presence/true-presence-multisensor-knx-056353.html

https://www.steinel.de/en/lights-sensors/products/professional-line/steinel-steinel-1/hpd2-033965.html

Another interesting idea is wifi presence detection:

or this one from @Harry13 Which is the best way to build a room presence detection system?

Wow awesome! We should get everybody to one place as @jaburges suggested.

Should we open a new threat just about the sensor here in the forum? Discord might be another solution.

Personally, I think this is a really powerful tool that has a lot of potential. Also with the ‘little’ pandemic situation the world is currently dealing with. For the power problem, you could use a very big battery bank as you said or a long power cable something like power over ethernet or such.

Personally I also think that this tool has a lot of potential and outweighs a lot of other sensors to detect people in a room. I see it as the “ultimate” sensor to detect room occupancy. The github project from Andrea-Fox which is based on the original people counting algorithm made by the sensor manufacturer is a very good start but needs to be optimized and extended in some points (e.g. OTA updates, WIFI manager, power consumption etc.). In addition a 3D printed case is needed that makes it easy to mount the sensor over a door.

About the battery issue: I measured the power consumption with the ESP 8266 Node-MCU and the algorithm of Andrea Fox and got around 80mA, which is a lot. Even a larger battery bank might not last longer than a week with this consumption if my calculations are right (in my eyes it has to last at least 6-12 months). So optimizing the algorithm here is a high priority in my eyes and should be possible if I look in the documentation of the sensor:

image

The bottleneck of WiFi is that it’s very power hungery. With the code that you’re using, WiFi is connected constantly. One could try to reduce the power usage by using deep-sleep or light-sleep modes and/or only connect to the sensor to the WiFi if there’s a state change. This still doesn’t solve the problem of replacing batteries and stuff. However, a rotating schedule and/or notification of an almost empty battery for example could make it less of a hassle.

You got it. Deep sleep might help a lot but I am not 100% sure whether it is applicable with this kind of sensor. According to the docs of the manufacturer (see my last comment) it might be possible. With deep sleep a battery powered system should last way longer. Paired with additional information about the battery state and a notification about a low battery level replacing it is not that worse :+1: But I have to do more research here - especially with the deep sleep mode since I am not experienced enough to implement it (until now).

I have set up a discord server https://discord.gg/65eBamz7AS.

Hi, thanks for this
For override, does that mean if someone else manually turn on/off the switch?

I bought one of these, but IDK how to get room assistant to work with it.

Hi!
I am trying to do something similar, using 2 VL53L0X sensors. I am configuring the addresses for the sensors at the beginning of my usermod file but it is causing the WLED to not boot at all. Would you be able to share your implementation or maybe give some advice on how to handle multiple sensors with WLED?

Hi ivankio,

Its been a long time since I looked at this but I do have a public repo fork of WLED from back in Jan 2020

Some key areas:

I also remember I had to disable RLYPIN

Not sure if this will be any help.

My idea is basically to have a second hallway PIR sensor that must turn on within 5 seconds of the bedroom PIR turning off. That will set a timer running to turn my AC off after 10 minutes. If my bedroom PIR turns on within those 10 minutes, it stops the automation.
This is my node red setup in home assistant.

Havent yet implemented it but I thought Ide share and see if this makes sense…

This approach is not working. Lets say that you have a timer for 1 minute. If you move around the room constantly for 1 minute, when the timer finishes and there is an automation to restart it, the timer restart but at the end of the first run it turns off lights before starting the one. I have hue motion sensors which is the best in the market. For hue’s cool down is only 8 seconds. In order the timer to restart counting you have to stand still for 8 seconds and then move. As I mentioned if you move constantly the timer does not reset and at the end of the turn it shot downs light or whatever it is bound too.