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

 找回密码
 立即注册
12
返回列表 发新帖
楼主: ghdong

[经验分享] 正泰DTSU666三相四线电表RS485 modbus tcp连接使用配置分享

[复制链接]

3

主题

79

帖子

1193

积分

金牌会员

Rank: 6Rank: 6

积分
1193
金钱
1114
HASS币
0
发表于 2024-1-21 23:06:06 | 显示全部楼层
感谢楼主的信息。我用这个信息编写了一个esphome的dtsu666的配置文件。
esphome:
  name: meter-dtsu666
  friendly_name: meter-dtsu666

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "#########"  #需要替换的字段

ota:
  password: "########"  #需要替换的字段

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Meter-Dtsu666 Fallback Hotspot"
    password: "0Ssqzmbjravu"

# Enable Web server
web_server:
  port: 80

captive_portal:
###


globals:
  - id: chint_energy_cal
    type: std::uint32_t
    restore_value: yes
    initial_value: '0'

uart:
  id: mod_bus
  tx_pin: GPIO13 # connected to tx on modbus converter
  rx_pin: GPIO12 # connected to rx on modbus converter
  baud_rate: 9600
  stop_bits: 1
  data_bits: 8

modbus:
  send_wait_time: 2000ms
  id: modbus1

#address chint dtsu666 
modbus_controller:
    address: 0x1
    modbus_id: modbus1
    update_interval: 1s
    setup_priority: -10
    command_throttle: 20ms

sensor:

 - platform: modbus_controller
   id: chint_voltage_a
   name: "chint voltage phase 1"
   address: 0x2006
   unit_of_measurement: "V"
   register_type: holding
   value_type: FP32
   accuracy_decimals: 1
   filters:
     - multiply: 0.1

 - platform: modbus_controller
   id: chint_voltage_b
   name: "chint voltage phase 2"
   address: 0x2008
   unit_of_measurement: "V"
   register_type: holding
   value_type: FP32
   accuracy_decimals: 1
   filters:
     - multiply: 0.1

 - platform: modbus_controller
   id: chint_voltage_c
   name: "chint voltage phase 3"
   address: 0x200A
   unit_of_measurement: "V"
   register_type: holding
   value_type: FP32
   accuracy_decimals: 1
   filters:
     - multiply: 0.1
    
 - platform: modbus_controller
   id: chint_current_a
   name: "chint current phase 1"
   address: 0x200C
   unit_of_measurement: "A"
   register_type: holding
   value_type: FP32
   accuracy_decimals: 2
   filters:
     - multiply: 0.01

 - platform: modbus_controller
   id: chint_current_b
   name: "chint current phase 2"
   address: 0x200E
   unit_of_measurement: "A"
   register_type: holding
   value_type: FP32
   accuracy_decimals: 2
   filters:
     - multiply: 0.01

 - platform: modbus_controller
   id: chint_current_c
   name: "chint current phase 3"
   address: 0x2010
   unit_of_measurement: "A"
   register_type: holding
   value_type: FP32
   accuracy_decimals: 2
   filters:
     - multiply: 0.01

 - platform: modbus_controller
   id: chint_frequency
   name: "chint frequency"
   address: 0x2044
   unit_of_measurement: "Hz"
   register_type: holding
   value_type: FP32
   accuracy_decimals: 2
   filters:
     - multiply: 0.01

 - platform: modbus_controller
   id: chint_voltage_a_to_b
   name: "chint voltage phase 1 to 2"
   address: 0x2000
   unit_of_measurement: "V"
   register_type: holding
   value_type: FP32
   accuracy_decimals: 1
   filters:
     - multiply: 0.1

 - platform: modbus_controller
   id: chint_voltage_c_to_b
   name: "chint voltage phase 2 to 3"
   address: 0x2002
   unit_of_measurement: "V"
   register_type: holding
   value_type: FP32
   accuracy_decimals: 1
   filters:
     - multiply: 0.1

 - platform: modbus_controller
   id: chint_voltage_a_to_c
   name: "chint voltage phase 3 to 1"
   address: 0x2004
   unit_of_measurement: "V"
   register_type: holding
   value_type: FP32
   accuracy_decimals: 1
   filters:
     - multiply: 0.1

 - platform: modbus_controller
   id: chint_active_power_total
   name: "chint active power total"
   address: 0x2012
   unit_of_measurement: "W"
   register_type: holding
   value_type: FP32
   accuracy_decimals: 0

 - platform: modbus_controller
   id: chint_active_power_phase_a
   name: "chint active power phase 1"
   address: 0x2014
   unit_of_measurement: "W"
   register_type: holding
   value_type: FP32
   accuracy_decimals: 0

 - platform: modbus_controller
   id: chint_active_power_phase_b
   name: "chint active power phase 2"
   address: 0x2016
   unit_of_measurement: "W"
   register_type: holding
   value_type: FP32
   accuracy_decimals: 0

 - platform: modbus_controller
   id: chint_active_power_phase_c
   name: "chint active power phase 3"
   address: 0x2018
   unit_of_measurement: "W"
   register_type: holding
   value_type: FP32
   accuracy_decimals: 0

 - platform: modbus_controller
   id: chint_reactive_power_total
   name: "chint reactive power total"
   address: 0x201A
   unit_of_measurement: "VAR"
   register_type: holding
   value_type: FP32
   accuracy_decimals: 0

 - platform: modbus_controller
   id: chint_reactive_power_phase_a
   name: "chint reactive power phase 1"
   address: 0x201C
   unit_of_measurement: "VAR"
   register_type: holding
   value_type: FP32
   accuracy_decimals: 0

 - platform: modbus_controller
   id: chint_reactive_power_phase_b
   name: "chint reactive power phase 2"
   address: 0x201E
   unit_of_measurement: "VAR"
   register_type: holding
   value_type: FP32
   accuracy_decimals: 0

 - platform: modbus_controller
   id: chint_reactive_power_phase_c
   name: "chint reactive power phase 3"
   address: 0x2020
   unit_of_measurement: "VAR"
   register_type: holding
   value_type: FP32
   accuracy_decimals: 0
   force_new_range: true

 - platform: modbus_controller
   id: chint_forward_energy_total
   name: "chint energy total from grid"
   address: 0x1028
   unit_of_measurement: "kWh"
   register_type: holding
   value_type: FP32
   accuracy_decimals: 2
   filters:
     - multiply: 0.01
     - lambda: |-
            float MAX_DIFFERENCE = 1.0;  // adjust this!
            static float last_value = NAN;
            if (isnan(last_value) || std::abs(x - last_value) < MAX_DIFFERENCE)
              return last_value = x;
            else
              return {};
 - platform: modbus_controller
   id: chint_reversing_energy_total
   name: "chint energy total to grid"
   address: 0x101E
   unit_of_measurement: "kWh"
   register_type: holding
   value_type: FP32
   accuracy_decimals: 2
   filters:
     - multiply: 0.01
     - lambda: |-
            float MAX_DIFFERENCE = 1.0;  // adjust this!
            static float last_value = NAN;
            if (isnan(last_value) || std::abs(x - last_value) < MAX_DIFFERENCE)
              return last_value = x;
            else
              return {};

 - platform: modbus_controller
   id: chint_power_factor_total
   name: "chint power factor total"
   address: 0x202A
   unit_of_measurement: "cosphi"
   register_type: holding
   value_type: FP32
   accuracy_decimals: 3
   filters:
     - multiply: 0.001

 - platform: modbus_controller
   id: chint_power_factor_phase_a
   name: "chint power factor phase 1"
   address: 0x202C
   unit_of_measurement: "cosphi"
   register_type: holding
   value_type: FP32
   accuracy_decimals: 3
   filters:
     - multiply: 0.001

 - platform: modbus_controller
   id: chint_power_factor_phase_b
   name: "chint power factor phase 2"
   address: 0x202E
   unit_of_measurement: "cosphi"
   register_type: holding
   value_type: FP32
   accuracy_decimals: 3
   filters:
     - multiply: 0.001

 - platform: modbus_controller
   id: chint_power_factor_phase_c
   name: "chint power factor phase 3"
   address: 0x2030
   unit_of_measurement: "cosphi"
   register_type: holding
   value_type: FP32
   accuracy_decimals: 3
   filters:
     - multiply: 0.001

