esphome / issues

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

Captive portal causes WiFi problems on sonoff basics #3604

Closed pjmsullivan closed 1 year ago

pjmsullivan commented 1 year ago

The problem

After updating my devices to 2022.9.1, three sonoff basics couldn't connect to WiFi. After manually connecting to the devices over serial, erasing flash, uploading esphome, and checking the logs, I discovered the following:

UPDATE: removing captive portal from a different sonoff basic does not resolve the issue, it remains unable to connect to wifi. Configs below.

Which version of ESPHome has the issue?

2022.9.1

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

2022.9.6

What platform are you using?

ESP8266

Board

sonoff basic

Component causing the issue

captive portal (I believe)

Example YAML snippet

two configs that cause WiFi failures after update. The first works when I remove captive_portal, but not the second.

esphome:
  name: bedroomfan
  comment: Controls the bedroom fan
esp8266:
  board: esp8285

wifi:
  ssid: "[redacted]"
  password: "[redacted]"

  ap:
    ssid:  "BedroomFan"
    password: "[redacted]"

  domain: .home.[redacted].com

captive_portal:

logger:

api:
  password: "[redacted]"
  reboot_timeout: 5min

ota:
  password: "[redacted]"

text_sensor:
  - platform: version
    name: "Bedroom Fan ESPHome Version"

switch:
  - platform: restart
    name: "Bedroom Fan Restart"

fan:
  - platform: binary
    output: relay
    name: "Bedroom Fan"
    id: bedroomfan

output:
  - platform: gpio
    pin: GPIO12
    id: relay

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      mode: 
        input: true
        pullup: true
      inverted: true
    name: "Bedroom Fan Button"
    on_press:
      - fan.toggle: bedroomfan

status_led:
  pin:
    number: GPIO13
    inverted: yes

Second config file that does not work after update to 2022.9.0 (worked before):

esphome:
  name: kegerator
  comment: Controls the kegerator temperature
esp8266:
  board: esp8285

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

#   ap:
#     ssid:  "Kegerator"
#     password: "[Redacted]"

  domain: .home.[Redacted].com

# captive_portal:

logger:

api:
  password: "[Redacted]"
  reboot_timeout: 5min

ota:
  password: "[Redacted]"

text_sensor:
  - platform: version
    name: "Kegerator ESPHome Version"

dallas:
  - pin: GPIO14
    update_interval: 15s

sensor:
  - platform: dallas
    address: 0xF0031671D2D0FF28
    name: "Kegerator Temperature"
    resolution: 12
    accuracy_decimals: 2
    id: kegerator_temperature

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      mode: 
        input: true
        pullup: true
      inverted: true
    name: "Kegerator Button"
    on_press:
      - switch.toggle: relay

switch:
  - platform: gpio
    name: "Kegerator Switch"
    pin: GPIO12
    id: relay
  - platform: restart
    name: "Kegerator Restart"

climate:
  - platform: thermostat
    name: "Kegerator"
    id: kegerator
    sensor: kegerator_temperature
    default_target_temperature_high: 35°F
    min_cooling_off_time: 5min
    min_cooling_run_time: 0s
    min_idle_time: 0s
    cool_action:
      - switch.turn_on: relay
    idle_action:
      - switch.turn_off: relay

status_led:
  pin:
    number: GPIO13
    inverted: yes

Anything in the logs that might be useful for us?

Did the update to 2022.9.0 increase the compiled size that is causing WiFi to be unreliable? I

Additional information

Thank you so much for this amazing project.

robertlarue commented 1 year ago

I’m having this same issue with two sonoff basics.

One has a DHT22 and an SGP30 sensor. The other is fairly basic with just the internal relay.

UPDATE: I can confirm that removing the captive_portal: line from the YAML configuration fixes the issue.


esphome:
  name: air-quality

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: [redacted]

ota:
  password: [redacted]

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Air-Quality Fallback Hotspot"
    password: [redacted]

captive_portal:

i2c:
  scl: GPIO3
  sda: GPIO1

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      mode:
        input: true
        pullup: true
      inverted: true
    name: Button
    on_press:
      - switch.toggle: relay

switch:
  - platform: gpio
    name: Switch
    pin: GPIO12
    id: relay

status_led:
  pin:
    number: GPIO13
    inverted: true

sensor:
  - platform: sgp30
    eco2:
      name: CO2
      accuracy_decimals: 1
    tvoc:
      name: TVOC
      accuracy_decimals: 1
    compensation:
      temperature_source: temperature
      humidity_source: humidity
    update_interval: 60s
  - platform: dht
    pin: GPIO14
    temperature:
      name: Temperature
      id: temperature
    humidity:
      name: Humidity
      id: humidity
    update_interval: 60s
mspinolo commented 1 year ago

I have same issue with a sonoff basic, more details here Link to home assistant forum thread

pjmsullivan commented 1 year ago

I updated the affected sonoffs to 2022.11.5 and the connectivity issue is gone. Thank you.