esphome / esphome-core

🚨 No longer used 🚨 - The C++ framework behind ESPHome
https://esphome.io/
GNU General Public License v3.0
545 stars 113 forks source link

Sonoff Basic + Dual + Slampher becomes non-responsive #340

Closed meijerwynand closed 5 years ago

meijerwynand commented 5 years ago

Operating environment/Installation (Hass.io/Docker/pip/etc.): Xubuntu 18.04 HA 0.84.3 (pip) esphomeyaml (1.9.1) Mosquito MQTT

ESP (ESP32/ESP8266/Board/Sonoff):

Affected component: Appears to hang Sonoff devices on espyaml 1.9.3

Description of problem:

Problem-relevant YAML-configuration entries:


esphomeyaml:
  name: !secret xxx
  platform: ESP8266
  board: esp01_1m
  board_flash_mode: dout
  # esphomelib_version: 1.9.1

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  domain: !secret wifi_domain
  power_save_mode: light

mqtt:
  broker: !secret mqtt_broker
  username: !secret mqtt_username
  password: !secret mqtt_password

# Enable logging
logger:
  level: DEBUG

ota:

## Quick GPIO reference
## https://esphomelib.com/esphomeyaml/devices/sonoff_basic.html
#
status_led:
  ## https://esphomelib.com/esphomeyaml/components/status_led.html
  pin: GPIO13

sensor:
  ## https://esphomelib.com/esphomeyaml/components/sensor/uptime.html
  - platform: uptime
    name: "esp_xxx_system_uptime"
    id: esp_xxx_system_uptime

  ## https://esphomelib.com/esphomeyaml/components/sensor/wifi_signal.html
  - platform: wifi_signal
    name: "esp_xxx_system_wifi_signal"
    id: esp_xxx_system_wifi_signal
    update_interval: 15s

## https://esphomelib.com/esphomeyaml/guides/automations.html
## switch - use build in API functions to manage local device pins without mqtt

light:
  # Status LED
  - platform: monochromatic
    name: "esp_xxx_gpio13"
    output: esp_xxx_gpio13

  ## OUT 1 - Green
  - platform: binary
    name: "esp_xxx_gpio12"
    id: esp_xxx_gpio12
    output: output_esp_xxx_gpio12

binary_sensor:
  ## https://esphomelib.com/esphomeyaml/components/binary_sensor/status.html
  - platform: status
    name: "esp_xxx_system_status"
    id: "esp_xxx_system_status"

## relays used as lights
## set as invertered to be on by fault
output:
  - platform: gpio
    id: "output_esp_xxx_gpio12"
    pin:
      number: GPIO12
      inverted: true

  # Register the blue LED as a dimmable output ....
  - platform: esp8266_pwm
    id: esp_xxx_gpio13
    pin: GPIO13

Additional information:

I currently have exhausted my personal resources and capacity in a best effort to troubleshoot and resolve the issue, I am appealing to you for advice and suggestions.

Thank you very much, looking forward to your inputs.

OttoWinter commented 5 years ago

I then attempted to revert back to version 1.8.2, but only to be faced with new challenges -- esphomelib_version: 1.8.2

The esphomeyaml and -lib versions need to match in order for compilation to work. So if you want to try with 1.8.2 you need to pip install esphomeyaml==1.8.2 first

As for the other issues, there's nothing magic I can help you with here, sorry. I've seen semi-similar symptoms some times but then they vanished again for whatever reason. The only way to debug this kind of stuff is to get the USB logs.

They usually contain a lot more info regarding WiFi etc and of course also work when WiFi breaks. I know it's kind of hard to have a USB connection to these sonoff devices, but without logs I can't really help here.

meijerwynand commented 5 years ago

Some feedback:

versions need to match in order for compilation to work

  • I was able to downgrade using pip install esphomeyaml==1.8.2 and manually setting esphomeyam.esphomelib_version: 1.8.2
  • All sonoff devices are now stable with none of the reported issues (boot, alive for about 3 mins, hangs).
  • I have noticed my time option for scheduling / cron events are not working.
  • Some automation lambas do not work, I will crosscheck with the changelogs to see if features I used are compatible.

get the USB logs

  • Now that I have a base line and working system, I will gradually start upgrading (1.9.0 and increment).
  • Once I found the version causing the issues I will do VERY_VERBOSE log while connected to USB if that will help, and add the log here as a txt attachment.
  • Are there any other logs or information I should provide to assist in the trouble shooting?
meijerwynand commented 5 years ago

More feedback:

Attempting to isolate the issue

I used 1 Sonoff Basic which was known to hang/become non-responsive with 1.9.3 and working on 1.8.2.

Environment

Xubuntu 18.04 HA 0.84.6 (pip) esphomeyaml (pip)

Symptoms

Procedure followed

Observations

  1. I revered back to 1.8.2 and started the procedure as outlined above. I installed each version in the following order based on the releases

    • 1.9.0
    • 1.9.1
    • 1.9.2
    • 1.9.3
  2. By installing and specifying each version in sequence I ended up with v1.9.3 currently running successfully on the originally reported issue

  3. Subsequently, after the tests appear successful I continued I OTA reflashed another 'problematic' Sonoffs from 1.9.3 (problematic) or 1.8.2 to 1.9.3 (version-by-version pip upgrade) and for the past 2 days they have been stable... MQTT is giving some challenges but I will address that at another stage

    • Sonoff Dual - stable.
    • Sonoff Slampher - stable
    • Sonoff Basic (RF R2 V1) - stable
    • Sonoff Touch's - Not flashed yet, status/outcome unknown
  4. I have been able to even make modifications to the yaml

    
    ## Fish pond sonoff
    # Starts with pump in off position
    # Button toggles pump
    # Cron'd
    esphomeyaml:
    name: !secret xxx
    platform: ESP8266
    board: esp01_1m
    board_flash_mode: dout
    esphomelib_version: 1.9.3

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