# Todo: use correct sensor name and mark the original sensor as internal
 - platform: template
   name: "Total Energy"
   id: "energy_total"
   accuracy_decimals: 2
   unit_of_measurement: "kWh"
   device_class: energy
   state_class: measurement
   icon: mdi:total_increasing
   lambda: |-
       return (id(chint_forward_energy_total).state - id(chint_reversing_energy_total));
#   update_interval: 15s


# Todo: Test lambda!
button:
  - platform: template
    name: "Chin Chin reset total energy"
    entity_category: "config"
    on_press:
      then:
        - lambda: |-
            id(chint_energy_cal) = id(chint_forward_energy_total).state;
  - platform: safe_mode
    name: "Chin Chin Restart (Safe Mode)"
  - platform: restart
    name: "Chin Chin Restart"    

评分

参与人数 1金钱 +16 收起 理由
sorrypqa + 16 高手,这是高手!

查看全部评分

回复

使用道具 举报

0

主题

8

帖子

190

积分

注册会员

Rank: 2

积分
190
金钱
182
HASS币
0
发表于 2024-2-26 21:39:07 | 显示全部楼层
谢谢。我发现两个问题:

- 新版本的HA, 需要把’count: 2‘删除。
- 有功总电能" 的地址应该是 101E, 正向有功总电能。
附DTSU666说明书。

DTSU666昆仑系列新国标的说明书 (11).pdf

1.39 MB, 下载次数: 28

回复

使用道具 举报

24

主题

884

帖子

5055

积分

论坛元老

Rank: 8Rank: 8

积分
5055
金钱
4166
HASS币
20
发表于 2024-3-20 22:17:30 | 显示全部楼层
tcp模式下,多个电表用手拉手方式串联起来的话,配置应该怎么写。现在只接一个电表正常读书,接多个读数就出错或者“不再可用”
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-25 14:45 , Processed in 0.166462 second(s), 26 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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