EverythingSmartHome / everything-presence-lite

Everything Presence Lite
116 stars 43 forks source link

Various occupancy detection issues #138

Open clintebbesen opened 4 weeks ago

clintebbesen commented 4 weeks ago

Hi,

I've been having a lot of issues with detection. I am having constant issues across 4 sensors where occupancy is both on when it shouldn't be, and off when it should be on. When occupancy is on, I can usually see a conflict of entities and see the issue.

  1. As per the image below, Occupancy is showing as Detected, however there is no one in the room, no motion. Zone 2 shows occupancy on, count of 1, however targets 1, 2, 3 active are all off.
  2. Sometimes occupancy will be detected falsely, and when doing so the Target Y is 0. I set the zone 1 start Y to 10, which has fixed this issue, but thought id report it.
  3. if I leave the detection zone without the sensor seeing me move out of range, this fairly reliably causes the sensor to say presence is detected for anywhere from about 30 seconds to a few minutes or sometimes even longer. In some cases I could fix this by decreasing the max distance, but not all. my bathroom and kitchen are two examples. In the bathroom, the sensor is in the corner of the bottom left of the room, the doorway is in the bottom right. see the second image for a rough sketch of the room, sensor location, door, and my path walking. When I walk from the lounge into the bathroom the sensor triggers outside the bathroom in the hallway when im in line of sight to the sensor, when I walk back to the lounge, at this point im still within the 6m range of the sensor (sensor was set to about 3.5m), but as I walk out to the lounge I disappear behind the wall. same issue with the sensor in the kitchen when I walk to the right of the sensor past its range of motion, not past its max distance. The issue seems to be, if you leave line of sight of the sensor while your distance to the sensor is less than the configured max distance, then the sensor stays occupied for some time, anywhere from 30s to minutes or more in rare cases. To fix the bathroom sensor, I changed the max distance down to 3m, the width of the room so that as I walk out the door into the hallway, before I turn the corner and get out of line of sight of the sensor, I first cross the max distance, turning off occupancy, then I turn the corner to the lounge leaving line of sight and everything works. This however isnt a solution as it doesnt fix the kitchen sensor when I leave the room to the side past the max angle the sensor can see to the side, and with the bathroom sensor, I do want the sensor to see into the hallway so when im in the hall looking in the hallway cupboard, the bathroom light will be on providing light to the hallway.
  4. Occupancy on, zone 1 occupancy on, but zone 1 targets 0, when there is no one in the room and occupancy should be off. the targets of 0 is correct, but occupancy is on for some reason, walking in and out of the room generally fixes it.
  5. I cant remember the other cases, but there has been many cases like the last one above where its not working as expected, I look at the sensor page and see conflicts between the entities, I was thinking for a short time I could create new occupancy template sensors in home assistant which check for occupancy of each of the zones, while the target count of the zones is greater than 0, and either target 1, 2, or 3 active is on. but thought id report the issues here instead and hope someone else has had the issues and can help fix it rather than me making tacky fixes in HA for it.

Thank you for your help! I love the idea, but so far have been spending way too many hours trying to get everything working (probably 30+ hours tweaking them and working out work arounds to get them being more reliable), but tonight its run into significant issues and the house is in darkness with only 1 of the 4 working at all. im working through whats going on and hoping to get them fixed soon.

image for point 1: image

image for point 3. Sensor is in corner of bathroom at bottom left, doorway is bottom right of room. IMG_0417

clintebbesen commented 4 weeks ago

I found an example of point 2 I mentioned in my original post. Currently there is no one in my bathroom, however zone 2 occupancy is showing as Detected. Overall occupancy is clear, which contradict each other. Target 1 Active is on, and the target 1 distance is 0 mm. I realised now I haven't set this sensor to have a Y start of 10 like my other sensors which mitigates this issue.

However it is a bit odd that Target 1 is on, but has 0's for all values, Target 2 is off, but does have values for angle, distance, and resolution.

Also another issue I spotted is that Zone 2 occupancy is Detected, while target count is 0, and Zone 3 target count is 1, but occupancy is clear.

This is an example of the odd things ive been seeing which makes me think of creating helpers that check everything and only show presence if target count is greater than 0, while zone occupancy is detected and overall occupancy is detected and the target that is active must have values for angle, distance and resolution.

image image

clintebbesen commented 4 weeks ago

After writing this and getting the screenshots I pressed the ESP reboot button on the sensor page in home assistant to reboot it fixing the issue, and that gave me the idea to maybe add an automation so that is values are conflicting, then reboot the sensor, that could be another temp fix until the root cause is found

clintebbesen commented 4 weeks ago

20 mins later I noticed the Bathroom lights on again. This time when checking the sensor, occupancy is off so I am unsure why the lights are on, but I did notice some issues in the entities.

occupancy is clear overall and in each of the 3 zones, however target 1 active is on, and zone 3 target count is 1.

None of the values for target 1 are changing, including the speed which is at 0.08m/s. I clicked on speed, and it shows it was last updated 9 minutes ago, and I can see in the history, there was a time this morning where the speed was the same value for 1 hour, and earlier this evening the same value for 2 hours. looking at the history the day before there was also two times where the speed has a stuck value for an hour each time. Id imagine if the distance, x or y values aren't changing the speed cant be anything other than 0 m/s

image image

clintebbesen commented 4 weeks ago

This is from my kitchen sensor, no one is in the kitchen, occupancy is off as expected for overall and each zone, however target 2 active is on with values populated, including speed which has been hanging with the same value for the last 14 minutes, and this afternoon had a value for 5 hours straight

