0

我正在使用 Wago 的 PFC200 来自动化我的家。百叶窗和灯光工作正常,我在 PLC 中实现了很多场景。现在我想可视化灯光的状态,并能够从 HA 打开/关闭它们。HA 将只是一个可视化工具——其他一切都在 PLC 上。

我想使用 modbus 连接到我的 PLC,但我在配置方面遇到了很多问题。首先,我总是收到以下错误:

2021-05-19 08:23:41 ERROR (SyncWorker_1) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Connection] ModbusTcpClient(192.168.10.60:502): Connection unexpectedly closed 0.000071 seconds into read of 8 bytes without response from unit before it closed connection

实际读取数据但此错误始终存在垃圾邮件日志。

第二个问题是数据刷新时间。我正在调查 PLC 并且 modbus 在那里工作正常,立即更新数据,但即使我有它也没有反映在 HA 中scan_interval: 2

这是我的配置:

modbus:
  - name: PLC
    type: tcp
    host: 192.168.10.60
    port: 502

switch:
  - platform: modbus
    scan_interval: 2
    coils:
      - name: fake_switch
        hub: PLC
        slave: 1
        coil: 0
      - name: switch.bedroom_main_light
        hub: PLC
        slave: 1
        coil: 1
      - name: switch.bedroom_wardrobe_light
        hub: PLC
        slave: 1
        coil: 2
      - name: switch.bathroom_main_light
        hub: PLC
        slave: 1
        coil: 4
      - name: switch.bathroom_mirror_light
        hub: PLC
        slave: 1
        coil: 5

light:
  - platform: switch
    name: Bedroom
    entity_id: switch.bedroom_main_light
  - platform: switch
    name: Wardrobe
    entity_id: switch.bedroom_wardrobe_light
  - platform: switch
    name: Bathroom
    entity_id: switch.bathroom_main_light
  - platform: switch
    name: Bathroom - Mirror
    entity_id: switch.bathroom_mirror_light

也许我应该使用注册表而不是线圈?有人可以分享他的工作配置吗?

4

0 回答 0