本帖最后由 douglasleft 于 2024-7-6 22:59 编辑
合宙的ESP32c3物美价廉,自带通讯模块。但是刷ESPhome和ESPresense 的时候总容易出错。试了试容易错的原因在于要配置双IO 即flash_mode: dio ,而刷ESPresense 需要用到合宙的bootloader以及更改dio配置后重新编译esp32c3.bin
给一下ESPhome 和 ESPresense 的配置和文件,少踩坑
ESPhome配置:
substitutions:
device: ble_gateway
device_name: blegateway
esphome:
name: $device_name
platformio_options:
board_build.flash_mode: dio
board_build.mcu: esp32c3
esp32:
board: esp32-c3-devkitm-1
variant: esp32c3
framework:
type: esp-idf
external_components:
- source: github://myhomeiot/esphome-components
logger:
hardware_uart: USB_SERIAL_JTAG
level: DEBUG
api:
reboot_timeout: 1h
ota:
- platform: esphome
password: !secret ota_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
ap:
ssid: "$device_name Fallback Hotspot"
password: !secret ap_password
captive_portal:
web_server:
port: 80
bluetooth_proxy:
active: true
esp32_ble_tracker:
ble_gateway:
id: $device_name
on_ble_advertise:
then:
- homeassistant.service:
service: ble_monitor.parse_data
data:
packet: !lambda return packet;
gateway_id: $device_name
- homeassistant.event:
event: esphome.on_ble_advertise
data:
packet: !lambda return packet;
binary_sensor:
- platform: homeassistant
id: ble_gateway_discovery
entity_id: binary_sensor.ble_gateway
attribute: discovery
on_state:
then:
lambda: id($device_name).set_discovery(x);
text_sensor:
- platform: homeassistant
id: ble_gateway_devices
entity_id: binary_sensor.ble_gateway
attribute: devices
on_value:
then:
lambda: id($device_name).set_devices(x);
- platform: wifi_info
ip_address:
name: $device_name IP address
id: ip_address
- platform: version
name: ESPHome Version
sensor:
- platform: wifi_signal
name: $device_name WiFi Signal Sensor
update_interval: 60s
scerets
wifi_ssid: "xxxx"
wifi_password: "xxxx"
ap_password: "12345678"
ota_password: "12345678"
ESPresense:
命令
esptool.exe --port COM3 write_flash --flash_mode dio -z 0x0000 bootloader_luatos.bin 0x8000 partitions.bin 0xe000 boot_app0.bin 0x10000 esp32c3.bin
文件:
esptool-win64.zip
(861.95 KB, 下载次数: 76)
|