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

标题: 正泰DTSU666三相四线电表RS485 modbus tcp连接使用配置分享 [打印本页]

作者: ghdong    时间: 2023-2-22 09:46
标题: 正泰DTSU666三相四线电表RS485 modbus tcp连接使用配置分享
本帖最后由 ghdong 于 2023-2-23 15:58 编辑

市面上正泰无论是ddsu 单相表还是dtsu三相表485出厂协议有两种DL/T645-2007 和modbus rtu 三相带通讯价格在200左右,modbus好像会贵个十几 二十块钱,单相强烈建议购买出厂协议为modbus的。因为新款单相的虽然有按键了,但只有一个按键,不能修改只能查看。 三相的有三个按键 可以通过按键菜单修改协议和其他参数。[attach]45604[/attach]


1. type可以填tcp 和rtuovertcp ,如果网关转换就填tcp ,否则就由ha 转换填rtuovertcp
2.网关每个端口智能一个客户端连接,否则数据会错乱,要多个连接,就要新建一个端口
3.address 可以填十进制也可以填16进制 ,16进制以0x开头,直接抄说明书地址即可不用转换,更方便。
4.当显示数字很大很小的时候可以调整 scale  如:0. 01 0.1   1000等
5.slave 为电表地址,串接多个设备时需要调整设备地址
6.precision 为小数点精度
7. data_type 为float32 ,   float16我试了不行
8.        state_class: total        device_class: energy  如果要在能源中使用 请设置这两个参数

9,网关的波特率,位数,停止位,必须和电表一致。
  1. modbus:
  2.   - type: tcp
  3.     host: 192.168.1.136
  4.     port: 9998
  5.     name: "net1"
  6.     sensors:
  7.       - name: "电压AB"
  8.         address: 0x2000
  9.         scale: 0.1
  10.         slave: 1
  11.         count: 2
  12.         precision: 2
  13.         unit_of_measurement: V
  14.         data_type: float32
  15.         unique_id: "330421101"
  16.       - name: "电压BC"
  17.         address: 0x2002
  18.         scale: 0.1
  19.         slave: 1
  20.         count: 2
  21.         precision: 2
  22.         unit_of_measurement: V
  23.         data_type: float32
  24.         unique_id: "330421102"        
  25.       - name: "电压CA"
  26.         address: 0x2004
  27.         scale: 0.1
  28.         slave: 1
  29.         count: 2
  30.         precision: 2
  31.         unit_of_measurement: V
  32.         data_type: float32
  33.         unique_id: "330421103"
  34.       - name: "电压A"
  35.         address: 0x2006
  36.         scale: 0.1
  37.         slave: 1
  38.         count: 2
  39.         precision: 2
  40.         unit_of_measurement: V
  41.         data_type: float32
  42.         unique_id: "330421104"   
  43.       - name: "电压B"
  44.         address: 0x2008
  45.         scale: 0.1
  46.         slave: 1
  47.         count: 2
  48.         precision: 2
  49.         unit_of_measurement: V
  50.         data_type: float32
  51.         unique_id: "330421105"
  52.       - name: "电压C"
  53.         address: 0x200A
  54.         scale: 0.1
  55.         slave: 1
  56.         count: 2
  57.         precision: 2
  58.         unit_of_measurement: V
  59.         data_type: float32
  60.         unique_id: "330421106"        
  61.         
  62.         
  63.         
  64.         
  65.         

  66.         
  67.         
  68.         
  69.       - name: "瞬时总有功功率"
  70.         address: 0x2012
  71.         slave: 1
  72.         count: 2
  73.         precision: 2
  74.         scale: 0.1
  75.         unit_of_measurement: W
  76.         data_type: float32
  77.         unique_id: "330421110"
  78.       - name: "A相有功功率"
  79.         address: 0x2014
  80.         slave: 1
  81.         count: 2
  82.         precision: 2
  83.         scale: 0.1
  84.         unit_of_measurement: W
  85.         data_type: float32
  86.         unique_id: "330421111"
  87.       - name: "B相有功功率"
  88.         address: 0x2016
  89.         slave: 1
  90.         count: 2
  91.         precision: 2
  92.         scale: 0.1
  93.         unit_of_measurement: W
  94.         data_type: float32
  95.         unique_id: "330421112"
  96.       - name: "C相有功功率"
  97.         address: 0x2018
  98.         slave: 1
  99.         count: 2
  100.         precision: 2
  101.         scale: 0.1
  102.         unit_of_measurement: W
  103.         data_type: float32
  104.         unique_id: "330421113"
  105.       - name: "电网频率"
  106.         address: 0x2044
  107.         slave: 1
  108.         scale: 0.01
  109.         count: 2
  110.         precision: 2
  111.         unit_of_measurement: Hz
  112.         data_type: float32
  113.         unique_id: "330421114"
  114.       - name: "有功总电能"
  115.         address: 0x1028
  116.         slave: 1
  117.         count: 2
  118.         precision: 2
  119.         state_class: total
  120.         device_class: energy
  121.         unit_of_measurement: kWh
  122.         data_type: float32
  123.         unique_id: "33042115"


