esphome / issues

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

ESPHome won't boot and goes into safe mode when using some DS18*20 sensors. #3107

Closed AlexValery13 closed 2 years ago

AlexValery13 commented 2 years ago

The problem

I have a group of four old DS18B20 sensors. These sensors are over seven years old. All this time they worked under a proprietary device on the ATMega-32. These sensors are still operational under the Tasmota firmware. But if I change the firmware to ESPHome for the same ESP-12, then ESPHome does not work. ESPHome does not start the web interface and the API reports:

INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from sauna-display.local using esphome API
WARNING Can't connect to ESPHome API for sauna-display.local: Timeout while connecting to ('192.168.13.153', 6053)
INFO Trying to reconnect to sauna-display.local in the background

If I disconnect "data" DS18B20 from GPIO4, then ESPHome starts up.

If I change

dallas:
  - pin: GPIO4

to another pin that does NOT have "data" DS18B20 connected to it, then ESPHome starts up.

If I do not change the hardware and change the firmware to Tasmota, then I get readings from all four sensors used.

If I use new sensors then this problem does not occur.

Which version of ESPHome has the issue?

2022.2.5

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

2022.2.9

What platform are you using?

ESP8266

Board

ESP-12

Component causing the issue

Dallas

Example YAML snippet

esphome:
  name: test

esp8266:
  board:  esp01_1m

# Enable logging
logger:

# подключение DALLAS
dallas:
  - pin: GPIO4
    update_interval: 10s

# Enable Home Assistant API
api:
  password: !secret api_password

ota:
  password: !secret ota_password

web_server:
  port: 80

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

# Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Sauna-Display Hotspot"
    password: !secret hotspot_password

captive_portal:

Anything in the logs that might be useful for us?

INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from sauna-display.local using esphome API
WARNING Can't connect to ESPHome API for sauna-display.local: Timeout while connecting to ('192.168.13.153', 6053)
INFO Trying to reconnect to sauna-display.local in the background

Additional information

tsm

AlexValery13 commented 2 years ago

It may be useful to specify the addresses of sensors that ESPHome cannot work with. I got these addresses from the Tasmota console: "DS18S20-1":{"Id":"00080229C763","Temperature":7.3},"DS18S20-2":{"Id":"00080229D1F6","Temperature":21.9},"DS18S20-3":{"Id":"00080229D80E","Temperature":25.5},"DS18B20-4":{"Id":"0000057A49FE","Temperature":25.5}

AlexValery13 commented 2 years ago

I noticed that in the group that "kills" ESPHome, one DS18B20 sensor and three DS18S20 sensors are used. Perhaps this is the cause of the problem.

OttoWinter commented 2 years ago

Please connect to the device via serial/usb and show the serial logs of what's happening while the device is "killed" (does not connect)

AlexValery13 commented 2 years ago

OK, I did it! Here is the log of the "killed" ESPHome: UART_problem-sensor_logs.txt

wysiwyng commented 2 years ago

I can also observe this behavior. Running a similar setup:

I have a bunch of DS18x20 sensors set up on a breadboard, 4k7 Ohm pullup to 3v3 on the data line. My crash log looks the same as @AlexValery13. Connecting 3 sensors works, more than that and ESPHome crashes. Connecting one sensor on a 1.5 meter long cable causes a crash with only two sensors connected. Disconnecting all sensors during the setup phase of ESPHome and then reconnecting causes no crash, and all sensors report plausible temperatures as expected. A simple Arduino sketch on the exact same hardware is able to scan the bus and read sensors just fine.

Unfortunately I do not (yet) have new sensors to test with to confirm @AlexValery13's observation that the crashes do not happen with new sensors.

Using ESPHome with the same sensors on an ESP32 based board shows no issues.

EDIT: ESP32 also crashes now that I added a SHTC3 I2C sensor, but it is able to eventually recover after 3 - 4 reboots. Disconnecting the onewire sensors during startup also fixes the problem here. ESP32 stacktrace:

[15:29:14]ets Jun  8 2016 00:22:57
[15:29:14]
[15:29:14]rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
[15:29:14]configsip: 0, SPIWP:0xee
[15:29:14]clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
[15:29:14]mode:DIO, clock div:2
[15:29:14]load:0x3fff0018,len:4
[15:29:14]load:0x3fff001c,len:1044
[15:29:14]load:0x40078000,len:10124
[15:29:14]load:0x40080400,len:5828
[15:29:14]entry 0x400806a8
[15:29:15][I][logger:214]: Log initialized
[15:29:15][C][ota:461]: There have been 4 suspected unsuccessful boot attempts.
[15:29:15][D][esp32.preferences:114]: Saving preferences to flash...
[15:29:15][I][app:029]: Running through setup()...
[15:29:15][I][i2c.arduino:161]: Performing I2C bus recovery
[15:29:15][C][switch.gpio:011]: Setting up GPIO Switch 'onboard led'...
[15:29:15][D][switch:017]: 'onboard led' Turning OFF.
[15:29:15][D][switch:037]: 'onboard led': Sending state OFF
[15:29:15][D][switch:017]: 'onboard led' Turning OFF.
[15:29:15][C][dallas.sensor:032]: Setting up DallasComponent...
[15:29:20]E (10334) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
[15:29:20]E (10334) task_wdt:  - loopTask (CPU 1)
[15:29:20]E (10334) task_wdt: Tasks currently running:
[15:29:20]E (10334) task_wdt: CPU 0: IDLE0
[15:29:20]E (10334) task_wdt: CPU 1: loopTask
[15:29:20]E (10334) task_wdt: Aborting.
[15:29:20]abort() was called at PC 0x4015028c on core 0
[15:29:20]
[15:29:20]ELF file SHA256: 0000000000000000
[15:29:20]
[15:29:20]Backtrace: 0x400893d0:0x3ffbf880 0x4008964d:0x3ffbf8a0 0x4015028c:0x3ffbf8c0 0x40087a39:0x3ffbf8e0 0x40167583:0x3ffbc160 0x40151b97:0x3ffbc180 0x4008be1d:0x3ffbc1a0 0x4008a65e:0x3ffbc1c0
WARNING Found stack trace! Trying to decode it
WARNING Decoded 0x400893d0: invoke_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c:715
WARNING Decoded 0x4008964d: abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c:715
WARNING Decoded 0x4015028c: task_wdt_isr at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/task_wdt.c:252
WARNING Decoded 0x40087a39: _xt_lowint1 at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/xtensa_vectors.S:1154
WARNING Decoded 0x40167583: esp_pm_impl_waiti at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/pm_esp32.c:492
WARNING Decoded 0x40151b97: esp_vApplicationIdleHook at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/freertos_hooks.c:108
WARNING Decoded 0x4008be1d: prvIdleTask at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/tasks.c:3507
WARNING Decoded 0x4008a65e: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c:355 (discriminator 1)
[15:29:20]
[15:29:20]Rebooting...