mqtt: broker: !secret mqtt_broker username: !secret mqtt_username password: !secret mqtt_password

Enable logging

logger: level: DEBUG

ota:

Quick GPIO reference

https://esphomelib.com/esphomeyaml/devices/sonoff_basic.html

status_led:

https://esphomelib.com/esphomeyaml/components/status_led.html

pin: GPIO13

sensor:

https://esphomelib.com/esphomeyaml/components/sensor/uptime.html

https://esphomelib.com/esphomeyaml/guides/automations.html

light:

Status LED

binary_sensor:

https://esphomelib.com/esphomeyaml/components/binary_sensor/status.html

relays used as lights

output:

Use time

time:

Conclusion

For now, this looks like a win... yay!

OttoWinter commented 5 years ago

Well it may be a win, but it still doesn't really solve the problem. If you give me the USB logs there's much more I can do. Oh and also there have been a couple of changes in the most recent dev version for wifi, maybe they could fix this? See https://esphomelib.com/esphomeyaml/guides/faq.html#how-do-i-use-the-latest-bleeding-edge-version

meijerwynand commented 5 years ago

Well it may be a win, but it still doesn't really solve the problem

What is the possibility that is issue may be in the pip deployment or do all pip files get replace irrespective of the version upgrade e.g. (0.0.1 -> 0.0.2) or (0.0.1 -> 0.1.3)

If you give me the USB logs there's much more I can do.

Sure, but to what extent will be helpful for you? (DEBUG|VERY_VERBOSE)

I still have some Sonoff Touch's I need to reflash ( well first remove, resolder and then reflash). However, I will update them with current configuration and pips, if they work, I will revert back to 1.8.2 and upgrade to 1.9.3 direct and see if that replicates the issue.

I will close this issue now and once I redo the Touch's I will update.

most recent dev version for wifi, maybe they could fix this

Once I am happy and better understand the (reoccurring) issues on all devices I will do a bulk update and use dev. Running various versions on various devices just creates various headaches while still learning.

Thanks

Styx85 commented 5 years ago

So I tested it now for several hours with the latest dev.

MQTT is still randomly crashing but it is recovering itself, so maybe that is than another issue.

[19:08:46][D][binary_sensor:028]: 'esp_Bad_system_status': Sending state ON
[19:08:46][W][mqtt.client:384]: Publish failed for topic='homeassistant/sensor/switch1/esp_bad_system_wifi_signal/config' will retry later..
[19:08:47][W][mqtt.client:384]: Publish failed for topic='homeassistant/binary_sensor/switch1/esp_bad_system_status/config' will retry later..
[19:08:49][W][mqtt.client:384]: Publish failed for topic='homeassistant/light/switch1/esp_bad_gpio13/config' will retry later..
[19:08:49][W][mqtt.client:384]: Publish failed for topic='homeassistant/light/switch1/esp_bad_gpio15/config' will retry later..
[19:10:34][I][mqtt.client:209]: MQTT Connected!
[19:10:42][I][mqtt.client:209]: MQTT Connected!
[19:10:42][W][mqtt.client:384]: Publish failed for topic='homeassistant/sensor/switch1/esp_bad_system_wifi_signal/config' will retry later..
[19:10:42][W][mqtt.client:384]: Publish failed for topic='homeassistant/light/switch1/esp_bad_gpio13/config' will retry later..
[19:10:45][W][mqtt.client:384]: Publish failed for topic='homeassistant/sensor/switch1/esp_bad_system_wifi_signal/config' will retry later..
[19:10:45][W][mqtt.client:384]: Publish failed for topic='homeassistant/light/switch1/esp_bad_gpio15/config' will retry later..
[19:10:45][W][mqtt.client:384]: Publish failed for topic='homeassistant/sensor/switch1/esp_bad_system_wifi_signal/config' will retry later..
[19:16:11][I][mqtt.client:209]: MQTT Connected!
[19:16:11][W][mqtt.client:384]: Publish failed for topic='homeassistant/light/switch1/esp_bad_gpio13/config' will retry later..
[19:16:11][W][mqtt.client:384]: Publish failed for topic='homeassistant/light/switch1/esp_bad_gpio15/config' will retry later..
[19:16:11][W][mqtt.client:384]: Publish failed for topic='homeassistant/light/switch1/esp_bad_gpio04/config' will retry later..
[19:16:11][D][debug:025]: esphomelib version 1.10.0-dev
[19:16:11][D][debug:027]: Free Heap Size: 25656 bytes
[19:16:11][D][debug:044]: Flash Chip: Size=1024kB Speed=40MHz Mode=DOUT
[19:16:11][D][debug:122]: Chip ID: 0x0041AEF4
[19:16:11][D][debug:123]: SDK Version: 2.2.1(cfd48f3)
[19:16:11][D][debug:124]: Core Version: 2_4_2
[19:16:11][D][debug:125]: Boot Version=31 Mode=1
[19:16:11][D][debug:126]: CPU Frequency: 80
[19:16:11][D][debug:127]: Flash Chip ID=0x001440A1
[19:16:11][D][debug:128]: Reset Reason: Software/System restart
[19:16:11][D][debug:129]: Reset Info: Fatal exception:0 flag:4 (SOFT_RESTART) epc1:0x00000000 epc2:0x00000000 epc3:0x00000000 excvaddr:0x00000000 depc:0x00000000
[19:16:11][I][application:089]: setup() finished successfully!
[19:16:11][I][application:097]: You're running esphomelib v1.10.0-dev compiled on Jan  3 2019, 18:38:38