复制代码






作者: yiwlg    时间: 2023-2-25 09:34
DL/T645-2007电表便宜一点
Modbus的,好多都好贵,出租房的想更换,都无从下手
作者: ghdong    时间: 2023-2-25 12:39
yiwlg 发表于 2023-2-25 09:34
DL/T645-2007电表便宜一点
Modbus的,好多都好贵,出租房的想更换,都无从下手

645的也是带modbus协议的,只是默认出厂协议不一样,一个是645,一个是modbus,
三相带协议的通过按键就可以改,三相的200左右,高于这个价格都是官方价格了。
作者: zhenxiwen    时间: 2023-3-16 14:02
本帖最后由 zhenxiwen 于 2023-3-16 19:34 编辑

正泰DTSU666三相四线电表、韩枫标准导轨式rs485转wifi窜口服务器模块,都买来好久了,也已经装在电箱里,但参考论坛大佬的帖子,试了很多方法都一直无法读取到数据和接入ha,总是显示 unavailable。我参照你的帖子,在电表、窜口模块和ha都做了同样的设置,同样无法读取数据,显示 unavailable。不知是哪里问题,请大佬帮助。

[attach]46344[/attach]


接线方法是参照这个大佬的帖子做的:
DDSU666电表和485转wifi简单配置
https://bbs.hassbian.com/thread-15924-1-1.html
(出处: 『瀚思彼岸』» 智能家居技术论坛)


解决了: 是因为韩枫窜口服务器设置不对。



作者: ghdong    时间: 2023-3-20 11:03
本帖最后由 ghdong 于 2023-3-20 11:06 编辑
zhenxiwen 发表于 2023-3-16 14:02
正泰DTSU666三相四线电表、韩枫标准导轨式rs485转wifi窜口服务器模块,都买来好久了,也已经装在电箱里,但 ...

配置发出看看。网关这里设置参数对不对。
作者: p0we7    时间: 2023-6-8 02:04
楼主,你倒数第二第三个图片的网页,是什么东西的页面啊?有ESP32 刷固件后的页面吗?有没有连接,我也想搞这个。

之前买了那个培正的第三方DIY的,搞了十多天各种问题很烦人。
作者: ghdong    时间: 2023-6-20 13:31
p0we7 发表于 2023-6-8 02:04
楼主,你倒数第二第三个图片的网页,是什么东西的页面啊?有ESP32 刷固件后的页面吗?有没有连接,我也想搞 ...

这个是485网关的配置界面
这个不是用esp方案的.
这个要买正泰的电表和485网关。
https://item.taobao.com/item.htm ... 6&_u=kj43nhea82
作者: lightliang    时间: 2023-7-5 19:44
zhenxiwen 发表于 2023-3-16 14:02
正泰DTSU666三相四线电表、韩枫标准导轨式rs485转wifi窜口服务器模块,都买来好久了,也已经装在电箱里,但 ...

我的症状跟您的一样,
窜口服务器设置    哪里要注意,能贴图学习一下吗?
作者: p0we7    时间: 2023-8-1 22:31
ghdong 发表于 2023-6-20 13:31
这个是485网关的配置界面
这个不是用esp方案的.
这个要买正泰的电表和485网关。

谢谢回复。
再请教一下,正泰的这个 DTSU666 支不支持用线圈测电流的?

