Reboot request from adc.sensor

Hi

I’m having trouble with one of my Shellys (1 Gen 3) flashed with esphome 20215.10.2.

According to home assistant it keeps rebooting with reason “reboot request from adc.sensor”

Googling didn’t tell me what that could mean and the only part relevant seems to be this one

  - id: temperature_sensor_voltage
     platform: adc    
     pin: GPIO3
     attenuation: 12db

Can anybody tell me what I should try?

You could post your whole yaml and also what you get on esphome logs.

Thank you for your message.

#esphome 2025.10.2
substitutions:
  max_temp: "70" # °C
  action_single_text: single
  action_double_text: double
  #max_ble_connections: "5"
  entity_id: "1-bad-schalter"

#https://github.com/esphome/issues/issues/2941#issuecomment-1331851692
#https://community.home-assistant.io/t/shelly-plus-1-esphome-bletracker/363549/42
esphome:
  name: ${entity_id}
  friendly_name: "1. Stock Bad Schalter"
  platformio_options:
    board_build.mcu: esp32c3
    board_build.variant: esp32c3
    board_build.f_cpu: 160000000L
    board_build.f_flash: 80000000L
    board_build.flash_mode: dio
    board_build.flash_size: 8MB
#   board_build.flash_mode: dio
#  on_boot:
#    priority: 250
#    then:
#      - delay: 15s
#     - lambda: |-
#          id(ble_tracker).set_scan_continuous(true); 
#          id(ble_tracker).start_scan();

esp32:
  board: esp32-c3-devkitm-1
  flash_size: 8MB
  framework:
    type: esp-idf
    version: recommended
    sdkconfig_options:
      COMPILER_OPTIMIZATION_SIZE: y
      CONFIG_FREERTOS_UNICORE: y
      CONFIG_ESP32_DEFAULT_CPU_FREQ_160: y
      CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ: "160"
      CONFIG_ESP_TASK_WDT_TIMEOUT_S: "20"
      CONFIG_BT_BLE_50_FEATURES_SUPPORTED: n
      CONFIG_BT_BLE_42_FEATURES_SUPPORTED: y


wifi:
  ssid: !secret wifi_nonet_ssid
  password: !secret wifi_nonet_password
  fast_connect: true #required for hidden ssids
  reboot_timeout: 10min
  #output_power: 8.5

logger:
  level: INFO

debug:
  update_interval: 5s

text_sensor:
  - platform: debug
    device:
      name: "Device Info"
    reset_reason:
      name: "Reset Reason"  
#  - platform: ble_scanner
#    name: "BLE Devices Scanner"


# Enable Home Assistant API
api:
  encryption:
    key: !secret ha_api_key

ota:
  - platform: esphome
    password: !secret esphome_ota_password
time:
  - platform: homeassistant



#esp32_ble_tracker:
#  id: ble_tracker
#  #max_connections: $max_ble_connections
#  scan_parameters:
#    #continuous: true
#    interval: 211ms
#    window: 120ms


#bluetooth_proxy:
#  #connection_slots: 5
#  active: true

safe_mode:

button:
  - platform: safe_mode
    id: safe_mode_button
    name: "(Safe Mode)"
    
output:
  - id: relay_output
    platform: gpio
    pin: GPIO5

switch:
  - platform: output
    id: "relay"
    name: Relay
    output: "relay_output"
    restore_mode: restore_default_off

sensor:
  - id: internal_temperature
    name: Temperature
    platform: ntc
    sensor: temperature_sensor_resistance
    icon: mdi:thermometer
    entity_category: diagnostic
    unit_of_measurement: °C
    accuracy_decimals: 1
    calibration:
      b_constant: 3350
      reference_resistance: 10kOhm
      reference_temperature: 25°C
    on_value:
      then:
        - if:
            condition:
              - sensor.in_range:
                  id: internal_temperature
                  above: ${max_temp}
            then:
              - switch.turn_off:
                  id: relay
              - logger.log: "Switch turned off because temperature exceeded ${max_temp}°C"
  - id: temperature_sensor_resistance
    platform: resistance
    sensor: temperature_sensor_voltage
    configuration: DOWNSTREAM
    resistor: 10kOhm
  - id: temperature_sensor_voltage
    platform: adc
    pin: GPIO3
    attenuation: 12db


