People counter passing through a door using VL53L0X or VL53L1X

I have come to the conclusion that some part of the code causes these problems.
I have many esp nodes, doing several things.

None, has a single problem …
The People Counter node never worked really …

Apart the light interferences (which I can understand) the node get very often UNAVAILABLE at HA

Have you tried my cardboard approach?

Nope because as soon as I deactivated the half of the sensors (I only kept the people counter to be honest) all the problems solved.

Hi to all of you, and big thanks for sharing experience and knowledge!

I have few questions regarding this system, i ran on to issue when used sensor on entrance door (inside placed). Sun was directly shining at door and door have part of glass… On the logs in the esphome it was many false entry and exit.
Is there something that could help to use sensor in this scenario?
Also, how and where to modify max people count (current is 10). I saw it was set up at this line, but this is on git hub (is there a way to modify it localy):
cv.Optional(CONF_MAX_VALUE, 10): cv.int_range(1, 255),

Big thanks to you all, again!

It os known that this sensors don’t work well under direct sunlight, you will need to move your sensor to a better position.

I don’t know the answer for the the max people count question. You may have to ask on the GitHub Page

I use your code and it still works perfectly. Sometimes he counts more than once, especially in daylight. I can’t figure out how to reset the counter in esp to 0. Don’t you have a solution to reset, for example as a counter reset service? Thank you very much.

Hi, do you have any other pictures of the case that you made for the door frame? It looks very good. Is the case open at the back of the sensor, or is it sealed with just a hole for the wires? I’ve got a vl53l1x that I’m planning on using but can’t find a suitable case for holding/mounting it. Thanks

Yeah, I have this one…

It is open on the back but tight enough to prevent the sensor from moving around.

Ah I see, thanks for the picture! Hopefully I can come up with something similar.

Hi @SebaVT If your start all over again should you go (again) for the VL53L1X or is a camera with Opencv people counter script a more reliable solution (if you don’t look at the price difference)?

I also want to use it in the dark.

Thanks in advance.

Hi @rvdbrink, I’ll still use the VL53L1X sensor. It’s been working very good and it won’t depend on the lighting conditions (unless there is direct sunlight). Also the wife acceptance factor would not let me install a camera indoors.

1 Like

Even after 2 years, this was a big time saver. I actually would had never come to the zone idea process on my own. Thanks for the yaml work!

Hi to everyone I’m trying to figure out the same goal with two HC-SR501, could anyone help me?

[Deleted because the answer button didn’t work]

Yes, I did something similar a while ago.
Here’s a snippet of my code:

number:
  - platform: template
    id: count
    name: People in Room Counter - PIR
    min_value: 0
    max_value: 10
    step: 1
    optimistic: true
binary_sensor:
  - platform: gpio
    pin:
      inverted: true
      number: 26
      mode:
        input: true
        pullup: true
    name: sensor inside
    filters:
      - delayed_off: 40ms
    
    on_release:
      - if:
          condition:  
            - script.is_running: entryScript
          then:
            - script.stop: entryScript
            - script.stop: exitScript
            - logger.log: ENTRY detected
            - number.increment:
                id: count
                cycle: false
          else:
            - script.execute: exitScript
  - platform: gpio
    pin:
      inverted: true
      number: 32
      mode:
        input: true
        pullup: true
    name: sensor outside
    filters:
      - delayed_off: 40ms
    on_release:
      - if:
          condition:  
            - script.is_running: exitScript
          then:
            - script.stop: entryScript
            - script.stop: exitScript
            - logger.log: EXIT DETECTED
            - number.decrement:
                id: count
                cycle: false
          else:
            - script.execute: entryScript


script:
  - id: exitScript
    mode: restart
    then:
      - script.stop: entryScript
      - delay: 10s
  - id: entryScript
    mode: restart
    then:
      - script.stop: exitScript
      - delay: 10s

Wonderful, thanks!

I love your setup. This is exactly what I hope to achieve. Thanks for the files!
I’m just a little confused on what is going on with the part that looks similar to a light switch? I’m assuming that’s where you have the d1 mini. But, it looks like you have additional sensors on it. What are they? How are you using them? Lastly, I’m curious how you are powering them inside the wall? Did you take over an electrical box, or did you add one?

Hello there!

Those additional sensors are for other purposes, nothing related with the people counter. They are just to measure the temperature, humidity and light intensity of the room.

I took over the existing wall switch and used an HLK-PM01 power supply to power all the devices and enclose it on a 3D printed case that match the decora wall plate.