esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
290 stars 36 forks source link

VL53L0X hangs while waiting for interrupt #4183

Open troelde opened 1 year ago

troelde commented 1 year ago

The problem

The sensor works fine for distances within its max range. But with every configuration I have tried including those here https://www.esphome.io/components/sensor/vl53l0x.html, the sensor often runs into a state waiting for interrupt often when distance is out of range. The log says: Warning in log: "_update called before prior reading complete - initiated:0 waiting_forinterrupt:1". It is impossible to recover without rebooting device.

The sensor state is set to unknown, the same as if distance is out of range. Therefore impossible to detect if sensor actually has stopped working or distance out of range.

Which version of ESPHome has the issue?

2023.2.1

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

2023.2.5

What platform are you using?

ESP8266

Board

Wemos D1 Mini compatible

Component causing the issue

VL53L0X Time Of Flight Distance Sensor

Example YAML snippet

No response

Anything in the logs that might be useful for us?

From log:
[18:25:05][I][app:102]: ESPHome version 2023.2.1 compiled on Feb 16 2023, 18:21:20
[18:25:05][C][wifi:504]: WiFi:
[18:25:05][C][wifi:362]:   Local MAC: 48:55:19:C8:9D:50
[18:25:05][C][wifi:363]:   SSID: 'Telenor6617tog'[redacted]
[18:25:05][C][wifi:364]:   IP Address: 10.0.0.6
[18:25:05][C][wifi:365]:   BSSID: 90:F8:91:ED:62:80[redacted]
[18:25:05][C][wifi:367]:   Hostname: 'garasjeport-20c-distanse'
[18:25:05][C][wifi:369]:   Signal strength: -53 dB ▂▄▆█
[18:25:05][C][wifi:373]:   Channel: 1
[18:25:05][C][wifi:374]:   Subnet: 255.255.255.0
[18:25:05][C][wifi:375]:   Gateway: 10.0.0.138
[18:25:05][C][wifi:376]:   DNS1: 148.122.164.253
[18:25:05][C][wifi:377]:   DNS2: 148.122.16.253
[18:25:06][C][logger:293]: Logger:
[18:25:06][C][logger:294]:   Level: DEBUG
[18:25:06][C][logger:295]:   Log Baud Rate: 115200
[18:25:06][C][logger:296]:   Hardware UART: UART0
[18:25:06][C][i2c.arduino:052]: I2C Bus:
[18:25:06][C][i2c.arduino:053]:   SDA Pin: GPIO4
[18:25:06][C][i2c.arduino:054]:   SCL Pin: GPIO5
[18:25:06][C][i2c.arduino:055]:   Frequency: 50000 Hz
[18:25:06][C][i2c.arduino:058]:   Recovery: bus successfully recovered
[18:25:06][I][i2c.arduino:068]: Results from i2c bus scan:
[18:25:06][I][i2c.arduino:074]: Found i2c device at address 0x29
[18:25:06][C][template.cover:071]: Template Cover 'Garasjeport 20C'
[18:25:06][C][template.cover:071]:   Device Class: 'garage'
[18:25:06][C][vl53l0x:024]: VL53L0X 'Distansemåler garasjeport 20C'
[18:25:06][C][vl53l0x:024]:   State Class: 'measurement'
[18:25:06][C][vl53l0x:024]:   Unit of Measurement: 'm'
[18:25:06][C][vl53l0x:024]:   Accuracy Decimals: 2
[18:25:06][C][vl53l0x:024]:   Icon: 'mdi:arrow-expand-vertical'
[18:25:06][C][vl53l0x:025]:   Update Interval: 0.5s
[18:25:06][C][vl53l0x:026]:   Address: 0x29
[18:25:06][C][vl53l0x:030]:   Timeout: 200us
[18:25:06][C][restart:076]: Restart Switch 'Omstart garasjeport 20C'
[18:25:06][C][restart:078]:   Icon: 'mdi:restart'
[18:25:06][C][restart:098]:   Restore Mode: restore defaults to OFF
[18:25:06][C][captive_portal:088]: Captive Portal:
[18:25:06][C][mdns:108]: mDNS:
[18:25:06][C][mdns:109]:   Hostname: garasjeport-20c-distanse
[18:25:06][C][ota:093]: Over-The-Air Updates:
[18:25:06][C][ota:094]:   Address: garasjeport-20c-distanse.local:8266
[18:25:06][C][ota:097]:   Using Password.
[18:25:06][D][sensor:126]: 'Distansemåler garasjeport 20C': Sending state nan m with 2 decimals of accuracy
[18:25:06][W][vl53l0x:265]: Distansemåler garasjeport 20C - update called before prior reading complete - initiated:0 waiting_for_interrupt:1
[18:25:06][C][api:138]: API Server:
[18:25:06][C][api:139]:   Address: garasjeport-20c-distanse.local:6053
[18:25:06][C][api:141]:   Using noise encryption: YES
[18:25:06][D][sensor:126]: 'Distansemåler garasjeport 20C': Sending state nan m with 2 decimals of accuracy
[18:25:06][W][vl53l0x:265]: Distansemåler garasjeport 20C - update called before prior reading complete - initiated:0 waiting_for_interrupt:1
[18:25:07][D][api:102]: Accepted 10.0.0.38
[18:25:07][W][api.connection:083]: Home Assistant 2023.2.5 (10.0.0.38): Connection closed
[18:25:07][D][sensor:126]: 'Distansemåler garasjeport 20C': Sending state nan m with 2 decimals of accuracy
[18:25:07][W][vl53l0x:265]: Distansemåler garasjeport 20C - update called before prior reading complete - initiated:0 waiting_for_interrupt:1
[18:25:07][D][api.connection:918]: Home Assistant 2023.2.5 (10.0.0.38): Connected successfully
[18:25:07][D][sensor:126]: 'Distansemåler garasjeport 20C': Sending state nan m with 2 decimals of accuracy
[18:25:07][W][vl53l0x:265]: Distansemåler garasjeport 20C - update called before prior reading complete - initiated:0 waiting_for_interrupt:1
[18:25:07][D][api:102]: Accepted 10.0.0.38
[18:25:09][W][api.connection:083]: Home Assistant 2023.2.5 (10.0.0.38): Connection closed
[18:25:09][D][sensor:126]: 'Distansemåler garasjeport 20C': Sending state nan m with 2 decimals of accuracy
[18:25:09][W][vl53l0x:265]: Distansemåler garasjeport 20C - update called before prior reading complete - initiated:0 waiting_for_interrupt:1