作者: ghdong    时间: 2023-8-12 10:29
本帖最后由 ghdong 于 2023-8-12 10:34 编辑
p0we7 发表于 2023-8-1 22:31
谢谢回复。
再请教一下,正泰的这个 DTSU666 支不支持用线圈测电流的?

有直通式和互感式(线圈式),一般家里买直通式,工厂用互感式
作者: sss190    时间: 2024-1-21 23:06
感谢楼主的信息。我用这个信息编写了一个esphome的dtsu666的配置文件。
  1. esphome:
  2.   name: meter-dtsu666
  3.   friendly_name: meter-dtsu666

  4. esp8266:
  5.   board: esp01_1m

  6. # Enable logging
  7. logger:

  8. # Enable Home Assistant API
  9. api:
  10.   encryption:
  11.     key: "#########"  #需要替换的字段

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

  14. wifi:
  15.   ssid: !secret wifi_ssid
  16.   password: !secret wifi_password

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

  21. # Enable Web server
  22. web_server:
  23.   port: 80

  24. captive_portal:
  25. ###


  26. globals:
  27.   - id: chint_energy_cal
  28.     type: std::uint32_t
  29.     restore_value: yes
  30.     initial_value: '0'

  31. uart:
  32.   id: mod_bus
  33.   tx_pin: GPIO13 # connected to tx on modbus converter
  34.   rx_pin: GPIO12 # connected to rx on modbus converter
  35.   baud_rate: 9600
  36.   stop_bits: 1
  37.   data_bits: 8

  38. modbus:
  39.   send_wait_time: 2000ms
  40.   id: modbus1

  41. #address chint dtsu666
  42. modbus_controller:
  43.     address: 0x1
  44.     modbus_id: modbus1
  45.     update_interval: 1s
  46.     setup_priority: -10
  47.     command_throttle: 20ms

  48. sensor:

  49. - platform: modbus_controller
  50.    id: chint_voltage_a
  51.    name: "chint voltage phase 1"
  52.    address: 0x2006
  53.    unit_of_measurement: "V"
  54.    register_type: holding
  55.    value_type: FP32
  56.    accuracy_decimals: 1
  57.    filters:
  58.      - multiply: 0.1

  59. - platform: modbus_controller
  60.    id: chint_voltage_b
  61.    name: "chint voltage phase 2"
  62.    address: 0x2008
  63.    unit_of_measurement: "V"
  64.    register_type: holding
  65.    value_type: FP32
  66.    accuracy_decimals: 1
  67.    filters:
  68.      - multiply: 0.1

  69. - platform: modbus_controller
  70.    id: chint_voltage_c
  71.    name: "chint voltage phase 3"
  72.    address: 0x200A
  73.    unit_of_measurement: "V"
  74.    register_type: holding
  75.    value_type: FP32
  76.    accuracy_decimals: 1
  77.    filters:
  78.      - multiply: 0.1
  79.    
  80. - platform: modbus_controller
  81.    id: chint_current_a
  82.    name: "chint current phase 1"
  83.    address: 0x200C
  84.    unit_of_measurement: "A"
  85.    register_type: holding
  86.    value_type: FP32
  87.    accuracy_decimals: 2
  88.    filters:
  89.      - multiply: 0.01

  90. - platform: modbus_controller
  91.    id: chint_current_b
  92.    name: "chint current phase 2"
  93.    address: 0x200E
  94.    unit_of_measurement: "A"
  95.    register_type: holding
  96.    value_type: FP32
  97.    accuracy_decimals: 2
  98.    filters:
  99.      - multiply: 0.01

  100. - platform: modbus_controller
  101.    id: chint_current_c
  102.    name: "chint current phase 3"
  103.    address: 0x2010
  104.    unit_of_measurement: "A"
  105.    register_type: holding
  106.    value_type: FP32
  107.    accuracy_decimals: 2
  108.    filters:
  109.      - multiply: 0.01

  110. - platform: modbus_controller
  111.    id: chint_frequency
  112.    name: "chint frequency"
  113.    address: 0x2044
  114.    unit_of_measurement: "Hz"
  115.    register_type: holding
  116.    value_type: FP32
  117.    accuracy_decimals: 2
  118.    filters:
  119.      - multiply: 0.01

  120. - platform: modbus_controller
  121.    id: chint_voltage_a_to_b
  122.    name: "chint voltage phase 1 to 2"
  123.    address: 0x2000
  124.    unit_of_measurement: "V"
  125.    register_type: holding
  126.    value_type: FP32
  127.    accuracy_decimals: 1
  128.    filters:
  129.      - multiply: 0.1

  130. - platform: modbus_controller
  131.    id: chint_voltage_c_to_b
  132.    name: "chint voltage phase 2 to 3"
  133.    address: 0x2002
  134.    unit_of_measurement: "V"
  135.    register_type: holding
  136.    value_type: FP32
  137.    accuracy_decimals: 1
  138.    filters:
  139.      - multiply: 0.1

  140. - platform: modbus_controller
  141.    id: chint_voltage_a_to_c
  142.    name: "chint voltage phase 3 to 1"
  143.    address: 0x2004
  144.    unit_of_measurement: "V"
  145.    register_type: holding
  146.    value_type: FP32
  147.    accuracy_decimals: 1
  148.    filters:
  149.      - multiply: 0.1

  150. - platform: modbus_controller
  151.    id: chint_active_power_total
  152.    name: "chint active power total"
  153.    address: 0x2012
  154.    unit_of_measurement: "W"
  155.    register_type: holding
  156.    value_type: FP32
  157.    accuracy_decimals: 0

  158. - platform: modbus_controller
  159.    id: chint_active_power_phase_a
  160.    name: "chint active power phase 1"
  161.    address: 0x2014
  162.    unit_of_measurement: "W"
  163.    register_type: holding
  164.    value_type: FP32
  165.    accuracy_decimals: 0

  166. - platform: modbus_controller
  167.    id: chint_active_power_phase_b
  168.    name: "chint active power phase 2"
  169.    address: 0x2016
  170.    unit_of_measurement: "W"
  171.    register_type: holding
  172.    value_type: FP32
  173.    accuracy_decimals: 0

  174. - platform: modbus_controller
  175.    id: chint_active_power_phase_c
  176.    name: "chint active power phase 3"
  177.    address: 0x2018
  178.    unit_of_measurement: "W"
  179.    register_type: holding
  180.    value_type: FP32
  181.    accuracy_decimals: 0

  182. - platform: modbus_controller
  183.    id: chint_reactive_power_total
  184.    name: "chint reactive power total"
  185.    address: 0x201A
  186.    unit_of_measurement: "VAR"
  187.    register_type: holding
  188.    value_type: FP32
  189.    accuracy_decimals: 0

  190. - platform: modbus_controller
  191.    id: chint_reactive_power_phase_a
  192.    name: "chint reactive power phase 1"
  193.    address: 0x201C
  194.    unit_of_measurement: "VAR"
  195.    register_type: holding
  196.    value_type: FP32
  197.    accuracy_decimals: 0

  198. - platform: modbus_controller
  199.    id: chint_reactive_power_phase_b
  200.    name: "chint reactive power phase 2"
  201.    address: 0x201E
  202.    unit_of_measurement: "VAR"
  203.    register_type: holding
  204.    value_type: FP32
  205.    accuracy_decimals: 0

  206. - platform: modbus_controller
  207.    id: chint_reactive_power_phase_c
  208.    name: "chint reactive power phase 3"
  209.    address: 0x2020
  210.    unit_of_measurement: "VAR"
  211.    register_type: holding
  212.    value_type: FP32
  213.    accuracy_decimals: 0
  214.    force_new_range: true

  215. - platform: modbus_controller
  216.    id: chint_forward_energy_total
  217.    name: "chint energy total from grid"
  218.    address: 0x1028
  219.    unit_of_measurement: "kWh"
  220.    register_type: holding
  221.    value_type: FP32
  222.    accuracy_decimals: 2
  223.    filters:
  224.      - multiply: 0.01
  225.      - lambda: |-
  226.             float MAX_DIFFERENCE = 1.0;  // adjust this!
  227.             static float last_value = NAN;
  228.             if (isnan(last_value) || std::abs(x - last_value) < MAX_DIFFERENCE)
  229.               return last_value = x;
  230.             else
  231.               return {};
  232. - platform: modbus_controller
  233.    id: chint_reversing_energy_total
  234.    name: "chint energy total to grid"
  235.    address: 0x101E
  236.    unit_of_measurement: "kWh"
  237.    register_type: holding
  238.    value_type: FP32
  239.    accuracy_decimals: 2
  240.    filters:
  241.      - multiply: 0.01
  242.      - lambda: |-
  243.             float MAX_DIFFERENCE = 1.0;  // adjust this!
  244.             static float last_value = NAN;
  245.             if (isnan(last_value) || std::abs(x - last_value) < MAX_DIFFERENCE)
  246.               return last_value = x;
  247.             else
  248.               return {};

  249. - platform: modbus_controller
  250.    id: chint_power_factor_total
  251.    name: "chint power factor total"
  252.    address: 0x202A
  253.    unit_of_measurement: "cosphi"
  254.    register_type: holding
  255.    value_type: FP32
  256.    accuracy_decimals: 3
  257.    filters:
  258.      - multiply: 0.001

  259. - platform: modbus_controller
  260.    id: chint_power_factor_phase_a
  261.    name: "chint power factor phase 1"
  262.    address: 0x202C
  263.    unit_of_measurement: "cosphi"
  264.    register_type: holding
  265.    value_type: FP32
  266.    accuracy_decimals: 3
  267.    filters:
  268.      - multiply: 0.001

  269. - platform: modbus_controller
  270.    id: chint_power_factor_phase_b
  271.    name: "chint power factor phase 2"
  272.    address: 0x202E
  273.    unit_of_measurement: "cosphi"
  274.    register_type: holding
  275.    value_type: FP32
  276.    accuracy_decimals: 3
  277.    filters:
  278.      - multiply: 0.001

  279. - platform: modbus_controller
  280.    id: chint_power_factor_phase_c
  281.    name: "chint power factor phase 3"
  282.    address: 0x2030
  283.    unit_of_measurement: "cosphi"
  284.    register_type: holding
  285.    value_type: FP32
  286.    accuracy_decimals: 3
  287.    filters:
  288.      - multiply: 0.001

  289. # Todo: use correct sensor name and mark the original sensor as internal
  290. - platform: template
  291.    name: "Total Energy"
  292.    id: "energy_total"
  293.    accuracy_decimals: 2
  294.    unit_of_measurement: "kWh"
  295.    device_class: energy
  296.    state_class: measurement
  297.    icon: mdi:total_increasing
  298.    lambda: |-
  299.        return (id(chint_forward_energy_total).state - id(chint_reversing_energy_total));
  300. #   update_interval: 15s


  301. # Todo: Test lambda!
  302. button:
  303.   - platform: template
  304.     name: "Chin Chin reset total energy"
  305.     entity_category: "config"
  306.     on_press:
  307.       then:
  308.         - lambda: |-
  309.             id(chint_energy_cal) = id(chint_forward_energy_total).state;
  310.   - platform: safe_mode
  311.     name: "Chin Chin Restart (Safe Mode)"
  312.   - platform: restart
  313.     name: "Chin Chin Restart"   
