Sure. I had it in my earlier posting as well, but a bit hidden (all the way at the bottom).
This is the relevant part
sensor:
- platform: vl53l0x
name: "VL53L0x1"
id: distance1
address: 0x41
enable_pin: 19
long_range: true
timeout: 200us
update_interval: 500ms
unit_of_measurement: "m"
- platform: vl53l0x
name: "VL53L0x2"
id: distance2
address: 0x42
enable_pin: 17
long_range: true
timeout: 200us
update_interval: 500ms
unit_of_measurement: "m"
i2c:
sda: 21
scl: 22
scan: true
id: myi2c
I understand it this way: default is 0x29
; each sensor that gets an enable_pin
automatically gets assigned the address specified for it. And this must have worked for VL530x1
, because it does display the correct value (or so I hope; at least it shows different values when moving the sensor closer/further). So it must have either been assigned address 0x41, or it must have ignored address: 0x41
and still communicated with it via 0x29
(which is a possibility, but I really doubt it).
So then the second sensor should work just the same, as it is configured identically to the first, only changing address and enable_pin.
Last resort would be using an arduino for the TOF sensors that communicates the read values to the ESPHome device, which then forwards them to Home Assistant. However, while it’s been on my list to learn how to do this (arduino to esphome) for a while, I’d like to avoid it for this project, if possible.
Update
Now I re-wired it, sorry, the photo is still bad. Wires make it hard to see the connections…
The output I get is now this
[11:31:22][I][app:029]: Running through setup()...
[11:31:22][I][i2c.arduino:183]: Performing I2C bus recovery
[11:31:22][D][vl53l0x:034]: 'VL53L0x1' - setup BEGIN
[11:31:23][D][vl53l0x:258]: 'VL53L0x1' - setup END
[11:31:23][D][vl53l0x:034]: 'VL53L0x2' - setup BEGIN
[11:31:23][D][vl53l0x:258]: 'VL53L0x2' - setup END
[11:31:23][C][esp32_ble:027]: Setting up BLE...
ERROR Serial port closed!
So the device seems to set up the second sensors without error this time (before, it broke after trying to set it up, see output from previous post); now the setup works, but as soon as BLE starts, it closes the serial port so I cannot debug any further.
Both sensors are visibile in Home Assistant now. However, #1 keeps toggling between some value and unknown
, #2 is at around 1.6m (which ought to be right, guessing the distance between my desk and ceiling). The first sensor jumps between unknown
and 0.27
- 0.28
m, which cannot be right as they both point at the ceiling.
I switched to my active USB hub for powering the device (perhaps the PCs USB port was too weak), but now I don’t have serial debugging any longer. Also, without changing any wiring except the USB connection, now it won’t connect via wifi, so I cannot debug at all. This is weird!