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

 找回密码
 立即注册
查看: 1293|回复: 1

[技术探讨] 培正004T接入求助

[复制链接]

17

主题

188

帖子

1793

积分

金牌会员

Rank: 6Rank: 6

积分
1793
金钱
1605
HASS币
0
发表于 2023-9-9 15:08:35 | 显示全部楼层 |阅读模式
家里三相四线入户,买了3个培正004T装上已经能读取到数据,目前有几个疑问:
1、无法接入能源,代码中已按本坛里的坛友添加了数据,请看下面
但是在能源页面添加用电数据时没有设备可以添加,显示的都是不存在的一些设备
1.png
uart:
  tx_pin: GPIO1
  rx_pin: GPIO3
  baud_rate: 9600
  stop_bits: 1

modbus:

sensor:
  - platform: pzemac
    address: 1
    id: pzemac_1
    energy:
      name: "PZEM_1 Energy"
      filters:
        - multiply: 0.001
      unit_of_measurement: kWH
      accuracy_decimals: 2
      device_class: energy
      state_class: total_increasing
    voltage:
      name: "PZEM_1 Voltage"
    current:
      name: "PZEM_1 Current"
    power:
      name: "PZEM_1 Power"
    power_factor:
      name: "PZEM_1 Power Factor"
    frequency:
      name: "PZEM_1 Frequency"
    update_interval: 30s

  - platform: pzemac
    address: 2
    id: pzemac_2
    energy:
      name: "PZEM_2 Energy"
      filters:
        - multiply: 0.001
      unit_of_measurement: kWH
      accuracy_decimals: 2
      device_class: energy
      state_class: total_increasing
    voltage:
      name: "PZEM_2 Voltage"
    current:
      name: "PZEM_2 Current"
    power:
      name: "PZEM_2 Power"
    power_factor:
      name: "PZEM_2 Power Factor"
    frequency:
      name: "PZEM_2 Frequency"
    update_interval: 30s

  - platform: pzemac
    address: 3
    id: pzemac_3
    energy:
      name: "PZEM_3 Energy"
      filters:
        - multiply: 0.001
      unit_of_measurement: kWH
      accuracy_decimals: 2
      device_class: energy
      state_class: total_increasing
    voltage:
      name: "PZEM_3 Voltage"
    current:
      name: "PZEM_3 Current"
    power:
      name: "PZEM_3 Power"
    power_factor:
      name: "PZEM_3 Power Factor"
    frequency:
      name: "PZEM_3 Frequency"
    update_interval: 30s


button:
  - platform: template
    name: "kWh_1 reset"
    on_press:
      - pzemac.reset_energy: pzemac_1
  - platform: template
    name: "kWh_2 reset"
    on_press:
      - pzemac.reset_energy: pzemac_2
  - platform: template
    name: "kWh_3 reset"
    on_press:
      - pzemac.reset_energy: pzemac_3


2、上面代码中添加了复位按钮,也是取自本坛的网友的,但是点击按钮后电能数据没有归零,是什么原因?

回复

使用道具 举报

9

主题

46

帖子

1095

积分

金牌会员

Rank: 6Rank: 6

积分
1095
金钱
1049
HASS币
0
发表于 2023-9-11 19:16:13 | 显示全部楼层
我也是按别人说的转换一下后就可以在能源面板添加了
utility_meter:
  daily_energy:
    source: sensor.zong_dian_liang
    name: Daily Energy
    cycle: daily
    tariffs:
      - peak
      - offpeak
  monthly_energy:
    source: sensor.zong_dian_liang
    name: Monthly Energy
    cycle: monthly
    tariffs:
      - peak
      - offpeak
  yearly_energy:
    source: sensor.zong_dian_liang
    cycle: yearly
    tariffs:
      - peak
      - offpeak    
  server_energy_zong:
    source: sensor.zong_dian_liang


回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-26 21:37 , Processed in 0.057908 second(s), 26 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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