复制代码

作者: boyuan0706    时间: 2024-2-26 21:39
谢谢。我发现两个问题:

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

作者: chenquanhao    时间: 2024-3-20 22:17
tcp模式下,多个电表用手拉手方式串联起来的话,配置应该怎么写。现在只接一个电表正常读书,接多个读数就出错或者“不再可用”
作者: 931371481    时间: 2025-8-28 15:01
666666666666
作者: kaka0992    时间: 2025-9-3 20:50
chenquanhao 发表于 2024-3-20 22:17
tcp模式下,多个电表用手拉手方式串联起来的话,配置应该怎么写。现在只接一个电表正常读书,接多个读数就 ...

lz解决了吗
作者: chenquanhao    时间: 2025-9-8 22:20
kaka0992 发表于 2025-9-3 20:50
lz解决了吗

解决了,是slave寄存器地址的问题,不同电表要配置不同的寄存器地址,在电表上操作,具体操作我现在忘了。配置时(按你实际配置)第一个电表slave:1,第二个电表slave:2……第十一个电表slave:11
电表数量多的话,建议先自己整理一份实际电表和寄存器地址对应表,然后在电表上对着对应表来配置,这样配置完之后,在ha配置文件上也是对着配置,就不会搞乱了。




欢迎光临 『瀚思彼岸』» 智能家居技术论坛 (https://bbs.hassbian.com/) Powered by Discuz! X3.5