Peacefair PZEM-00X 直流电能监控器
pzemdc 传感器平台允许您在 ESPHome 中使用各种 Peacefair PZEM 直流电能监控器。
支持的型号有:PZEM-003、PZEM-014、PZEM-016 和 PZEM-017。
此组件通过 UART 进行通信。
因此,您必须在配置中添加一个 uart: 条目,并将 TX 和 RX 引脚设置为开发板上的某些引脚,
波特率设置为 9600。
# 示例配置条目uart: tx_pin: D1 rx_pin: D2 baud_rate: 9600 stop_bits: 2
sensor: - platform: pzemdc current: name: "PZEM-003 电流" voltage: name: "PZEM-003 电压" power: name: "PZEM-003 功率" energy: name: "PZEM-003 电能" update_interval: 60s-
current (可选): 使用传感器的电流值,单位为安培。来自 Sensor 的所有选项。
-
power (可选): 使用传感器的功率值,单位为瓦特。来自 Sensor 的所有选项。
-
voltage (可选): 使用传感器的电压值,单位为伏特。 来自 Sensor 的所有选项。
-
energy (可选): 使用传感器的电能值,单位为 kWh。 来自 Sensor 的所有选项。
-
update_interval (可选, 时间): 检查传感器的间隔。 默认为
60s。 -
address (可选, int): 如果多个传感器连接到同一个 UART 总线,则为传感器的地址。 您需要手动设置每个设备的地址。默认为
1。
pzemdc.reset_energy 动作
Section titled “pzemdc.reset_energy 动作”此动作在执行时重置指定 ID 的 pzemdc 设备的总电能值。
on_...: then: - pzemdc.reset_energy: pzemdc_1