#wallswitch turned into a binary sensor (push button switch)
#https://github.com/esphome/issues/issues/2825
binary_sensor:
  - platform: gpio
    name: Wallswitch
    pin: 10
    filters:
    - delayed_on_off: 50ms
    internal: true
    id: wallswitch
    on_state:
      then:
        - binary_sensor.template.publish:
            id: wallswitch_clicker
            state: ON
        - delay: 100ms
        - binary_sensor.template.publish:
            id: wallswitch_clicker
            state: OFF

  - platform: template
    id: wallswitch_clicker
    on_multi_click:
      - timing:
        - ON for at most 101ms
        - OFF for at least 150ms
        then:
          - logger.log: "Single Click"
          - if:
              condition:
                and:
                  - wifi.connected:
                  - api.connected:
              # send single click event in case wifi and api are conncected
              then:
                - switch.toggle: relay
                - homeassistant.event:
                    event: esphome.button_pressed
                    data:
                      click: ${action_single_text}
                      entity_id: ${entity_id}
              else:
                - switch.toggle: relay

      - timing:
        - ON for at most 101ms
        - OFF for at most 149ms
        - ON for at most 101ms
        - OFF for at least 1ms
        then:
          - logger.log: "Double Click"
          - if:
              condition:
                and:
                  - wifi.connected:
                  - api.connected:
              # send double click event in case wifi and api are conncected
              then:
                - homeassistant.event:
                    event: esphome.button_pressed
                    data:
                      click: ${action_double_text}
                      entity_id: ${entity_id}                    
  - platform: gpio
    name: "Reset Button"
    pin:
      number: 1
      inverted: yes
      mode:
        input: true
        pullup: true


status_led:
  pin:
    number: 0
    inverted: true

The log is basically empty though

INFO ESPHome 2025.10.2
INFO Reading configuration /config/1-bad-schalter.yaml...
INFO Detected timezone 'Etc/UTC'
INFO Starting log output from 10.1.104.173 using esphome API
INFO Successfully resolved 1-bad-schalter @ 10.1.104.173 in 0.000s
INFO Successfully connected to 1-bad-schalter @ 10.1.104.173 in 0.089s
INFO Successful handshake with 1-bad-schalter @ 10.1.104.173 in 0.104s
[08:13:40.217][I][app:185]: ESPHome version 2025.10.2 compiled on Nov 20 2025, 10:25:34
INFO Processing unexpected disconnect from ESPHome API for 1-bad-schalter @ 10.1.104.173
WARNING Disconnected from API
INFO Successfully resolved 1-bad-schalter @ 10.1.104.173 in 0.000s
WARNING Can't connect to ESPHome API for 1-bad-schalter @ 10.1.104.173: Error connecting to [AddrInfo(family=<AddressFamily.AF_INET: 2>, type=<SocketKind.SOCK_STREAM: 1>, proto=6, sockaddr=IPv4Sockaddr(address='10.1.104.173', port=6053))]: [Errno 113] Connect call failed ('10.1.104.173', 6053) (SocketAPIError)
INFO Trying to connect to 1-bad-schalter @ 10.1.104.173 in the background
INFO Successfully connected to 1-bad-schalter @ 10.1.104.173 in 2.497s
INFO Successfully connected to 1-bad-schalter @ 10.1.104.173 in 1.134s
INFO Successful handshake with 1-bad-schalter @ 10.1.104.173 in 0.107s

The Reboot request from adc.sensor - message is from Home Assistant, via text_sensor.reset_reason.

Set logger level: DEBUG and verify what happens on logs when you get that message on ha.

Ok, so this helped me, but in an unexpected way.

To flash the shelly and get the logs I had to move one of my accesspoints slighty. Turns out the shelly didn’t have a stable wifi connection. That is surprising though since all other devices have an excellent connection.

It’d be great if this was the end of the story, but I actually noticed, that when the shelly does have a connection it does not switch the relay anymore when the wall switch is flipped.
It only works when the shelly does not have a wifi connection.

Here are the logs (the shelly has a connection at this point, obviously):

