The best way to detect occupancy is to have a sensor grid of many kinds, all working together.
PIR, Radar, Thermal, CO2, Laptop use + RSSI, Vibration, Acoustic, Door/Window sensors, Computer vision, Bluetooth tracking, etc
Combine that with a variety of “obvious” override states, such as:
Alarm system armed away = nobody is home
Mobile device locations = if one is “away”… they to do not need to be accounted for
Certain button presses = my bed has 2 identical light control buttons on each side for me and my wife, if the door is closed, and I press a button (on my remote), and the door does NOT open, then I am for sure in that room until at least the next time the door is opened
You can also aggregate rooms depending on house geometry, for example combine livingroom and kitchen so as people move between them there is no complex logic involved, or you can treat certain rooms as “ephemeral” like the bathroom, so it only reports as “occupied” but your person state is still in the previous location.
My laptop RSSI will tell for sure if it is either in the living room or my office which are the only 2 locations it would be
For CO2, you are looking at trends and levels, if someone has been in a room and the level stabilizes, it will invariably go down when they leave, and if it is trending up (but other rooms are not) then the room is most likely occupied… unless there is a change in ventilation which will cause it to tank. How breezy it is outside can have a massive contribution to CO2 levels if a window is even slightly opened.
If you have your HVAC fan on all the time it will also cycle air out of an occupied room, but not too much that it renders air monitoring useless. An occupied common area like a living room can stabilize at about 1000ppm even with continuous ventilation, depending on how “leaky” your house is.
A quality device will adjust for temperature and humidity automatically, and usually autocalbrate unless the conditions are not suitable, like a poorly ventilated space that is never unoccupied
Here is my livingroom CO2 sensor levels for today once people were up, which happened to be a rather blustery day. At 2:27p a door was opened for ventilation, at 2:50 it was closed since we were in the process of getting ready to leave, at 3p we drove away, 1 person got back at 4:20p, another at 4:50p. You can see almost every single event on the graph, but it is hard to interpret without additional data and context.
This is a week’s worth, you can see it tank at times, due to ventilation, and you can see some nights it hovers around 500ppm, a window is most likely open, you can see exactly when I closed it at around 3am on the 21st as it starts to trend up to baseline.