Sure here is the link to the code
https://drive.google.com/drive/folders/1bPxQGAB-Pae1OHqNp3j0JPD3TwISbe2d?usp=sharing
Cool, thanks.
Also, the RA implementation isnāt as robust as you hope to build yours (and points to the flaws I mentioned about multiple people on thermal):
Note that due to the low resolution of the D6T sensors multiple people can only be recognized as such if they are positioned at different ends of the sensor field of view.
So, where are you in testing now? What pitfalls are you encountering and how accurate have you been able to make it? What kind of field of view/distance are you getting from that?
So the aim is to have a sensor above an entryway facing down so it has a birdās eye view. So far I have made it work and can detect me entering and exiting but itās 75% accurate so I am looking for things to improve. after that, I will test with multiple people entering at once and go on from there. The FOV is I think 60 degrees up till 5-7 meters depending on the environment, more than enough for my case.
Have you considered over-engineering it? Have an MLX thermal camera, CO2 sensor, PIR sensor all working in harmony? If itās that close proximity then those three working off of each other might get you pretty close to that 100% mark. Heck, you could even add RA into the mix to be sent a trigger to ping BTLE once you feel certain there is someone there to figure out WHO is there.
Interesting idea. I think it could work as one of a few inputs for a Bayesian sensor.
I have this CO2 sensor in my living room. I went to bed around 3:30 and got up around 9:30 today. The graph is almost spot on. But might be something else of courseā¦

If youāre really serious about going the thermal route, thereās always the FLIR Lepton modules. They play in a completely differently league from the Omron ones, in terms of resolution (160 x 120 thermal pixels), dynamic range, etc. They can differentiate multiple people without problems, you can even run ML to figure out if the thermal signatures are from humans or pets. But that comes at a priceā¦
I bought one of these some time ago, not for home automation but for measuring thermal insulation quality while I was renovating my house. Theyāre really nice.
Then again, if youāre at that point and really want accurate room presence, you can just put cameras in every room and run some human detection network on their images. They could double as security cameras. If you and your family donāt feel creeped out by cameras everywhereā¦
Seems like cameras in regular rooms and thermal in the rooms where people sleep might be the economical but reliable way to go.
Would it be sufficient to cover single bedroom? Iām looking for solution that doesnāt rely on bt or wifi.
Also, from this review it mentions the detection range seems to be limited to 2 meters?
Frigateās great and all, but it needs some movement for detection to start and Iām not too keen on installing cameras indoors
Has anyone tried one of these? Does it pair with ZHA? If so, what gets exposed?
The range for amg8833 is around 8m. You can try using this code created for the D6T module to detect significant edges. ESPHome D6T Custom Component Ā· GitHub
This discussion is interesting. In my previous home I used simple dual-tech occupancy sensors for all of the downstairs rooms with a reasonably short timeout and I donāt remember the lights ever going out on us unexpectedly (even when sitting still watching TV), so I would expect it to work for the computer use case as well. I guess it might not work for sleeping, but actually combining with a sensor on the bed might be simplest for that.
The dual tech sensors have infrared and ultrasonic sensors in them, and you have to trigger both to start with but it keeps signalling presence as long as just one of them detects you, so smaller movements keep the presence alive.
I actually found this thread searching for which dual tech occupancy sensors would work well with HA. (I was previously using the LOS-CDT-2000 wired ones but that house had a full rewire so I was running cat 6 cables everywhere. Hoping to do it wireless this timeā¦)
Have you been able to improve on this? How well is it working for you lately?
Just as a reminder, since this is often forgotten as an option: For certain spaces where youāre almost always doing something specific, e.g. working on a computer, itās sometimes adequate to detect when that thing is being used. You might use a power monitor/smart plug and turn things on when the power draw is above, say, 30 watts or whatever. Or maybe a script that runs prior to your computer suspending.
My work with the AMG8833 went very nice and I got very good results. But when you arenāt releasing enough heat it struggles, such as wearing a jacket. IMO a good presence should always work with no compromises. I uploaded my work to GitHub for anyone who is interested.
Way back in the 1970ās I was an engineering grad stgudent and we were given an assignment to make a device that would turn the lights off if a room was empty. The asignment required that we somehow counted the numbner of people leaving and entering the room by placing the sensors near the doors. So your idea is more then 40 years old. The instructor told us we would run into unsolvable problems so he would not ecpect perfection. He wouild grade us on our design process.
Here are problems we foundā¦
- A person goes half way into the room and makes a U-turn
- Two ppeople walk in/out at the same time and are counted as one person
- Sensor fails to notice the person, perhaps he is moving too fast or too slow
- Something else you do not find until much later in ther project
- You will need a āzero buttonā so you can reset after miscounts
It doe not work well. Badge readerās are the only good way. Each person puts his ID card in a slot. A door opens and you walk in the door shuts. Then a second door opens and you walk in. While the two doors are closed sensor in thjr fllor meansres weight and checks a database. No laughing I have personally used such a system in a high security system. There were also cameras recording everything. You STILL have the issue of a person using his cardkey then not going in. Hense the scale on the floor.
OK ,back to the real world. It is not hard to fgind a 99% good solution. Use a group of sensors PIR and mmWave. At least two sensors per room. Algorithm: Turn light on if any sensors sees a person. Turn lights off only if none of the sensor see a person for 30 to 40 seconds. Maybe three sensors is enough?
Why not mmWave radar? Just as soon as I get some timew I am going to try an LS2410C and ESPhome. Then I pair it with a Hue motion sensor, If either one detects a person the lights go on. And the lights stay on until BOTH sensors say no one is there. The LD2410 can detect motion as small as breathing and heartbeats. Even if you hide under blankets as the blankets are transparent to microwaves.
Bed sensors work very well. A company called Withings makes one that goes under the matriss and it can detect breathing and heart beats and uses this for sleep quality assessment. But cheaper sensors are sold for car seats to eneable (or not) air bags and thre seatbelt buzzer. They are just an airbladder and a pressure sensor and cost under $10 on Aliexpress. They are cheap because they are mass produced by the millions
Finally, if you are the pperson who wears an Apple watch or always caries a phone there are BlueTooth trackers and they assume that if a BT device just entered the room, it was being carried by a human.
Thanks alot for your response!
Yup the idea is definately not revolutionary and I had the same problems you listed but in the end I did push through and got a very reliable algorithm to track people. Handling multiple people in frame, no matter the ambient temperature with a high enough polling rate that even running at it wouldnāt make it fail. But the Achilles heel was the jacket. The insulation caused it to block too much heat leaving the sensor blind.
My problem with mmwave is just fans. I have a fan in every room in my house and running often as well. I currently have a mmwave (fp2e) in my bedroom and it works well until I turn the fan on which makes it never turn off.
And sometimes me just walking through the hallway with no line of sight to the sensor causes it detect, through the walls.
Also it does fail to detect me when Iām sleeping even though itās right beside me.
Itās perfect when I donāt have my fan on, I can sit at my desk 5m away and it detects me no problem.
If you have any recommendations for other mmwave I should try, please shoot.
I just have this far fetched dream that one sensor can rule them all. So far Iāve got really close but didnāt completely achieve it.
there was a project about using wifi signals to detect presence in your home i havnt dable in it yet but i may ditch my presence sensor for it if its good. as
Ld2410 does kind of work with ceiling fan but you really need to find best place to mount it and really fine tune the static and motion gates until it no longer detects false presence. For example I have 2 ceiling fans in my room and I would mount on the ceiling between the 2 fans.