[15:42:51.634][D][sensor:131]: 'Temperature': Sending state 34.13375 °C with 1 decimals of accuracy
[15:43:35.694][D][binary_sensor:039]: 'wallswitch_clicker': New state is ON
[15:43:35.696][D][binary_sensor:039]: 'Wallswitch': New state is OFF
[15:43:35.799][D][binary_sensor:039]: 'wallswitch_clicker': New state is OFF
[15:43:42.757][D][binary_sensor:039]: 'wallswitch_clicker': New state is ON
[15:43:42.757][D][binary_sensor:039]: 'Wallswitch': New state is ON
[15:43:42.860][D][binary_sensor:039]: 'wallswitch_clicker': New state is OFF
[15:43:51.616][D][sensor:131]: 'temperature_sensor_voltage': Sending state 1.40300 V with 2 decimals of accuracy

I flipped the wall switch, waited 5 seconds and switched it again.

The relay should have toggled at least once, but it didn’t. There isn’t a line in the log that says Single Click even though that’s independent of whether there is a home assistant connection. The event esphome.button_pressed isn’t emitted either.

It’s weird, this works flawlessly on other shellys. Any ideas?

I don’t know what you are really trying to approach here.
Why you have click timing on for at most 101ms when you have automation to keep it on for 100ms???

That turns a “flip” switch (physical) into a push button. I then use that to determine if the switch has been flipped only once, or twice in rapid succession.

The 101 instead of 100 is just a precaution. Logging probably adds to the timing, but as you can see it appears that wallswitch_clicker is ON/OFF for a bit longer than 100 seconds.

Precaution? You need way higher value for at most, try with 200ms. Even on your logs you see that it’s more than 101.

Sure, I need to fine tune that, but why is the timing ok when the shelly isn’t able to connect to the wifi and is incorrect when it is able to connect to wifi?

Without wifi flipping the switch turns the light on/off. When the shelly is connected to wifi it suddenly doesn’t work anymore.

Can be whatever, esp might react faster when not struggling with wifi.
In any case you need good margin there.

When automation on gpio binary sensor is turning on/off with 100ms delay, this all happens in loop cycle. If something is jamming that cycle, even 200ms may fail.

1 Like

You are a GENIUS. Thank you so much! I never would have guessed that. 200ms was enough!

It works flawlessly with 101 on 5 other shellys so I never would have guessed that. Thank you!

- platform: template
    id: wallswitch_clicker
    on_multi_click:
      - timing:
        - ON for at most 200ms
        - OFF for at least 150ms
        then:
          - logger.log: "Single Click"
          - if:
              condition:
                and:
                  - wifi.connected:
                  - api.connected:
              # send single click event in case wifi and api are conncected
              then:
                - switch.toggle: relay
                - homeassistant.event:
                    event: esphome.button_pressed
                    data:
                      click: ${action_single_text}
                      entity_id: ${entity_id}
              else:
                - switch.toggle: relay

      - timing:
        - ON for at most 200ms
        - OFF for at most 149ms
        - ON for at most 200ms
        - OFF for at least 1ms
        then:
          - logger.log: "Double Click"
          - if:
              condition:
                and:
                  - wifi.connected:
                  - api.connected:
              # send double click event in case wifi and api are conncected
              then:
                - homeassistant.event:
                    event: esphome.button_pressed
                    data:
                      click: ${action_double_text}
                      entity_id: ${entity_id}           

Two more questions, if you don’t mind:

  • Can I force esphome to use a certain AP? I’d like to try if the other AP doesn’t have a more stable connection.
  • When the shelly reboots the first flip of the switch is ignored, all other flips work first try. Do you have an idea what the root cause could be and how I can influence it to work first try?

Try with networks option bssid in wifi

networks:
    - ssid: "MyWifi"
      password: "my_password"
      bssid: "AA:BB:CC:DD:EE:FF"  #  your AP's MAC address

Since your logging is working now, have a look what happens there when you flip the switch first time…

Just luck in my opinion, I would adjust them as well.

1 Like

I had to add trigger_on_initial_state: true to the config
like so
Now it works immediately after a reboot.

  - platform: template
    id: wallswitch_clicker
    trigger_on_initial_state: true
1 Like