image image

bazcurtis commented 3 weeks ago

I am finding the EPL very sensitive. Walking up the stairs which are next to the room with the EPL will trigger presence in the room. I have had to revert back to the Sonoff as that is more stable. I have to be honest, I am having trouble mapping the room. The x and y values jump about a bit when I try and map them. I am not sure which value to use.

Does the resolution change the sensors sensitivity?

clintebbesen commented 2 weeks ago

Hi,

I am still having continual issues to the point I only have 2 of the 7 presence sensors with automations enabled, the other 5 are sitting idle doing nothing. the 2 that are on work about 60-80% of the time, enough that I have kept them on.

Below is another issue, All occupancies are off, target 1, 2, 3 Active are off, but its clearly tracking me as I step left and right the target 1 angle changes following me, and the distance, x, y, etc all change as usual. When I stepped into a different zone in that room, then the occupancy came on, but soon after going back to that first zone the occupancy went back to off, while still tracking me. I turned the sensor off and on at the wall, but it still had an issue.

IMG_0549

EverythingSmartHome commented 2 weeks ago

Thanks for all the details, I will take a close look soon.

As a first step, can you try the non Bluetooth proxy version of the firmware? I wonder if some of the issues your seeing correspond with a WiFi drop which can be cause by Bluetooth proxy. Would be good to rule that out

EverythingSmartHome commented 2 weeks ago

I am finding the EPL very sensitive. Walking up the stairs which are next to the room with the EPL will trigger presence in the room. I have had to revert back to the Sonoff as that is more stable. I have to be honest, I am having trouble mapping the room. The x and y values jump about a bit when I try and map them. I am not sure which value to use.

Does the resolution change the sensors sensitivity?

This is expected since sensors can see through walls. In this instance, you would set the max distance of the device to limit it to the size of the room so that it does not see the stairs.

X and Y values will natural change, roughly +/- 30cm. That's for two main reasons:

  1. It's impossible to stand perfectly still
  2. Mostly because the sensor does it's best to latch on to the middle of a targets movement which can change continuously even when trying to stand very still. For example, if you stand still breathing, it may see your chest moving with a breath, but then after it sees your hand move a little bit or a head tilt. There is distance between all of these moving parts and the sensor is doing it's best to centre the source of movement. That's an extremely rudimentary example but hope it makes sense.

To use the coordinates, they don't need to be exact to the mm - remember that if you see for example a change of 200mm, that may look huge but in reality its only 20cm which when talking about the size of a room is really very small. Just use an approximation and then dial it in from there

EverythingSmartHome commented 2 weeks ago

@clintebbesen I also wonder if on top of changing to the non bluetooth version of the firmware, if you can add a 10mm gap in between the zone definitions? So for example, you have zone 2 starting at -4000 to -600 on X and 1900 to 3600 on Y. Then zone 3 starts at -600 to 4000 on X and 1900 to 3600 on Y. Could you try change the X on zone 3 to -590 to 4000 therefor creating a 10mm gap between zones?

Do the same with any zones that technically "overlap" - perhaps there is a slight edgecase there.

bazcurtis commented 2 weeks ago

I am finding the EPL very sensitive. Walking up the stairs which are next to the room with the EPL will trigger presence in the room. I have had to revert back to the Sonoff as that is more stable. I have to be honest, I am having trouble mapping the room. The x and y values jump about a bit when I try and map them. I am not sure which value to use. Does the resolution change the sensors sensitivity?

This is expected since sensors can see through walls. In this instance, you would set the max distance of the device to limit it to the size of the room so that it does not see the stairs.

X and Y values will natural change, roughly +/- 30cm. That's for two main reasons:

  1. It's impossible to stand perfectly still
  2. Mostly because the sensor does it's best to latch on to the middle of a targets movement which can change continuously even when trying to stand very still. For example, if you stand still breathing, it may see your chest moving with a breath, but then after it sees your hand move a little bit or a head tilt. There is distance between all of these moving parts and the sensor is doing it's best to centre the source of movement. That's an extremely rudimentary example but hope it makes sense.

To use the coordinates, they don't need to be exact to the mm - remember that if you see for example a change of 200mm, that may look huge but in reality its only 20cm which when talking about the size of a room is really very small. Just use an approximation and then dial it in from there

Thank you, that is very helpful. The stairs are to the right of the EPL. If I measure from the EPL to the wall, which value would I change?

bazcurtis commented 6 days ago

Yesterday I managed to catch the stairs being triggered. This is what I am seeing. I thought I had cracked it, but it is still triggering.

The EPL is where the floor map says 25c and the door is in the top right hand corner. This is about 250cm away. The stairs are to the right of the sensor.

The stairs are at least 80cm to the right. I assume -500mm would exclude that? Any ideas would be greatly appreciated.

Screenshot 2024-09-08 at 16 17 33 Screenshot 2024-09-08 at 16 17 46 Screenshot 2024-09-08 at 16 17 56 Screenshot 2024-09-08 at 16 18 20 Screenshot 2024-09-08 at 16 29 48
EverythingSmartHome commented 5 days ago

It might not necessarily be -500mm because that would assume that the target is picked up in an exact straight line to the stairs. The best way would be to stand on the stairs and use your phone to check the coordinates of the target it is detecting, then use those coordinates to check your zone config.

bazcurtis commented 5 days ago

This is what I saw when I did that. The above sensors were also from the stairs.

IMG_1504