『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 1659|回复: 5

[技术探讨] 求教ESP32C3刷esphome启动连wifi十分困难

[复制链接]

2

主题

11

帖子

214

积分

中级会员

Rank: 3Rank: 3

积分
214
金钱
203
HASS币
0
发表于 2023-9-6 14:50:15 | 显示全部楼层 |阅读模式
最近把HA从T1盒子搬回了NAS,但由于NAS没有蓝牙适配器,因此结合论坛的教程和自己的需求,用合宙的esp32c3为两个米家的温度计做蓝牙代理网关。
但是刷好esphome后却一直卡在连wifi这一步,十分头疼。
挂着不管放很长一段时间偶尔能连上,HA里也回会自动发现这个设备。但大多时候它会循环以下这一段流程。
Rebooting...
[I][logger:262]: Log initialized
[C][ota:469]: There have been 3 suspected unsuccessful boot attempts.
[D][esp32.preferences:114]: Saving 1 preferences to flash...
[D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[I][app:029]: Running through setup()...
[C][esp32_ble:027]: Setting up BLE...
[D][esp32_ble:043]: BLE setup complete
[D][esp32_ble_tracker:246]: Starting scan...
[C][wifi:038]: Setting up WiFi...
[C][wifi:048]: Starting WiFi...
[C][wifi:049]:   Local MAC: D4:F9:8D:3E:1D:F4
[I][wifi:274]: WiFi Connecting to 'RS's Net'...
[W][wifi:582]: Timeout while connecting to WiFi.
[I][wifi:274]: WiFi Connecting to 'RS's Net'...
[W][wifi_esp32:507]: Event: Disconnected ssid='RS's Net' bssid=[redacted] reason='Association Leave'
[I][wifi:274]: WiFi Connecting to 'RS's Net'...
[W][esp32_ble_tracker:108]: Too many BLE events to process. Some devices may not show up.
[W][wifi:582]: Timeout while connecting to WiFi.
[I][wifi:274]: WiFi Connecting to 'RS's Net'...
[W][esp32_ble_tracker:108]: Too many BLE events to process. Some devices may not show up.
[W][wifi_esp32:507]: Event: Disconnected ssid='RS's Net' bssid=[redacted] reason='Association Leave'
[W][wifi:609]: WiFi Unknown connection status 0
[I][wifi:274]: WiFi Connecting to 'RS's Net'...
[W][wifi_esp32:507]: Event: Disconnected ssid='RS's Net' bssid=[redacted] reason='Association Leave'
[W][wifi:609]: WiFi Unknown connection status 0
[I][wifi:274]: WiFi Connecting to 'RS's Net'...
[W][wifi:582]: Timeout while connecting to WiFi.
[W][esp32_ble_tracker:108]: Too many BLE events to process. Some devices may not show up.
[I][wifi:274]: WiFi Connecting to 'RS's Net'...
[W][wifi:582]: Timeout while connecting to WiFi.
[W][wifi_esp32:507]: Event: Disconnected ssid='RS's Net' bssid=[redacted] reason='Association Leave'
[W][wifi_esp32:507]: Event: Disconnected ssid='RS's Net' bssid=[redacted] reason='Association Leave'
[I][wifi:274]: WiFi Connecting to 'RS's Net'...
[W][esp32_ble_tracker:108]: Too many BLE events to process. Some devices may not show up.
[W][wifi:582]: Timeout while connecting to WiFi.
[W][esp32_ble_tracker:108]: Too many BLE events to process. Some devices may not show up.
[I][wifi:274]: WiFi Connecting to 'RS's Net'...
[W][wifi:582]: Timeout while connecting to WiFi.
[W][wifi_esp32:507]: Event: Disconnected ssid='RS's Net' bssid=[redacted] reason='Association Leave'
[W][esp32_ble_tracker:108]: Too many BLE events to process. Some devices may not show up.
[I][wifi:274]: WiFi Connecting to 'RS's Net'...
[W][wifi:582]: Timeout while connecting to WiFi.
起初以为是的ssid包含特殊字符导致的,后换了其他热点名例如'Guest Net'依然没有作用。
也怀疑是买到的esp32c3存在硬件故障,但实际上拿到手一开始刷的tasmota的wifi并没有异常。
我的esphome配置如下,目前2个温度计都在罢工状态。希望有人能帮到我。
substitutions:
  # Name the device and it's entities
  device: esp32c3
  device_name: esp32c3

esphome:
  name: $device_name
  comment: $device
  platformio_options:
    board_build.flash_mode: dio
    board_build.mcu: esp32c3
    compile_process_limit: 1
    
esp32:
  board: esp32-c3-devkitm-1
  variant: ESP32C3
  framework:
    type: arduino
    version: 'recommended'
    platform_version: '6.0.0'

external_components:
  - source: github://myhomeiot/esphome-components

esp32_ble_tracker:

# Enable logging
logger:
  level: DEBUG

# Enable Home Assistant API
api:
  encryption:
    key: "71fVDvRxn4ifcqg3liWrwr1f1P0q5GeH7S4gx7Nxpls="

ota:
  password: "0b566520d3345677913a231dde983818"

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

sensor:
  - platform: pvvx_mithermometer
    mac_address: "A4:C1:38:B6:E0:15"
    temperature:
      name: "Living Room ATC_B6E015 PVVX Temperature"
    humidity:
      name: "Living Room ATC_B6E015 PVVX Humidity"
    battery_level:
      name: "Living Room ATC_B6E015 PVVX Battery-Level"
    battery_voltage:
      name: "Living Room ATC_B6E015 PVVX Battery-Voltage"
    signal_strength:
      name: "Living Room ATC_B6E015 PVVX Signal"
  - platform: pvvx_mithermometer
    mac_address: "A4:C1:38:44:D4:8A"
    temperature:
      name: "Main Bedroom ATC_44D48A PVVX Temperature"
    humidity:
      name: "Main Bedroom ATC_44D48A PVVX Humidity"
    battery_level:
      name: "Main Bedroom ATC_44D48A PVVX Battery-Level"
    battery_voltage:
      name: "Main Bedroom ATC_44D48A PVVX Battery-Voltage"
    signal_strength:
      name: "Main Bedroom ATC_44D48A PVVX Signal"

回复

使用道具 举报

105

主题

2954

帖子

1万

积分

超级版主

智能家居&单板滑雪痴迷爱好者

Rank: 8Rank: 8

积分
12103
金钱
9084
HASS币
460

教程狂人突出贡献

发表于 2023-9-6 16:21:56 | 显示全部楼层
你用的esphome是哪个版本?我个人经验2022.12.0开始蓝牙协议栈存在一个严重的bug,迄今没有修复。所以推荐2022.11.5版本。

针对你说的这个现象,可以在esp32_ble_tracker:部分增加一个setup_priority:,取负值,意思是晚一点待其他部分包括wifi等启动后再启动这个组件,如下:
esp32_ble_tracker:
  scan_parameters:
   interval: 150ms
   window: 120ms
   duration: 3min
  setup_priority: -120

scan_parameters:那部分是我自己用的,意在增加蓝牙扫描的时间占比,避免漏掉蓝牙消息,也可以参考。
回复

使用道具 举报

9

主题

168

帖子

1702

积分

金牌会员

Rank: 6Rank: 6

积分
1702
金钱
1534
HASS币
10
发表于 2023-9-6 16:54:42 | 显示全部楼层
我使用的时Passive BLE Monitor integration,用ESP32转发。。挺稳定的,还支持蓝牙门锁。
回复

使用道具 举报

2

主题

11

帖子

214

积分

中级会员

Rank: 3Rank: 3

积分
214
金钱
203
HASS币
0
 楼主| 发表于 2023-9-6 17:45:01 | 显示全部楼层
XCray 发表于 2023-9-6 16:21
你用的esphome是哪个版本?我个人经验2022.12.0开始蓝牙协议栈存在一个严重的bug,迄今没有修复。所以推荐2 ...

目前用的是最新的固件,我刚刚尝试降了到了2022.11.5版本但是编译报错了。
不过wifi的问题似乎很顺利解决了,感谢解答。
回复

使用道具 举报

2

主题

11

帖子

214

积分

中级会员

Rank: 3Rank: 3

积分
214
金钱
203
HASS币
0
 楼主| 发表于 2023-9-6 17:50:01 | 显示全部楼层
65698888 发表于 2023-9-6 16:54
我使用的时Passive BLE Monitor integration,用ESP32转发。。挺稳定的,还支持蓝牙门锁。
...

我的蓝牙设备不是很多,米家系的也可以接入多模2,所以就没有折腾那个了
回复

使用道具 举报

2

主题

55

帖子

641

积分

高级会员

Rank: 4

积分
641
金钱
586
HASS币
0
发表于 2023-9-8 17:18:29 | 显示全部楼层
我直接,给esp32加个网口
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-26 21:49 , Processed in 0.323334 second(s), 28 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表