Open OnlineGuz opened 4 years ago
Another nice thing you can do with two sensors that are in defined (needs to be configurable) sensor distance apart is to measure speed (_distance / (time_2 - time1) ) and object length (_speed x (time_1_off - time_1on)). The same principle is used on roads where they can with induction loops embedded in asphalt measure car count, detect their type based on length and their speed. Would be good to have all these values calculated within this component.
Hello. I also join this request. I built the stair lighting according to this pattern https://www.youtube.com/watch?v=X8vHWPlUJSw and connected it to WLED and its usermods starway wipe and programmed the rest in NodeRED. It is simply not possible to use these sensors because ESPHome does not yet support them as MULTI. I like to get involved and help with testing, etc. I'm learning to program in Python, but I'm at the beginning, so I'm not able to edit this. @OnlineGuz I just want to write that you can't use two buses for ESP8266, because this HW only supports one bus. Therefore, it shows what it shows. If you want to try two buses, you have to use ESP32 and find out which pins the buses are on. I don't know from my head now. Then write feedback whether it then worked.
The cleanest way is to use a GPIO expander as is written in their design sheet, connect XSHUT and GPIO1 (INT will be needed for precise time measurements) and then we can change its address. But it needs to be supported first.
@OnlineGuz I just want to write that you can't use two buses for ESP8266, because this HW only supports one bus. Therefore, it shows what it shows. If you want to try two buses, you have to use ESP32 and find out which pins the buses are on. I don't know from my head now. Then write feedback whether it then worked.
Ok, I thought there was some sort of "Soft I2C" that would allow multiple buses even on 8266. Maybe I will try an ESP32 as soon as have some spare time. Also, the speed stuff is cool, but I'm afraid we would get pretty unreliable results even on a "High Speed Profile". But maybe I'm wrong. @randybb have you already tried some sort of speed measurement using VL53L0X without ESPHome?
I have only one sensor, will order couple more.
Hi since you are owning the VL53L0X sensor are you able to make a final test for the PR: https://github.com/esphome/esphome/pull/1055. This is related to Feature request: https://github.com/esphome/feature-requests/issues/724. I might be able to have a look at your feature request as well... Is there already existing arduino code enabling this feature request for the esp?
I have two TOF sensors (VL53L0X) so if there is something to test please tell me :wink:
Hi, I can test in a week. I have enough sensors. What do you need to test specifically?
Hi since you are owning the VL53L0X sensor are you able to make a final test for the PR: esphome/esphome#1055. This is related to Feature request: #724. I might be able to have a look at your feature request as well... Is there already existing arduino code enabling this feature request for the esp?
Hi, i tested the _longrange feature and I can confirm it works, as in here: https://github.com/esphome/esphome/pull/1055#pullrequestreview-438789029 . With my module I can consistently get measurements up to ~1.25m
Here is a link for a code that uses 2 vl53l0x sensors. Unfortunately it uses the Adafruit library, and not the Pololu one: https://github.com/adafruit/Adafruit_VL53L0X/tree/master/examples/vl53l0x_dual
For those who want to try the pip installation here is the command to install the test version:
pip3 install https://github.com/rspaargaren/esphome/archive/VL53-long-range.zip
and here is the file i tested:
vl_test.zip
Thanks, keep up the good work
I coded a solution to allow for multiple vl53l0x devices on the same i2c bus. I have tested it with two vl53l0x devices on an ESP8266. I could use other testers to help verify its working. I also implemented a timeout as the current sensor code would lock-up the startup in an infinite loop if it was unable to talk to the sensor.
Since all vl53l0x devices default to address 0x29 at power up, it's necessary to connect the XSHUT pin of the vl53l0x to a unique output pin of the ESP so that all vl53l0x devices can be shutdown, then one at a time enabled, so that the address can be changed from 0x29 to whatever address you have assigned. You need 1 output pin on the ESP per vl53l0x device.
Here is the repo/branch with the enhancement: https://github.com/kkellner/esphome/tree/vl53l0x-change-address
This is the configuration tested on an D1Mini (ESP8266). In this example the D7 pin of D1Mini is connected to XSHUT pin of vl53l0x device 1 and the D6 pin of D1Mini is connected to the XSHUT pin of vl53l0x device 2.
Note the new enable_pin
and timeout
conf properties.
sensor:
- platform: vl53l0x
name: "VL53L0x Distance1"
id: distance1
i2c_id: bus_a
address: 0x41
enable_pin: D7
timeout: 500us
update_interval: 2000ms
- platform: vl53l0x
name: "VL53L0x Distance2"
id: distance2
i2c_id: bus_a
address: 0x42
enable_pin: D6
update_interval: 2000ms
i2c:
sda: D1
scl: D2
scan: True
id: bus_a
I just made a little test with the new features, it look like it is working. I'm also using a D1 mini.
The only "issue" I found is when I was using D3 and D4 as enable pins: I think that when the codes wants to use GPIO0 very close to startup it freaks out and doesn't work. I don't know if GPIO0 is not meat to be used but that's it.
Also (maybe I'm wrong) I saw that the timeout defaults to 0ms. Does that mean that in practice the ESP tries to communicate with the sensor only once, or that it continuously tries to find it? Is there an "average" or minimum time that best to use?
I will keep tinkering with it and report any issue if found.
D1mini pins - https://randomnerdtutorials.com/esp8266-pinout-reference-gpios/ D3 - Connected to FLASH button. D4 - Connected to D1Mini LED.
So, this means that when configured for use as an enable pin for vl53l0x -- it will "reset" the D1Mini when it changes D3 state. D4 should work but might be odd since its connected to the on-board LED so I would avoid both of those pins.
As for timeout. The 0us default (no timeout) is the current behavior of the esphome vl53l0x sensor code. This means that it will try indefinitely to talk to the vl53l0x sensor -- which might sound good however this means it will get stuck at startup in the setup method and effectively your esphome will never finish booting (e.g., no WiFi). I would like to make the default something more reasonable but I didn't want to effect the current behavior. In other words, with my updates, if you don't change anything in your yaml (e.g., add the enable_pin or timeout properties), your old code should run exactly as it did before.
@OnlineGuz Where you able to test with multiple vl53l0x sensors?
I just tested multi-vl53l0x support on ESP32 (using same i2c bus) and it looks good. Here is the ESP32 config I used:
sensor:
- platform: vl53l0x
name: "distance1"
id: distance1
i2c_id: bus_a
address: 0x41
enable_pin: GPIO16
timeout: 200us
update_interval: 2000ms
unit_of_measurement: "m"
- platform: vl53l0x
name: "distance2"
id: distance2
i2c_id: bus_a
address: 0x42
enable_pin: GPIO17
timeout: 200us
update_interval: 2000ms
unit_of_measurement: "m"
i2c:
- id: bus_a
sda: GPIO33
scl: GPIO25
scan: True
PR has been submitted for support of multiple vl53l0x sensors on same i2c bus: https://github.com/esphome/esphome/pull/1126
@OnlineGuz Where you able to test with multiple vl53l0x sensors?
The tests I did were with 2 sensors. I have 5 of them, I will try as soon as I can.
Hi, just tested the code with five sensors. When everything is connected and working properly it works just fine (Hurray🥳):
Anyway, if I remove one sensor from the bus (in this example it's Sensor 4), it looks like the code continuously tries to interrogate it, even though the timeout is set to 500us: I don't know if this is normal or it's an issue related to my code.
Also after a short time (no more than 2 minutes) the warnings change: I tried switching the sensors position on my breadboard and that always happens (and always with address 0x41, but sometimes 0x45 appears), so I suppose it's not due to a sensor malfunctioning.
By the way here is the code I used: vl530lx_test.zip
If you need me do to some more tests please let me know.
@OnlineGuz based on some discussion in the PR, I decided to make the default timeout 10ms
vs infinite. I also updated the code to add a missing this->mark_failed();
when the sensor fails setup. This should solve the NACK issue -- if the sensor is not available at startup (i.e., fails setup call), then it will not try to talk with it in the loop()
method to get valid data. Note that if you remove power from the sensor after successful startup, it will continue to get a NACK. If you are using the non-default address -- the NACK will continue to occur even if you restore power to the sensor as the sensor will startup with 0x29 address. The re-addressing of the device(es) only occurs at startup of ESPHome.
Can you try your test again with the latest code? https://github.com/kkellner/esphome/tree/vl53l0x-change-address
Hi, just tested the latest code. I can confirm that NACK issue after setup is solved. One note that doesn't regard the code: I have 2 different models of VL53l0x:
and I saw that the GYVL53L0X models are a little bit slower and unreliable. For example, after a while they both stop answering (I start getting NACKs on theirs addresses). This is an example of what I get: where: Sensor 1 --> address 0x41 --> CJVL53L0XV2 Sensor 2 --> address 0x42 --> CJVL53L0XV2 (not connected - setup failed as expected) Sensor 3 --> address 0x43 --> GYVL53L0X Sensor 4 --> address 0x44 --> GYVL53L0X Sensor 5 --> address 0x45 --> CJVL53L0XV2
Has anyone of you ever experienced this behaviour?
@OnlineGuz have you seen this issue with GYVL53L0X on the old code base with just the single unit? How long does it run before the NACK issue starts?
As far as I can tell there is no V2
of the sensor itself, so I think the V2
refers to the carrier board. I wonder if it has different pull-up resistors.
Also after a short time (no more than 2 minutes) the warnings change: I tried switching the sensors position on my breadboard and that always happens (and always with address 0x41, but sometimes 0x45 appears), so I suppose it's not due to a sensor malfunctioning.
Yeah, I had the same issue here on the old code, I just did not realize it was due to the board until the "NACK issue" was solved. I moved the sensors around to verify that the problem was caused by the board and not the code, that's why the addresses are different in the latest comment. I think that's just caused by a bad circuit that slows down the bus
To be clear, I'm referring to this as GYVL53L0X:
and this as CJVL53L0XV2:
The colours make no difference.
I don't own the Adafruit version, but I'm pretty sure it works just fine. Anyway I would suggest buying an CJVL53L0XV2 over GYVL53L0X, just for empirical reasons...
Hello. I would ask if it is possible for these sensors (I will have 4 used) to send output data only if motion is detected? So somehow set that if the scanning distance changes from 120cm to shorter by more than 20cm, an output signal will be sent. I want to use these sensors to illuminate the stairs and I need the sensors to respond immediately upon detection. If the test time is set, then there will be unnecessarily much data going or I may even miss the pass. My point is to adapt them so that they can work like here in this video https://www.youtube.com/watch?v=X8vHWPlUJSw Thank you for your reply.
Hello. I would ask if it is possible for these sensors (I will have 4 used) to send output data only if motion is detected? So somehow set that if the scanning distance changes from 120cm to shorter by more than 20cm, an output signal will be sent. I want to use these sensors to illuminate the stairs and I need the sensors to respond immediately upon detection. If the test time is set, then there will be unnecessarily much data going or I may even miss the pass. My point is to adapt them so that they can work like here in this video https://www.youtube.com/watch?v=X8vHWPlUJSw Thank you for your reply.
Isn't an internal automation within the esp to trigger Boolean after a value fast enough? You can already program this in the yaml.
Ahoj. Chtěl bych se zeptat, zda je možné, aby tyto senzory (budu mít 4 použité) odesílat výstupní data, pouze pokud je detekován pohyb? Tak nějak nastavte, že pokud se skenovací vzdálenost změní ze 120 cm na kratší o více než 20 cm, bude vyslán výstupní signál. Chci tyto senzory použít k osvětlení schodů a potřebuji, aby senzory reagovaly okamžitě po detekci. Je-li testovací čas nastaven, bude zbytečně mnoho dat, nebo mi může chybět průchod. Mým cílem je přizpůsobit je tak, aby mohli fungovat jako v tomto videu https://www.youtube.com/watch?v=X8vHWPlUJSw Děkujeme za vaši odpověď.
Není interní automatizace v esp ke spuštění Boolean po hodnotě dostatečně rychle? To už můžete naprogramovat v yamlu.
I'm sorry, I probably wrote it wrong because I'm not a programmer. Maybe what I described can be done directly in ESP, but I don't know. However, as it now works, it sends too much data and unnecessarily via WIFI to HA. So if it works out so that I can modify the code in esphome to send only some kind of data, that was nice. Can you please advise me how to achieve this?
@Svrbinek Look at the documentation for internal
https://esphome.io/components/sensor/index.html
Just mark all 4 sensors with internal
then create another binary_sensor
template that just or
them all together. Only the binary_sensor will be visible and sending data to HA and only when the VL53L0X falls within the range of the values specified in your template.
Something like this (untested so syntax may not be quite right):
binary_sensor:
- platform: template
id: detect_on_any_sensor
name: "detect_on_any"
lambda: !lambda |-
return id(distance1).state < 1.0f ||
id(distance2).state < 1.0f ||
id(distance3).state < 1.0f ||
id(distance4).state < 1.0f;
Hi, @Svrbinek take a look at my code if it can help: it does what the image in the first post describes. door_sensor_show.zip
The two sensors analog values (sens_1 and sens_2) are converted into boolean switches (switch_1 and switch_2). The sensors set each switch to 1 when the value is > 70cm and set them to 0 when the value is below 70cm or Out of Range.
The states of the switches are then interpreted by a _statemachine (the scheme is at the top of the code) and the template sensor value is increased or decreased for each person that crosses the door.
Also the code sends an MQTT message when a person finishes crossing the door, and the information is used to turn on a light when a room contains at least 1 person, and off with no person.
As you can see, when I don't want a sensor to show up in the web page or mqtt, I just comment the "name" entry and they automatically become "internal".
Sorry if I was not very clear😅
Hi and thank you all for the answers. I had little time, so I didn't get to it until now. I already have the HW sensors ready and now I need to load the test KOD from github and also the code into ESPHOME. I'm so sorry, but I'm not sure what exactly I should download from github and whether it's stored in the CUSTOM_COMPONENTS folder. Thank you in advance for your willingness to advise. Otherwise, I noticed that the sensors do not show exact distance values but are shifted by 5-10cm.
So I probably have everything uploaded, but when I try to save in ESPHOME, it reports an error, as if he didn't know the new features at all. Where can be the mistake?
The pull request has not been merged into any version of ESPHome yet. https://github.com/esphome/esphome/pull/1126
You need to put the changed files for Vl53l0x into custom_components/vl53l0x
directory to override the default version that does not have the feature.
Here are the files you need: https://github.com/kkellner/esphome/tree/vl53l0x-change-address/esphome/components/vl53l0x
Here is the directory tree as it looks in Home Assistant:
Žádost o vyžádání nebyla dosud sloučena do žádné verze ESPHome. esphome / esphome # 1126
Chcete-
custom_components/vl53l0x
li přepsat výchozí verzi, která tuto funkci nemá, musíte do adresáře umístit změněné soubory pro Vl53l0x .Zde jsou soubory, které potřebujete: https://github.com/kkellner/esphome/tree/vl53l0x-change-address/esphome/components/vl53l0x
Zde je strom adresářů, jak vypadá v domovském pomocníkovi:
Hi, so exactly as you write I have it and anyway in the esphome there is a problem with the fact that he does not know the two new instructions enable_pin: D0 and timeout: 500us I have everything uploaded in custom_components in the right folder, but even after restarting HA, nothing changes. I do not know what I am doing wrong.
Looks like its not finding the correct vl5310x sensor code. From your screenshot above it shows y:\custom_components\vl5310x
, I'm not sure where that is in relation to your esphome install. Are you using Home Assistant's ESPHome add-on? On my HA setup I have the normal config
directory for HA, then the add-on uses esphome
directory. It is under the esphome
directory that the custom_components
should be placed.
Also, I noticed when I update the validation code, I need to refresh the browser window that has the esphome editor in order for the new validation to take effect.
The display you saw was via SAMBA in total commander, now it's straight from HA, but I think it's the way it's supposed to be and you're presenting.
I'm starting to suspect that there will be an error in the name and it is not clear whether it is vl53l0x or vl5310x or v15310x etc.
Nope, you have it in the wrong spot. You have it under \config\custom_components
. That is where "Home Assistant" custom components go. You need it in \config\esphome\custom_components
. Note the "esphome" in the directory tree. That is where esphome
custom components go. As for the correct sensor name... just use the name as it exists in github, which is vl53l0x
(cut and paste is your friend went it comes to ohs vs zeros and L vs ones).
Perfect, it works, all 4 sensors :-) Thanks a lot, I was really worried I didn't notice that there is another option custom_components. So I'm sorry for such clarity and harassment :-) Now I'm going to try to get the sensors to scan the stairs.
dělá to, co popisu
Hi, so now I have the sensors running thanks to kkellner and now I'm going to start how to do what you have in that code, but I'll have a total of 4 sensors. Two will be downstairs and two upstairs, so it should be different. I programmed the logic with NodeRED, so it would be enough for each sensor to send information only when someone enters the stairs or leaves them. I'll take a look at it tomorrow, maybe it will work.
Hi, so I started working on it. Your kkellner code for a binary sensor works quite well, I just adjust it for each sensor separately. But I have a little problem with two things.
When reduced to 50ms, the ESP8266 has already bitten. Probably not running wifi or memory.
I don't know if it's described clearly, but I'll add a description of what I want and ask if it's possible to do it somehow.
So there are a total of 4 sensors. 2 sensors on the stairs at the bottom and 2 at the top. Both pairs will be close together, only a few cm. This is so that it is possible to detect the direction of movement on the stairs and thus count the number of people on the stairs. I have already programmed it in nodered. Well, I need data from those sensors to go to HA only if someone passes. The staircase is about 120 cm long, so if the distance is below 1m so as to send from what sensor it was. Now I have reached the update interval of 250ms, but I also consider it insufficient, because with a very fast run on the stairs, the foot may miss this interval and it would all be poorly detected and automated. So I would need the sensors to monitor it continuously, ideally online or with 1ms but the data is only sent if the condition is met and the distance decreases below 1m
Done :-)
@Svrbinek: Does "Done" mean you have a solution?
Based on the datasheet https://www.st.com/resource/en/datasheet/vl53l0x.pdf it looks like it takes 23ms to perform a mensurement -- so I wouldn't expect you to be able to go any faster then that for updates.
Also, in my experimenting, I found the esp8266 could not keep up with 4 sensors. The symptom that it couldn't keep up was that Home Assistant would show the esp8266 as unavailable at least once every hour for a few seconds to a minute. I've tested esp32 with 4 sensors and it works fine -- as the esp32 is much faster then esp8266.
As for updates -- mark all your vl53l0x sensors as internal so it doesn't send any network traffic on changes, then create a template sensor that detects what you want to send to HA.
Something like this
...
- platform: vl53l0x
id: distance1
name: "${friendly_name} distance1"
internal: true
i2c_id: bus_a
address: 0x41
enable_pin: D7
update_interval: 300ms
unit_of_measurement: "m"
filters:
- lambda: if (isnan(x) || x > 1.1) { return 9999.0; } return x;
on_value:
then:
- lambda: |-
if (id(distance1).state > 0.1 && id(distance1).state < id(1.0)) {
id(detect1) = true;
} else {
id(detect1) = false;
}
... (other vl53l0x sensors)
- platform: template
id: detect_any_sensor
name: "${friendly_name} detect_any"
lambda: !lambda |-
return id(detect1) || id(detect2) || id(detect3) || || id(detect4);
Yes, I meant that I managed to get it in a bit functional condition. There is a bit of a problem with the fact that the sensor sometimes makes a fake signal on the sensor in the reflection, but I partially eliminated this in the delay off code with the filter. I still have the code created in nodered and when testing with real sensors it sometimes behaves strangely. I use a WLED system with 900 LED lights (15m). ESP8266 I use with 4MB memory. When set to 50ms it was unusable, but then I tried to set the internal sensor as you type. Despite that, the problem was probably with flooded memory, so I changed the LOG from debugs to INFO and then it went great. I enclose my code. If it is not optimized (I am not a pro), feel free to write what can be improved. Otherwise, in case of interest, I can also send FLOW from NodeRED
i2c:
- id: bus_a
sda: D2
scl: D1
scan: True
sensor:
- platform: vl53l0x
name: "Sensor 1"
id: sens_1
i2c_id: bus_a
address: 0x41
update_interval: 50ms
enable_pin: D0
timeout: 500us
internal: true
- platform: vl53l0x
name: "Sensor 2"
id: sens_2
i2c_id: bus_a
address: 0x42
update_interval: 50ms
enable_pin: D5
timeout: 500us
internal: true
- platform: vl53l0x
name: "Sensor 3"
id: sens_3
i2c_id: bus_a
address: 0x43
update_interval: 50ms
enable_pin: D6
timeout: 500us
internal: true
- platform: vl53l0x
name: "Sensor 4"
id: sens_4
i2c_id: bus_a
address: 0x44
update_interval: 50ms
enable_pin: D7
timeout: 500us
internal: true
binary_sensor:
- platform: template
id: detect_on_any_sensor1
name: "detect_on_any1"
filters:
- delayed_off: 100ms
lambda: !lambda |-
return id(sens_1).state < 1.0f;
- platform: template
id: detect_on_any_sensor2
name: "detect_on_any2"
filters:
- delayed_off: 100ms
lambda: !lambda |-
return id(sens_2).state < 1.0f;
- platform: template
id: detect_on_any_sensor3
name: "detect_on_any3"
filters:
- delayed_off: 100ms
lambda: !lambda |-
return id(sens_3).state < 1.0f;
- platform: template
id: detect_on_any_sensor4
name: "detect_on_any4"
filters:
- delayed_off: 100ms
lambda: !lambda |-
return id(sens_4).state < 1.0f;
Does anyone please have experience with VL53L1X esphome sensors? Now two of them came to me I would try them. They have a faster sampling frequency and better resistance to UV interference. The VL53L0X switched on me in the house during the day, when the UV penetrated through the blinds into the room. But there were no direct sunbeams, only white light through the white blinds.
Does anyone please have experience with VL53L1X esphome sensors? Now two of them came to me I would try them. They have a faster sampling frequency and better resistance to UV interference. The VL53L0X switched on me in the house during the day, when the UV penetrated through the blinds into the room. But there were no direct sunbeams, only white light through the white blinds.
I just started my very first ESPHome custom component with software to count the number of people in a room. I also ordered a set of VL53L1X. Here's the repo https://github.com/DutchDeffy/esphome_custom_component_VL53L1X_people_counter
@DutchDeffy FYI, this will work for your project, but it's not the correct way to handle i2c devices within ESPHome... You are using the SparkFun library to handle your i2c communication. That would directly conflict with ESPHome's i2c implementation. ESPHome must "own" the i2c bus.
As long as you are not using ESPHome's i2c implementation, then your solution will work, but that is a no-go for most of us and would not be accepted as a pull-request for ESPHome.
@kkellner Thank you for pointing that out. Does that mean I would have to handle the i2c implementation comparable to the way it is done in this custom component? https://gist.github.com/mKeRix/4fc553574af0a2d8682734695160b859 Or does that require to integrate/rewrite the complete SparkFun library in a way that won't conflict with ESPHome's i2c implementation?
Edit* I just saw PR #1447 and that @mampfes is already busy developing a component for this sensor. If it gets reviewed and merged the people counting part could then just be another function of the component.
@DutchDeffy That one doesn't look correct either. Your class should use i2c::I2CDevice
. Best example would be to look at https://github.com/esphome/esphome/tree/dev/esphome/components/vl53l0x or any of the i2c based components in https://github.com/esphome/esphome/tree/dev/esphome/components (e.g., ina219, sht3xd, etc)
Allright, despite it's the incorrect way of approaching this if it's ever to be merged to esphome. I will just try it out this way and see if I can get something working. Then, if I have more time on my hands, I might take a look at doing it the proper way.
Hi, so I'm writing after a long time. I already have the sensors and stairs done as I wished. Only one thing is a bit of a problem with the sensor. Because the two sensors are close to each other, it happens that during the passage I sometimes catch the second sensor earlier than the first, so that the stairs do not light up. This is because each sensor has its own timed scan frequency. It can also be seen on the IR camera, when it can be seen that the transmission beam of the two sensors is not synchronized but they flash differently. Therefore, it can happen that when I walk under the sensor, it is not in the cycle when he does not scan, but he scans the other and sees me earlier. Therefore, I would like to know if this could be somehow synchronized so that all sensors have the frequency timed the same. I have the scanning frequency set to 80ms. The solution could really be to use matrix sensors, ie the VL53L1X. Some solution?
Here's an example of when it's working properly. https://youtu.be/pwD6eQRIH3A
So far, I am testing 2 sensors (detection of the passage to the kitchen). For now, I have them on separate nodemcu boards. How do you solve the counting of people? I used a counter in HA, but if it happens that the sensor skips, the logic stops and it is necessary to reset the counter manually.
I don't think you are using the correct sensor for your binary needs -- you are trying to detect if an object (person) passed by. The VL53L0X is a distance measurement sensor which has minimum timing requirements to get that reading. A fast moving person at the right time would not detect this. You need an IR beam break type solution. Once such solution is below.
https://www.inspectmygadgets.com/ir-beam-break-sensors-with-tasmota-and-home-assistant/
You can use ESPHome's binary sensor with the above (or any beam breaking sensor): https://esphome.io/components/binary_sensor/index.html
For a "one sided" solution (where you don't need a transmitter and receiver side) that are also many options.
Example: https://www.amazon.com/dp/B0753Z5R3W
I have a VL53L0X + STM32 sensor, but I can't get it to work. The STM32 chip on this sensor may not be supported in ESP home. Is there a solution? Thank you
@pepe59 STM32 provides UART (RX, TX) interface to the VL53L0X, so just ignore it and use only I2C (SDA, SCL) that is being supported.
Describe the problem you have/What new integration you would like
I would like to support 2 or more VL53L0X sensors
Please describe your use case for this integration and alternatives you've tried:
There might be two way to do this:
Additional context
VL53L0X is not necessarily very precise but I see it is often used as a presence sensor or beam break sensor alternative. I want to use two of them to make a "door direction sensor" (please have mercy, I don't know how they are called XD). Here is a "high quality" picture to explain what I want to do: after a person crosses the two sensors in one direction a message is sent to Home Assistant (or any automation hub) to notify that a person has "changed room".
This is my yaml: I made so that the sensor value is saved in a template sensor as a binary value. Sometimes the VL53L0X reads "0": in that case the lambda function does not update the value (I had issues with return {};)
Thanks for all your great work! ;)