找回密码
 立即注册

微信扫码登录

搜索
查看: 730|回复: 6

[硬件DIY] 大伙谁用了培正的直流电表模块pzem-017

[复制链接]

31

主题

180

回帖

1117

积分

金牌会员

积分
1117
金钱
906
HASS币
0
发表于 2025-11-24 07:24:24 来自手机 | 显示全部楼层 |阅读模式
我得电流越来越不准…没输入时都显示四五百ma,有啥办法用串口命令调整校准吗?找官方给了个上位机软件…必须拆下来,而且还得有20v10a标准电源才可以…太麻烦了
Screenshot_2025-11-24-07-19-12-666_io.homeassistant.companion.android.jpg
回复

使用道具 举报

76

主题

437

回帖

4168

积分

论坛元老

积分
4168
金钱
3655
HASS币
0
发表于 2025-11-24 09:46:36 | 显示全部楼层
毕竟没有通过计量认证
回复

使用道具 举报

1

主题

45

回帖

851

积分

高级会员

积分
851
金钱
805
HASS币
0
发表于 2025-11-25 09:16:10 | 显示全部楼层
# 电池保护电压设置及校准
number:
  - platform: template
    name: "SET_guochong"
    id: charge_stop_voltage
    min_value: 10.0
    max_value: 65.0
    step: 0.1
    mode: box 
    initial_value: 55.5
    unit_of_measurement: "V"
    optimistic: true
    restore_value: true
    icon: "mdi:battery-charging"
    
  - platform: template
    name: "SET_guofang"
    id: discharge_stop_voltage
    min_value: 10.0
    max_value: 65.0
    step: 0.1
    mode: box 
    initial_value: 41.0
    unit_of_measurement: "V"
    optimistic: true
    restore_value: true
    icon: "mdi:battery-alert"

# 新增过电流保护设置
  - platform: template
    name: "SET_guoliu"
    id: over_current_threshold
    min_value: 1.0
    max_value: 35.0
    step: 0.1
    mode: box
    initial_value: 20.0
    unit_of_measurement: "A"
    optimistic: true
    restore_value: true
    icon: "mdi:current-ac"
    entity_category: "config"






# 电压校准设置
  - platform: template
    name: "Voltage Calibration Multiplier"
    id: voltage_calibration_multiplier
    min_value: 0.8
    max_value: 1.2
    step: 0.001
    mode: box
    initial_value: 1.0
    optimistic: true
    restore_value: true
    icon: "mdi:flash"
    entity_category: "config"
    
  - platform: template
    name: "Voltage Calibration Offset"
    id: voltage_calibration_offset
    min_value: -1.0
    max_value: 1.0
    step: 0.001
    mode: box
    initial_value: 0.0
    unit_of_measurement: "V"
    optimistic: true
    restore_value: true
    icon: "mdi:plus-minus"
    entity_category: "config"

# 电流校准设置
  - platform: template
    name: "Current Calibration Multiplier"
    id: current_calibration_multiplier
    min_value: 0.8
    max_value: 1.2
    step: 0.001
    mode: box
    initial_value: 1.0
    optimistic: true
    restore_value: true
    icon: "mdi:current-ac"
    entity_category: "config"
    
  - platform: template
    name: "Current Calibration Offset"
    id: current_calibration_offset
    min_value: -0.5
    max_value: 0.5
    step: 0.001
    mode: box
    initial_value: 0.0
    unit_of_measurement: "A"
    optimistic: true
    restore_value: true
    icon: "mdi:plus-minus"
    entity_category: "config"

# 功率校准设置
  - platform: template
    name: "Power Calibration Multiplier"
    id: power_calibration_multiplier
    min_value: 0.8
    max_value: 1.2
    step: 0.001
    mode: box
    initial_value: 1.0
    optimistic: true
    restore_value: true
    icon: "mdi:gauge"
    entity_category: "config"
    
  - platform: template
    name: "Power Calibration Offset"
    id: power_calibration_offset
    min_value: -10.0
    max_value: 10.0
    step: 0.001
    mode: box
    initial_value: 0.0
    unit_of_measurement: "W"
    optimistic: true
    restore_value: true
    icon: "mdi:plus-minus"
    entity_category: "config"




sensor:
  - platform: pzemdc
    update_interval: 5s  # 增加更新间隔减少负载
    
    current:
      name: "pzem_current"
      id: pzem_current
      accuracy_decimals: 2
      filters:
        - throttle: 10s  # 添加节流
        - timeout:
            timeout: 60s  # 增加超时时间
            value: 0.0
        - calibrate_linear:
            - 0.00 -> 0.0
            - 4.00 -> 1.55
        - lambda: |-
            float calibrated_value = (x * id(current_calibration_multiplier).state) + id(current_calibration_offset).state;
            return calibrated_value;
            
    voltage:
      name: "pzem_voltage"
      id: pzem_voltage
      accuracy_decimals: 2
      filters:
        - throttle: 10s
        - timeout:
            timeout: 60s
            value: 0.0
        - calibrate_linear:
            - 0.00 -> 0.0
            - 12.94 -> 12.85
        - lambda: |-
            float calibrated_value = (x * id(voltage_calibration_multiplier).state) + id(voltage_calibration_offset).state;
            return calibrated_value;

    power:
      name: "pzem_power"
      id: pzem_power
      accuracy_decimals: 2
      filters:
        - throttle: 10s
        - timeout:
            timeout: 60s
            value: 0.0
        - calibrate_linear:
            - 0.00 -> 0.0
            - 51.30 -> 19.78
        - lambda: |-
            float calibrated_value = (x * id(power_calibration_multiplier).state) + id(power_calibration_offset).state;
            return calibrated_value;
            
    energy:
      name: "pzem_energy"
      accuracy_decimals: 2
      unit_of_measurement: "kWh"
回复

使用道具 举报

1

主题

45

回帖

851

积分

高级会员

积分
851
金钱
805
HASS币
0
发表于 2025-11-25 09:17:11 | 显示全部楼层

这是我现在用的代码,看看对你是否有用
回复

使用道具 举报

31

主题

180

回帖

1117

积分

金牌会员

积分
1117
金钱
906
HASS币
0
 楼主| 发表于 2025-11-25 10:12:55 来自手机 | 显示全部楼层
348579473 发表于 2025-11-25 09:17
这是我现在用的代码,看看对你是否有用

不明觉厉,多谢
回复

使用道具 举报

jjcs 手机认证

58

主题

2087

回帖

8603

积分

论坛元老

积分
8603
金钱
6448
HASS币
50
发表于 2025-11-25 19:46:03 | 显示全部楼层
培正的玩意精度是个玄学
折腾精神永存,感恩感谢论坛每一位愿意分享和帮助过我的大佬,论坛有你更精彩
回复

使用道具 举报

74

主题

520

回帖

2469

积分

金牌会员

积分
2469
金钱
1875
HASS币
50
发表于 2025-11-25 21:48:30 | 显示全部楼层
我用的正泰ddsu666带485协议的 通过esp8266接入ha。
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian ( 晋ICP备17001384号-1 )

GMT+8, 2026-1-16 13:58 , Processed in 1.642402 second(s), 8 queries , MemCached On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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