Lyr3x / Roode

A reliable smart home people counter based on VL53L1X and ESPHome
The Unlicense
149 stars 41 forks source link

ESP8266 WiFi not connecting #49

Closed grego1981 closed 2 years ago

grego1981 commented 2 years ago

Describe the bug Used the latest yaml example, the firmware is compiled just fine, I upload it without an issue and restart the module. On restart if the sensor is not connected the WiFi is connected properly after attempting to find the sensor. If the sensor is connected Wifi fails to connect.

To Reproduce Connect the sensor to SDA & SCL

Expected behavior The ESP8266 should connect to WiFi with sensor connected

Additional context Attached 2 log files one with sensor online and one offline. with_sensor.txt without_sensor.txt

Lyr3x commented 2 years ago

Thanks for reporting this. I currently only use ESP32 boards but I will check my 8266 later today.

What power supply do you use?

grego1981 commented 2 years ago

I used both the usb port of my PC and a wall plug 2Amp adapter. Same behaviour.

Thank you for your help!

Lyr3x commented 2 years ago

The usb Port does Not deliver enough power, i faced this issue in the past as well. At least sometimes... Ill get back to you later after i checked the Template on my esp8266.

Lyr3x commented 2 years ago

Can you share your exact hardware information? e.g.: ESP model: Wemos D1 Mini VL53L1X: Pololu Wiring: All pins

grego1981 commented 2 years ago

ESP model Wemos with ESP8266EX chip 20211016_120854 20211016_120925 VL53L1X form Aliexpress (the black one) D1 --> SCL D2 --> SDA 3V3 --> VIN used 3v3 & GND both next to the D1D2 pins as well the one of the opposite side. GND --> GND

grego1981 commented 2 years ago

And this is my ESPHome config file:

substitutions: devicename: bathprsensor friendly_name: $devicename

external_components: refresh: always source: type: git url: https://github.com/Lyr3x/Roode ref: master

esphome: name: $devicename platform: ESP8266 board: d1_mini libraries:

wifi: networks:

api: password: admin reboot_timeout: 60min services:

ota: password: admin

web_server: port: 80 auth: username: admin password: admin

Enable logging

logger: level: DEBUG

i2c: sda: 4 scl: 5

roode: id: roode_platform address: 0x29 update_interval: 100ms calibration: true roi_height: 16 roi_width: 6 max_threshold_percentage: 80 roi_calibration: false invert_direction: true restore_values: true

switch:

sensor:

grego1981 commented 2 years ago

Tested with another ESP8266EX with the same results. Do you have any other suggested board you have tested it with to try?

Lyr3x commented 2 years ago

Had a busy weekend. Will report back tomorrow. I will test it with a wemos d1 mini.

Lyr3x commented 2 years ago

So I uploaded the latest example configuration to my wemos d1 mini with an attached Chinese (black) sensor. All is working fine.

Can you change your board type from board: d1_mini to board: nodemcuv2 ? It seems you are using that board

grego1981 commented 2 years ago

I've already made that change to nao avail.... I'll try to trace a D1 mini to test as well, it seems that something interferes with WiFi when using i2C..

Lyr3x commented 2 years ago

I cant reproduce that with my wemos d1 mini and different sensors

grego1981 commented 2 years ago

Sorry for the delayed answer, the same code on a wemos D1 mini works fine ( I received 2 minis one with shield and one without), but on the wemos nodemcu with esp8266ex as well doesn't work. I double checked the WiFi works with other sensors without issues on the same ESPs that dont work with the VL53L1X...

Lyr3x commented 2 years ago

To conclude: Your VL53L1X sensor works with the wemos d1 Mini but not with the nodemcu ? They use the exact same ESP on board so it has nothing to do with the chip itself.

Other sensors do not help to debug as they do not share the same code. That's not a good test😅

grego1981 commented 2 years ago

Yes, VL53L1X sensor works with the wemos d1 Mini but not with the nodemcu. Is there any example code to test the VL53L1X with WiFi using another library? I'm willing to help find a solution. To be clear the 2nd nodemcu was new and tested that it works fine witho other sensons and code.

Lyr3x commented 2 years ago

I think that it has nothing do do with my code, but with esphome itself. I am not available till tomorrow evening. May you join the discord and well built Test code and debug this?

We can post the results here afterwards.

grego1981 commented 2 years ago

No problem I can do it, just tell me when and where to connect!

Lyr3x commented 2 years ago

https://discord.gg/RK3KJeSy

JannickBlmndl commented 2 years ago

I had the same problem with my esp8266. This was the error in the logs.

: Event: Disconnected ssid='***' bssid=B0:**:**:**:FB:** reason='Auth Expired' Leaving out starting from use address until domain helped for me after a bit of patience.

wifi:
  networks:
    - ssid: !secret wifi_ssid
      password: !secret wifi_passsword
  # use_address: $devicename
  # fast_connect: True
  # power_save_mode: none
  # domain: .local
Lyr3x commented 2 years ago

Could it be that fast_connect is the issue here? Can you check if you enable all other options again but leave fast_connect disabled?

JannickBlmndl commented 2 years ago

I think it's an issue of my wifi router. The wifi connection is working fine now as is. Thanks for helping out!

Lyr3x commented 2 years ago

So it has to do with fast connect ? @grego1981 may you also check?

Lyr3x commented 2 years ago

Will close the issue as it is most likely not an issue with the RooDe code.