Loading...
Loading...
Compare original and translation side by side
templates/basic-device.yamlsensor-node.yamlrelay-switch.yamldisplay-node.yamltemplates/basic-device.yamlsensor-node.yamlrelay-switch.yamldisplay-node.yamlundefinedundefinedundefinedundefinedreferences/gpio-pinouts.mdreferences/gpio-pinouts.mdreferences/common-sensors.mdreferences/common-sensors.mdi2c:
sda: GPIO21
scl: GPIO22
scan: true
sensor:
- platform: bme280
temperature:
name: "Temperature"
humidity:
name: "Humidity"
pressure:
name: "Pressure"
address: 0x76
update_interval: 60ssensor:
- platform: dht
pin: GPIO4
model: DHT22
temperature:
name: "Temperature"
humidity:
name: "Humidity"
update_interval: 60sbinary_sensor:
- platform: gpio
pin: GPIO14
name: "Motion Sensor"
device_class: motioni2c:
sda: GPIO21
scl: GPIO22
scan: true
sensor:
- platform: bme280
temperature:
name: "Temperature"
humidity:
name: "Humidity"
pressure:
name: "Pressure"
address: 0x76
update_interval: 60ssensor:
- platform: dht
pin: GPIO4
model: DHT22
temperature:
name: "Temperature"
humidity:
name: "Humidity"
update_interval: 60sbinary_sensor:
- platform: gpio
pin: GPIO14
name: "Motion Sensor"
device_class: motionreferences/troubleshooting.md| Error Message | Quick Fix |
|---|---|
| "Unknown platform" | Check component name spelling, ensure platform supported |
| "GPIO already in use" | Check GPIO pin assignments, avoid duplicates |
| "Could not compile" | Check YAML syntax, verify indentation (2 spaces) |
| "WiFi connection failed" | Verify SSID/password, check signal strength, use static IP |
| "Sensor not found" | Check I²C address (use scan: true), verify wiring |
| "OTA upload failed" | Check device reachable, verify OTA password, restart device |
references/troubleshooting.md| 错误信息 | 快速修复方案 |
|---|---|
| "Unknown platform" | 检查组件名称拼写,确保平台受支持 |
| "GPIO already in use" | 检查GPIO引脚分配,避免重复使用 |
| "Could not compile" | 检查YAML语法,验证缩进(使用2个空格) |
| "WiFi connection failed" | 验证SSID/密码,检查信号强度,使用静态IP |
| "Sensor not found" | 检查I²C地址(启用scan: true),验证接线 |
| "OTA upload failed" | 检查设备是否可达,验证OTA密码,重启设备 |
esphome logs device.yamlreferences/troubleshooting.mdesphome logs device.yamlreferences/troubleshooting.mdscripts/validate-config.shundefinedscripts/validate-config.shundefined
**Validation Steps:**
1. **Syntax validation**: `esphome config my-device.yaml`
- Checks YAML syntax
- Validates component configuration
- Reports missing requirements
- Shows final configuration
2. **Compilation test**: `esphome compile my-device.yaml`
- Downloads required libraries
- Compiles firmware
- Reports errors and warnings
- Confirms configuration works
3. **Fix errors**: If validation fails:
- Review error messages
- Check GPIO conflicts
- Verify component platforms
- Consult `references/troubleshooting.md`
- Re-validate after fixes
**验证步骤:**
1. **语法验证**: `esphome config my-device.yaml`
- 检查YAML语法
- 验证组件配置
- 报告缺失的依赖
- 显示最终配置
2. **编译测试**: `esphome compile my-device.yaml`
- 下载所需库
- 编译固件
- 报告错误和警告
- 确认配置可用
3. **修复错误**: 如果验证失败:
- 查看错误信息
- 检查GPIO冲突
- 验证组件平台
- 参考`references/troubleshooting.md`
- 修复后重新验证undefinedundefinedundefinedundefinedsecrets.yamlwifi_ssid: "MyNetwork"
wifi_password: "MyPassword123"
api_encryption_key: "base64-generated-key"
ota_password: "SecureOTAPassword"wifi:
ssid: !secret wifi_ssid
password: !secret wifi_passwordsecrets.yamlwifi_ssid: "MyNetwork"
wifi_password: "MyPassword123"
api_encryption_key: "base64-generated-key"
ota_password: "SecureOTAPassword"wifi:
ssid: !secret wifi_ssid
password: !secret wifi_passwordbedroom-sensor"Bedroom Temperature"temp_sensorsensor:
- platform: dht
pin: GPIO4
temperature:
name: "Living Room Temperature"
id: living_room_temp
humidity:
name: "Living Room Humidity"
id: living_room_humiditybedroom-sensor"Bedroom Temperature"temp_sensorsensor:
- platform: dht
pin: GPIO4
temperature:
name: "Living Room Temperature"
id: living_room_temp
humidity:
name: "Living Room Humidity"
id: living_room_humidityreferences/gpio-pinouts.mdreferences/common-sensors.mdreferences/troubleshooting.mdreferences/gpio-pinouts.mdreferences/common-sensors.mdreferences/troubleshooting.mdtemplates/basic-device.yamlsensor-node.yamlrelay-switch.yamldisplay-node.yamltemplates/basic-device.yamlsensor-node.yamlrelay-switch.yamldisplay-node.yamlscripts/validate-config.shscripts/validate-config.shreferences/gpio-pinouts.mdscripts/validate-config.shreferences/troubleshooting.mdreferences/gpio-pinouts.mdreferences/gpio-pinouts.mdscripts/validate-config.shreferences/troubleshooting.mdreferences/gpio-pinouts.md