Additional information

No response

pruwait commented 1 year ago

same problem

[vl53l0x:265]: Sensor 1 - update called before prior reading complete - initiated:0 waiting_for_interrupt:1

increase update_interval: 200ms and timeout to 500ms

wr420 commented 1 year ago

Also having the same problem. Is there a way it can ignore the bad readings and continue once the condition clears?

` [13:25:19][W][vl53l0x:266]: VL53L0x Bottom - update called before prior reading complete - initiated:0 waiting_for_interrupt:1

thanks !

s1godfrey commented 1 year ago

With the help of user 'ssieb' on Discord:

on_message: level: WARN then:

It's crude, but does the trick on some of my applications.

momonator25 commented 9 months ago

With the help of user 'ssieb' on Discord:

on_message: level: WARN then: - lambda: if (std::string(tag) == "vl53l0x") id(restart_button).press();

It's crude, but does the trick on some of my applications.

A few month later and still the same issue with the sensor, but restarting on Warn message does the job. I can exclude the fault on the sensor side because I ran the sensor for over a year before now i switched to ESPHome.

Gunthervc commented 5 months ago

After all this time they not able to fix it. installed espeasy and all runs fine.

grambas commented 19 hours ago

I have the same issue. After restarting the device, I get some good readings, but then this error appears. I observed that if I disconnect the SLC pin, the same error also occurs. After reconnecting the SLC pin, the error persists until I restart the device.