老版本的是没有耗能统计,我用的是论坛里提供的方法修改的增加了能耗。但是新版的已经有了。
substitutions:
device_name: pzem_004t_v3 #设备名称(多个改成不一样的)
wifi_ssid: 'zzzzzz' #WiFi_SSID名称
wifi_password: 'zzzzz' #WiFi密码
wifi_ssid_AP: 'pzem_004t_v3'
wifi_password_AP: 'zzzzz' #ap_WiFi密码
wifi_static_ip: 192.168.3.40
wifi_gateway: 192.168.3.1
wifi_subnet: 255.255.255.0
wifi_dns1: 192.168.3.1
wifi_dns2: 192.168.3.1
wifi_fast_connect: 'false' #如果SSID是隐藏的,设置为true
wifi_reboot_timeout: 0s #WiFi离线多久后重启设备,秒s/分钟min/小时h,不需要此功能设置为0s
ota_password: 'zzzzz' #OTA密码
api_password: 'zzzzz' #API密码
api_reboot_timeout: 0s #与客户端(如Home Assistant)失去连接多久后重启设备,秒s/分钟min/小时h,不需要此功能设置为0s
esphome:
name: $device_name
platform: ESP8266
board: esp01_1m
wifi:
ssid: $wifi_ssid
password: $wifi_password
#可选,手工指定IP地址
manual_ip:
static_ip: $wifi_static_ip
gateway: $wifi_gateway
subnet: $wifi_subnet
dns1: $wifi_dns1 #(可选)
dns2: $wifi_dns2 #(可选)
use_address: $wifi_static_ip #(可选,字符串)手动覆盖用于连接ESP的地址。默认为自动生成的值。例如,如果您更改了静态IP并想将OTA刷新为先前配置的IP地址。
domain: .local #(可选,字符串):设置用于上传的节点主机名的域。例如,如果将其设置为.local,则所有上传将发送到<HOSTNAME>.local。默认为.local。
reboot_timeout: $wifi_reboot_timeout #(可选)wifi连接失败后重启时间,0s禁用。默认为15min。
power_save_mode: "NONE" #(可选,字符串) WiFi省电模式。NONE(省电最少,ESP8266默认) LIGHT(ESP32默认) HIGH(最省电)
fast_connect: $wifi_fast_connect #(可选,on,off)直连WIFI,而不进行信号强弱扫描
id: #(可选)手动指定用于代码生成的ID。
#无线没有连接的时候用以下信息转为AP模式
ap:
ssid: $wifi_ssid_AP
password: $wifi_password_AP
channel: 1 #(可选)AP应该在1到14上运行的信道。默认为1。
manual_ip: #(可选)手动设置AP的IP选项。与工作站模式的manual_ip相同
static_ip: 192.168.4.1
gateway: 192.168.4.1
subnet: 255.255.255.0
ap_timeout: 1min #(可选)启用配置的后备热点的时间。默认为1min。
captive_portal:
# Enable logging
# logger:
# level: NONE
# hardware_uart: UART1
# web_server:
# Enable Home Assistant API
api:
password: $api_password
reboot_timeout: $api_reboot_timeout
ota:
password: $ota_password
sensor: #传感器
- platform: pzemac
current:
name: "CH_1_Current"
voltage:
name: "CH_1_Voltage"
power:
name: "CH_1_Power"
energy:
name: "CH_1_Energy"
frequency:
name: "CH_1_Frequency"
power_factor:
name: "CH_1_Power Factor"
update_interval: 5s
address: 1
- platform: pzemac
current:
name: "CH_2_Current"
voltage:
name: "CH_2_Voltage"
power:
name: "CH_2_Power"
energy:
name: "CH_2_Energy"
frequency:
name: "CH_2_Frequency"
power_factor:
name: "CH_2_Power Factor"
update_interval: 5s
address: 2
- platform: pzemac
current:
name: "CH_3_Current"
voltage:
name: "CH_3_Voltage"
power:
name: "CH_3_Power"
energy:
name: "CH_3_Energy"
frequency:
name: "CH_3_Frequency"
power_factor:
name: "CH_3_Power Factor"
update_interval: 5s
address: 3
uart:
tx_pin: 1
rx_pin: 3
baud_rate: 9600
stop_bits: 1
复制代码