Error# Splitting MODBUS config and Sensors into separate YAML Files

Hey Everyone!

I’ve been trying to split my modbus sensors into multiple files, a yaml for each device for my Solar configuration.

I have read and researched this topic, but I have not had much luck. So, I am reaching out to have someone help me out.

As a newbie my configuration has grown and I would like to make it more manageable now, rather than later.

Listed below is my MODBUS config in the configuration yaml below, and used sensor: !include_dir_merge_list sensors/ to load the sensors from each separate yaml file located in /sensors folder. There are three connections that need to be made, two look similar but I connect to different ports for different registers.

With about 3,000 lines of yaml -soon to double or so- when I add templates etc., So I’m trying to figure this out now.

I have enabled a logger, but Im not receiving any real errors, the connections are made.

This is my test configuaton, I have a working configuration where everything is posted to one yaml file:

working configuration.yaml file:

working configuation.yaml
# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

# Text to speech
tts:
  - platform: google_translate

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
#sensor: !include test.sensors.yaml

influxdb:
  host: a0d7b954-influxdb
  port: 8086
  database: homeassistant
  username: homeassistant
  password: homeassistant
  max_retries: 3
  default_measurement: state

##########SEMB_BMS 0 Modbus SlaveAddress (Port 502): 230#########

modbus:
  # - name: Victron_GX
  #   type: tcp
  #   host: 192.168.1.164
  #   port: 502
  #   delay: 2
  #   timeout: 15
  #   sensors:
  #     - name: "Victron Battery State Of Charge"
  #       unit_of_measurement: "%"
  #       slave: 224
  #       address: 266
  #       data_type: uint16
  #       scale: 0.1
  #       precision: 1
  #       device_class: power

  #     - name: "Victron Battery current"
  #       unique_id: 8529994b-63a2-4f4d-b008-d3fc76c36ba7
  #       unit_of_measurement: "A"
  #       slave: 224
  #       address: 841
  #       data_type: int16
  #       scale: 0.1
  #       precision: 0
  #       device_class: current

  #     - name: "Victron Battery Power System"
  #       unique_id: b5c7f95a-96ee-4562-99df-321d1344a572
  #       unit_of_measurement: "W"
  #       slave: 224
  #       address: 842
  #       data_type: int16
  #       scale: 1.0
  #       precision: 0
  #       device_class: power

  #     - name: "Victron Charge Power System"
  #       unique_id: 4d43f46e-dd6b-49b9-a2f5-a36eb14fad3b
  #       unit_of_measurement: "W"
  #       slave: 224
  #       address: 860
  #       data_type: int16
  #       scale: 10.0
  #       precision: 0
  #       device_class: power

  #     - name: "Victron Battery State of Charge System"
  #       unique_id: bb4386c8-151e-4938-8ce9-7cb0ec619b1c
  #       unit_of_measurement: "%"
  #       slave: 224
  #       address: 843
  #       data_type: uint16
  #       scale: 1
  #       precision: 0

  #     - name: "Victron Battery Voltage"
  #       unique_id: 3f9a4472-785d-4f69-915b-7691d23c2edc
  #       unit_of_measurement: "V"
  #       slave: 224
  #       address: 259
  #       data_type: uint16
  #       scale: 0.01
  #       precision: 1
  #       device_class: voltage

  #     - name: "Victron Battery Amperage"
  #       unique_id: 615a27b6-cef1-44e2-a5c2-effb4f8fec42
  #       unit_of_measurement: "A"
  #       slave: 224
  #       address: 261
  #       data_type: uint16
  #       scale: 0.1
  #       precision: 1
  #       device_class: current

  #     - name: "Victron Battery Consumed Amphours"
  #       unique_id: 9e5c5c31-7e70-448b-8e0b-213d9673ba45
  #       unit_of_measurement: "A"
  #       slave: 224
  #       address: 265
  #       data_type: uint16
  #       scale: 0.1
  #       precision: 1
  #       device_class: current

  #     - name: "Victron Battery Capacity"
  #       unique_id: c4f4eedd-3696-45d8-a6e0-2815dc1e0e5f
  #       unit_of_measurement: "A"
  #       slave: 224
  #       address: 309
  #       data_type: uint16
  #       scale: 0.1
  #       precision: 1
  #       device_class: current

  ################################################################################
  ################################################################################

  - name: EG4_Internal_BMS
    type: tcp
    host: 192.168.1.179
    port: 502
    delay: 2
    timeout: 15
    sensors:
      - name: "EG4 Internal BMS - Battery SOC"
        unique_id: d190cd3a-90c9-4a2c-8edc-3d71bce8604f
        data_type: uint16
        unit_of_measurement: V
        scale: 1
        precision: 2
        slave: 230
        address: 40081
        scan_interval: 15

      - name: "EG4 Internal BMS - Battery Current"
        unique_id: 33aa654a-b639-4adc-97fa-ceea9444453a
        data_type: int16
        unit_of_measurement: A
        scale: 0.01
        precision: 2
        slave: 230
        address: 40114
        scan_interval: 1

      - name: "EG4 Internal BMS - Battery Voltage"
        unique_id: 70a324c4-2f74-4c41-80e2-e4ada3896a89
        data_type: uint16
        unit_of_measurement: V
        scale: 0.01
        precision: 2
        slave: 230
        address: 40104
        scan_interval: 1

  #############################################################################################################################################

  - name: Conext_Gateway
    type: tcp
    host: 192.168.1.179
    port: 503
    delay: 2
    timeout: 15
    sensors:
      - name: "0 - XW 4868 Inverter Enabled"
        unique_id: e71bdc4d-fbb1-483a-a864-521747ebc3dc
        data_type: uint16
        input_type: input
        slave: 10
        address: 71
        scan_interval: 1

      - name: "0 - XW 4868 Active Faults Flag"
        unique_id: cb59ac1b-89e5-4fbe-9657-296ff6a7391f
        data_type: uint16
        input_type: input
        slave: 10
        address: 75
        scan_interval: 1

      - name: "0 - XW 4868 Active Warnings Flag"
        unique_id: f1e2c225-c082-44fe-9b56-075d3ff25106
        data_type: uint16
        input_type: input
        slave: 10
        address: 76
        scan_interval: 1

      - name: "0 - XW 4868 Battery Current"
        unique_id: f9bd9163-a48f-4f15-8cc9-e74887d07076
        data_type: int32
        input_type: input
        slave: 10
        address: 82
        unit_of_measurement: A
        scale: 0.001
        offset: 0
        precision: 3
        scan_interval: 1

      - name: "0 - XW 4868 Battery Power"
        unique_id: bdeb06ec-3c2d-432b-8d6d-f19d45756602
        data_type: int32
        input_type: input
        slave: 10
        address: 84
        scale: 1
        offset: 0
        precision: 0
        device_class: energy
        unit_of_measurement: W
        scan_interval: 1

      - name: "0 - XW 4868 Battery Temperature"
        unique_id: 6707fd83-73ef-4814-83cd-38327cee0a88
        data_type: uint16
        input_type: input
        slave: 10
        address: 86
        unit_of_measurement: degC
        scale: 0.01
        offset: -273
        precision: 2
        scan_interval: 1

      - name: "0 - XW 4868 Inverter Status"
        unique_id: 267469d6-8721-4504-8974-87088f8eb4ce
        data_type: uint16
        input_type: input
        slave: 10
        address: 122
        scan_interval: 1

      - name: "0 - XW 4868 Load AC Voltage"
        unique_id: bba089ce-887c-48bc-8a41-4f7da31d17ce
        data_type: uint32
        input_type: input
        slave: 10
        address: 140
        unit_of_measurement: V
        scale: 0.001
        offset: 0
        precision: 3
        scan_interval: 1

      - name: "0 - XW 4868 Load AC Current"
        unique_id: 7969546e-9059-43a1-8f78-9d665938b0fd
        data_type: int32
        input_type: input
        slave: 10
        address: 150
        unit_of_measurement: A
        scale: 0.001
        offset: 0
        precision: 3
        scan_interval: 1

      - name: "0 - XW 4868 Load AC Frequency"
        unique_id: 6edecfad-d8f9-4e1c-91b2-c817e1ad042a
        data_type: uint16
        input_type: input
        slave: 10
        address: 152
        unit_of_measurement: Hz
        scale: 0.01
        offset: 0
        precision: 2
        scan_interval: 1

      - name: "0 - XW 4868 Load AC Power"
        unique_id: 321d71e7-73bc-402a-82b9-c2f6015fd5d7
        data_type: int32
        input_type: input
        slave: 10
        address: 154
        unit_of_measurement: W
        scale: 1
        offset: 0
        precision: 0
        scan_interval: 1
        device_class: energy

      #############   NEW   ###########################
      # - name: "0 - XW 4868 AC Input Power"
      #   data_type: uint32
      #   unit_of_measurement: W
      #   scale: 1
      #   slave: 10
      #   address: 100
      #   device_class: energy

      - name: "0 - XW 4868 Charge DC Power"
        unique_id: 0986622f-7474-46b6-a615-71678cfe207d
        data_type: uint32
        unit_of_measurement: W
        scale: 1
        slave: 10
        address: 94
        device_class: energy

      - name: "0 - XW 4868 Load Output Energy Today"
        unique_id: 6853a55b-dbe0-48eb-b586-db5b1777dfba
        data_type: uint32
        unit_of_measurement: kWh
        scale: 0.001
        precision: 1
        slave: 10
        address: 308
        device_class: energy
        state_class: total_increasing

      - name: "0 - XW 4868 Energy From Battery This Hour"
        unique_id: aa67ad1a-9953-4407-9e2d-0a4510cb67d5
        data_type: uint32
        unit_of_measurement: kWh
        scale: 0.001
        precision: 1
        slave: 10
        address: 208
        device_class: energy
        state_class: total_increasing

      - name: "0 - XW 4868 Energy to Battery This Hour"
        unique_id: d006ec0a-f23c-4ff9-b575-8458be40de92
        data_type: uint32
        unit_of_measurement: kWh
        scale: 0.001
        precision: 1
        slave: 10
        address: 232
        device_class: energy
        state_class: total_increasing

      # - name: "0 - XW 4868 Generator Status"
      #   data_type: uint16
      #   scale: 1
      #   slave: 10 #51
      #   address: 77
      #   device_class: energy

      - name: "0 - XW 4868 Energy from Battery This Hour"
        unique_id: e1727361-a43e-4a57-a80d-08ed1f09f0ba
        data_type: uint32
        unit_of_measurement: kWh
        scale: 0.001
        precision: 1
        slave: 10
        address: 208
        device_class: energy
        state_class: total_increasing

      - name: "0 - XW 4868 Energy to Battery This Hour"
        unique_id: e9317bae-b986-4a87-b8af-a94d80e355ae
        data_type: uint32
        unit_of_measurement: kWh
        scale: 0.001
        precision: 1
        slave: 10
        address: 232
        device_class: energy
        state_class: total_increasing

      ################################################################################################################
      ##########  (0)  conext_gateway device over Modbus: MPPT600/100 Modbus Slave Address (Port 503): 170   #########
      ################################################################################################################

      - name: "0 - MPPT100/600 100/600 Device State"
        unique_id: d1b7829a-d3bf-4d7f-93b3-6dbf07c3da05
        data_type: uint16
        input_type: input
        slave: 170
        address: 64
        scan_interval: 1

      - name: "0 - MPPT100/600 Charger Enabled Status"
        unique_id: 3e1f0eef-2c61-40aa-b036-eccfc46a2ad6
        data_type: uint16
        input_type: input
        slave: 170
        address: 65
        scan_interval: 1

      - name: "0 - MPPT100/600 Charge Mode Status"
        unique_id: 8fd8118b-1694-433e-b7bb-ff195ac6dae4
        data_type: uint16
        input_type: input
        slave: 170
        address: 67
        scan_interval: 1

      - name: "0 - MPPT100/600 100/600 Active Faults"
        unique_id: a6d4b7c4-7d60-4fff-974a-df8c0b521c8e
        data_type: uint16
        input_type: input
        slave: 170
        address: 68
        scan_interval: 1

      - name: "0 - MPPT100/600 Active Warnings"
        unique_id: 2c0a23f0-1d90-44fc-9ef1-49079e2ef7dd
        data_type: uint16
        input_type: input
        slave: 170
        address: 69
        scan_interval: 1

      - name: "0 - MPPT100/600 PV Input Voltage"
        unique_id: b4cb3cb2-2fc7-455d-8321-fdf55b372990
        data_type: uint32
        input_type: input
        slave: 170
        address: 76
        unit_of_measurement: V
        scale: 0.001
        offset: 0
        precision: 3
        scan_interval: 1

      - name: "0 - MPPT100/600 PV Input Current"
        unique_id: 8bbc3a6b-b226-449b-9b87-c550ccda7762
        data_type: uint32
        input_type: input
        slave: 170
        address: 78
        unit_of_measurement: A
        scale: 0.001
        offset: 0
        precision: 3
        scan_interval: 1

      - name: "0 - MPPT100/600 PV Input Power"
        unique_id: 70333220-5b59-4914-8b82-e1a12eefa72b
        data_type: uint32
        input_type: input
        slave: 170
        address: 80
        scale: 1.0
        offset: 0
        precision: 0
        device_class: energy
        unit_of_measurement: W
        scan_interval: 1

      - name: "0 - MPPT100/600 Battery Temperature"
        unique_id: 1a2a2523-775d-41d7-a873-777e08007d4e
        data_type: uint16
        input_type: input
        slave: 170
        address: 86
        unit_of_measurement: degC
        scale: 0.01
        offset: -273
        precision: 2
        scan_interval: 1

      - name: "0 - MPPT100/600 PV Output Voltage"
        unique_id: 69b0fdec-7fd0-4e40-9c0e-0b7a835fbede
        data_type: int32
        input_type: input
        slave: 170
        address: 88
        unit_of_measurement: V
        scale: 0.001
        offset: 0
        precision: 3
        scan_interval: 1

      - name: "0 - MPPT100/600 PV Output Current"
        unique_id: f3622ff7-9fd2-4eb0-94e8-aa14586059ae
        data_type: int32
        input_type: input
        slave: 170
        address: 90
        unit_of_measurement: A
        scale: 0.001
        offset: 0
        precision: 3
        scan_interval: 1

      - name: "0 - MPPT100/600 PV Output Power"
        unique_id: 02e364b3-89bf-4e55-b288-49593449c28e
        data_type: uint32
        input_type: input
        slave: 170
        address: 92
        scale: 1
        offset: 0
        precision: 0
        device_class: energy
        unit_of_measurement: W
        scan_interval: 1

      - name: "0 - MPPT100/600 Energy From PV This Hour"
        unique_id: f3c1bc8f-d11a-4fe8-9bf0-a532879c86cd
        data_type: uint32
        input_type: input
        device_class: energy
        state_class: total_increasing
        slave: 170
        address: 112
        unit_of_measurement: kWh
        scale: 0.001
        offset: 0
        precision: 3

      - name: "0 - MPPT100/600 PV Input Active This Hour"
        unique_id: fddc9482-29fd-4905-a00e-2eac5913f85a
        data_type: uint32
        input_type: input
        device_class: energy
        state_class: total_increasing
        slave: 170
        address: 114
        unit_of_measurement: s
        scale: 0.001
        offset: 0
        precision: 3

      #############UNUSED###########################
      # - name: "MPPT Energy From PV Today"
      #   data_type: uint32
      #   input_type: input
      #   #count: 2
      #   slave: 170
      #   address: 106
      #   unit_of_measurement: kWh
      #   scale: 0.001
      #   offset: 0
      #   precision: 3

      # - name: "MPPT PV Input Active Today"
      #   data_type: uint32
      #   input_type: input
      #   #count: 2
      #   slave: 170
      #   address: 106
      #   unit_of_measurement: kWh
      #   scale: 0.001
      #   offset: 0
      #   precision: 3

      # - name: "MPPT Energy From PV This Week"
      #   data_type: uint32
      #   input_type: input
      #   #count: 2
      #   slave: 170
      #   address: 110
      #   unit_of_measurement: kWh
      #   scale: 0.001
      #   offset: 0
      #   precision: 3

      # - name: "MPPT PV Input Active This Week"
      #   data_type: uint32
      #   input_type: input
      #   #count: 2
      #   slave: 170
      #   address: 112
      #   unit_of_measurement: kWh
      #   scale: 0.001
      #   offset: 0
      #   precision: 3

      # - name: "MPPT Energy From PV This Month"
      #   data_type: uint32
      #   input_type: input
      #   #count: 2
      #   slave: 170
      #   address: 114
      #   unit_of_measurement: kWh
      #   scale: 0.001
      #   offset: 0
      #   precision: 3

      # - name: "MPPT PV Input Active This Month"
      #   data_type: uint32
      #   input_type: input
      #   #count: 2
      #   slave: 170
      #   address: 116
      #   unit_of_measurement: kWh
      #   scale: 0.001
      #   offset: 0
      #   precision: 3

      # - name: "MPPT Energy From PV This Year"
      #   data_type: uint32
      #   input_type: input
      #   #count: 2
      #   slave: 170
      #   address: 118
      #   unit_of_measurement: kWh
      #   scale: 0.001
      #   offset: 0
      #   precision: 3

      # - name: "MPPT PV Input Active This Year"
      #   data_type: uint32
      #   input_type: input
      #   #count: 2
      #   slave: 170
      #   address: 120
      #   unit_of_measurement: kWh
      #   scale: 0.001
      #   offset: 0
      #   precision: 3

      # - name: "MPPT Operating Mode"
      #   data_type: uint32
      #   input_type: holding
      #   slave: 170
      #   address: 172

      ################################################################################################################
      ##########   (1) conext_gateway device over Modbus: MPPT600/100 Modbus Slave Address (Port 503): 171   #########
      ################################################################################################################

      - name: "1 - MPPT100/600 100/600 Device State"
        unique_id: af806f9d-8b33-4b7d-9a96-da9dd855cd67
        data_type: uint16
        input_type: input
        slave: 171
        address: 64
        scan_interval: 1

      - name: "1 - MPPT100/600 Charger Enabled Status"
        unique_id: 39828bb3-3a76-4806-9177-32c94335fa99
        data_type: uint16
        input_type: input
        slave: 171
        address: 65
        scan_interval: 1

      - name: "1 - MPPT100/600 Charge Mode Status"
        unique_id: 7bd2d023-7a64-49ec-8b04-475b8bb52be6
        data_type: uint16
        input_type: input
        slave: 171
        address: 67
        scan_interval: 1

      - name: "1 - MPPT100/600 100/600 Active Faults"
        unique_id: 32cd6f85-0a01-4c0e-aa9b-436ac4c2322f
        data_type: uint16
        input_type: input
        slave: 171
        address: 68
        scan_interval: 1

      - name: "1 - MPPT100/600 Active Warnings"
        unique_id: a412f704-9b2e-41d5-b3f6-8d86495480c9
        data_type: uint16
        input_type: input
        slave: 171
        address: 69
        scan_interval: 1

      - name: "1 - MPPT100/600 PV Input Voltage"
        unique_id: d24417f1-f1d7-4fa6-9cea-3f7fe7479f78
        data_type: uint32
        input_type: input
        slave: 171
        address: 76
        unit_of_measurement: V
        scale: 0.001
        offset: 0
        precision: 3
        scan_interval: 1

      - name: "1 - MPPT100/600 PV Input Current"
        unique_id: 1060d494-22f8-417c-bf64-0934d3236b92
        data_type: uint32
        input_type: input
        slave: 171
        address: 78
        unit_of_measurement: A
        scale: 0.001
        offset: 0
        precision: 3
        scan_interval: 1

      - name: "1 - MPPT100/600 PV Input Power"
        unique_id: b77f3da9-a88e-4cef-87c6-eadf437d63ca
        data_type: uint32
        input_type: input
        slave: 171
        address: 80
        scale: 1.0
        offset: 0
        precision: 0
        device_class: energy
        unit_of_measurement: W
        scan_interval: 1

      - name: "1 - MPPT100/600 Battery Temperature"
        unique_id: 0b80a457-f2f7-46b9-ab58-289f0b9239d8
        data_type: uint16
        input_type: input
        slave: 171
        address: 86
        unit_of_measurement: degC
        scale: 0.01
        offset: -273
        precision: 2
        scan_interval: 1

      - name: "1 - MPPT100/600 PV Output Voltage"
        unique_id: b83f4554-d79e-4729-a8f7-6419009612d6
        data_type: int32
        input_type: input
        slave: 171
        address: 88
        unit_of_measurement: V
        scale: 0.001
        offset: 0
        precision: 3
        scan_interval: 1

      - name: "1 - MPPT100/600 PV Output Current"
        unique_id: 206f654b-10bf-41b1-9c60-0dd041fba5cd
        data_type: int32
        input_type: input
        slave: 171
        address: 90
        unit_of_measurement: A
        scale: 0.001
        offset: 0
        precision: 3
        scan_interval: 1

      - name: "1 - MPPT100/600 PV Output Power"
        unique_id: 3c1eb0ac-bc79-4ec1-93ff-bd4f1408475a
        data_type: uint32
        input_type: input
        slave: 171
        address: 92
        scale: 1
        offset: 0
        precision: 0
        device_class: energy
        unit_of_measurement: W
        scan_interval: 1

      - name: "1 - MPPT100/600 Energy From PV This Hour"
        unique_id: afae5691-933e-451d-95aa-e230fcb1f035
        data_type: uint32
        input_type: input
        device_class: energy
        state_class: total_increasing
        slave: 171
        address: 112
        unit_of_measurement: kWh
        scale: 0.001
        offset: 0
        precision: 3

      - name: "1 - MPPT100/600 PV Input Active This Hour"
        unique_id: b0e058b7-6280-4aae-a246-830df4bddd72
        data_type: uint32
        input_type: input
        device_class: energy
        state_class: total_increasing
        slave: 171
        address: 114
        unit_of_measurement: s
        scale: 0.001
        offset: 0
        precision: 3

      - name: "1 - MPPT100/600 DC Power Output Percentage"
        unique_id: 113d1cea-18a6-44ae-ac2e-7ad8002e4c01
        data_type: uint32
        input_type: input
        slave: 171
        address: 94
        scale: 1.0
        offset: 0
        scan_interval: 1

2023-12-17 07:21:07.173 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration victron which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-12-17 07:21:07.175 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-12-17 07:21:16.519 WARNING (MainThread) [homeassistant.components.modbus.validators] Modbus Victron_GX timeout(15) is adjusted(14) due to scan_interval
2023-12-17 07:21:16.520 WARNING (MainThread) [homeassistant.components.modbus.validators] Modbus EG4_Internal_BMS timeout(15) is adjusted(14) due to scan_interval
2023-12-17 07:21:16.520 WARNING (MainThread) [homeassistant.components.modbus.validators] Modbus Conext_Gateway timeout(15) is adjusted(14) due to scan_interval
2023-12-17 07:21:16.533 INFO (SyncWorker_6) [homeassistant.components.modbus.modbus] modbus Victron_GX communication open
2023-12-17 07:21:16.533 INFO (SyncWorker_2) [homeassistant.components.modbus.modbus] modbus Conext_Gateway communication open
2023-12-17 07:21:16.533 INFO (SyncWorker_0) [homeassistant.components.modbus.modbus] modbus EG4_Internal_BMS communication open
2023-12-17 07:21:26.619 ERROR (MainThread) [homeassistant] Error doing job: Unclosed connection

I have confirmed that anything loaded by MODBUS is lost.

test configuration.yaml

test config.yaml
# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

# Text to speech
tts:
  - platform: google_translate

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
sensor: !include_dir_merge_list sensors/

influxdb:
  host: a0d7b954-influxdb
  port: 8086
  database: homeassistant
  username: homeassistant
  password: homeassistant
  max_retries: 3
  default_measurement: state

modbus:
  - name: Victron_GX
    type: tcp
    host: 192.168.1.164
    port: 502
    delay: 2
    timeout: 15

  - name: EG4_Internal_BMS
    type: tcp
    host: 192.168.1.179
    port: 502
    delay: 2
    timeout: 15

  - name: Conext_Gateway
    type: tcp
    host: 192.168.1.179
    port: 503
    delay: 2
    timeout: 15

logger:
  logs:
    homeassistant.components.modbus: debug
    pymodbus.client: debug

/sensors/mppt.yaml

MPPT.yaml
################################################################################################################
##########  (0)  conext_gateway device over Modbus: MPPT600/100 Modbus Slave Address (Port 503): 170   #########
################################################################################################################
- platform: modbus
  hub: Conext_Gateway
  sensors:
    - name: "0 - MPPT100/600 100/600 Device State"
      unique_id: d1b7829a-d3bf-4d7f-93b3-6dbf07c3da05
      data_type: uint16
      input_type: input
      slave: 170
      address: 64
      scan_interval: 1

    - name: "0 - MPPT100/600 Charger Enabled Status"
      unique_id: 3e1f0eef-2c61-40aa-b036-eccfc46a2ad6
      data_type: uint16
      input_type: input
      slave: 170
      address: 65
      scan_interval: 1

    - name: "0 - MPPT100/600 Charge Mode Status"
      unique_id: 8fd8118b-1694-433e-b7bb-ff195ac6dae4
      data_type: uint16
      input_type: input
      slave: 170
      address: 67
      scan_interval: 1

    - name: "0 - MPPT100/600 100/600 Active Faults"
      unique_id: a6d4b7c4-7d60-4fff-974a-df8c0b521c8e
      data_type: uint16
      input_type: input
      slave: 170
      address: 68
      scan_interval: 1

    - name: "0 - MPPT100/600 Active Warnings"
      unique_id: 2c0a23f0-1d90-44fc-9ef1-49079e2ef7dd
      data_type: uint16
      input_type: input
      slave: 170
      address: 69
      scan_interval: 1

    - name: "0 - MPPT100/600 PV Input Voltage"
      unique_id: b4cb3cb2-2fc7-455d-8321-fdf55b372990
      data_type: uint32
      input_type: input
      slave: 170
      address: 76
      unit_of_measurement: V
      scale: 0.001
      offset: 0
      precision: 3
      scan_interval: 1

    - name: "0 - MPPT100/600 PV Input Current"
      unique_id: 8bbc3a6b-b226-449b-9b87-c550ccda7762
      data_type: uint32
      input_type: input
      slave: 170
      address: 78
      unit_of_measurement: A
      scale: 0.001
      offset: 0
      precision: 3
      scan_interval: 1

    - name: "0 - MPPT100/600 PV Input Power"
      unique_id: 70333220-5b59-4914-8b82-e1a12eefa72b
      data_type: uint32
      input_type: input
      slave: 170
      address: 80
      scale: 1.0
      offset: 0
      precision: 0
      device_class: energy
      unit_of_measurement: W
      scan_interval: 1

    - name: "0 - MPPT100/600 Battery Temperature"
      unique_id: 1a2a2523-775d-41d7-a873-777e08007d4e
      data_type: uint16
      input_type: input
      slave: 170
      address: 86
      unit_of_measurement: degC
      scale: 0.01
      offset: -273
      precision: 2
      scan_interval: 1

    - name: "0 - MPPT100/600 PV Output Voltage"
      unique_id: 69b0fdec-7fd0-4e40-9c0e-0b7a835fbede
      data_type: int32
      input_type: input
      slave: 170
      address: 88
      unit_of_measurement: V
      scale: 0.001
      offset: 0
      precision: 3
      scan_interval: 1

    - name: "0 - MPPT100/600 PV Output Current"
      unique_id: f3622ff7-9fd2-4eb0-94e8-aa14586059ae
      data_type: int32
      input_type: input
      slave: 170
      address: 90
      unit_of_measurement: A
      scale: 0.001
      offset: 0
      precision: 3
      scan_interval: 1

    - name: "0 - MPPT100/600 PV Output Power"
      unique_id: 02e364b3-89bf-4e55-b288-49593449c28e
      data_type: uint32
      input_type: input
      slave: 170
      address: 92
      scale: 1
      offset: 0
      precision: 0
      device_class: energy
      unit_of_measurement: W
      scan_interval: 1

    - name: "0 - MPPT100/600 Energy From PV This Hour"
      unique_id: f3c1bc8f-d11a-4fe8-9bf0-a532879c86cd
      data_type: uint32
      input_type: input
      device_class: energy
      state_class: total_increasing
      slave: 170
      address: 112
      unit_of_measurement: kWh
      scale: 0.001
      offset: 0
      precision: 3

    - name: "0 - MPPT100/600 PV Input Active This Hour"
      unique_id: fddc9482-29fd-4905-a00e-2eac5913f85a
      data_type: uint32
      input_type: input
      device_class: energy
      state_class: total_increasing
      slave: 170
      address: 114
      unit_of_measurement: s
      scale: 0.001
      offset: 0
      precision: 3

    #############UNUSED###########################
    # - name: "MPPT Energy From PV Today"
    #   data_type: uint32
    #   input_type: input
    #   #count: 2
    #   slave: 170
    #   address: 106
    #   unit_of_measurement: kWh
    #   scale: 0.001
    #   offset: 0
    #   precision: 3

    # - name: "MPPT PV Input Active Today"
    #   data_type: uint32
    #   input_type: input
    #   #count: 2
    #   slave: 170
    #   address: 106
    #   unit_of_measurement: kWh
    #   scale: 0.001
    #   offset: 0
    #   precision: 3

    # - name: "MPPT Energy From PV This Week"
    #   data_type: uint32
    #   input_type: input
    #   #count: 2
    #   slave: 170
    #   address: 110
    #   unit_of_measurement: kWh
    #   scale: 0.001
    #   offset: 0
    #   precision: 3

    # - name: "MPPT PV Input Active This Week"
    #   data_type: uint32
    #   input_type: input
    #   #count: 2
    #   slave: 170
    #   address: 112
    #   unit_of_measurement: kWh
    #   scale: 0.001
    #   offset: 0
    #   precision: 3

    # - name: "MPPT Energy From PV This Month"
    #   data_type: uint32
    #   input_type: input
    #   #count: 2
    #   slave: 170
    #   address: 114
    #   unit_of_measurement: kWh
    #   scale: 0.001
    #   offset: 0
    #   precision: 3

    # - name: "MPPT PV Input Active This Month"
    #   data_type: uint32
    #   input_type: input
    #   #count: 2
    #   slave: 170
    #   address: 116
    #   unit_of_measurement: kWh
    #   scale: 0.001
    #   offset: 0
    #   precision: 3

    # - name: "MPPT Energy From PV This Year"
    #   data_type: uint32
    #   input_type: input
    #   #count: 2
    #   slave: 170
    #   address: 118
    #   unit_of_measurement: kWh
    #   scale: 0.001
    #   offset: 0
    #   precision: 3

    # - name: "MPPT PV Input Active This Year"
    #   data_type: uint32
    #   input_type: input
    #   #count: 2
    #   slave: 170
    #   address: 120
    #   unit_of_measurement: kWh
    #   scale: 0.001
    #   offset: 0
    #   precision: 3

    # - name: "MPPT Operating Mode"
    #   data_type: uint32
    #   input_type: holding
    #   slave: 170
    #   address: 172

Can anyone please be of assistance? Or point me to what I am doing wrong?

Thank you!

Bump thread :slight_smile:

I dont think from my research that Home Assistant will allow me to configure 3 different TCP Modbus connections:

modbus:

  • name: Victron_GX
    type: tcp
    host: 192.168.1.164
    port: 502
    delay: 2
    timeout: 15

  • name: EG4_Internal_BMS
    type: tcp
    host: 192.168.1.179
    port: 502
    delay: 2
    timeout: 15

  • name: Conext_Gateway
    type: tcp
    host: 192.168.1.179
    port: 503
    delay: 2
    timeout: 15

Then do a list combine on 3 separate sensor lists, where each list would need to connect to a different connection or Hub. This can be done is a single list or

sensor: !include_dir_merge_list sensors/

4868sensor.yaml =====> uses Conext_Gateway connection
mpptsensor.yaml =====> uses Conext_Gateway connection
victron.yaml =====> uses Victron_GX connection
eg4battery.yam l=====> uses EG4_internal_BMS connection

as the sensor list, would just combine each sensor into a single list, but I do not believe I can declare which connection to use in multi - listing… I will try it, but I would have to declare which hub to connect to, for each and every sensor to do it the way I am thinking.

#mpptsensor.yaml
#sensors:
- name: “0 - MPPT100/600 100/600 Device State”
unique_id: d1b7829a-d3bf-4d7f-93b3-6dbf07c3da05
hub: conext_gateway
data_type: uint16
input_type: input
slave: 170
address: 64
scan_interval: 1

#eg4battery.yaml
#sensor:
- name: “EG4 Internal BMS - Battery SOC”
unique_id: d190cd3a-90c9-4a2c-8edc-3d71bce8604f
hub: EG4_Internal_BMS
data_type: uint16
unit_of_measurement: V
scale: 1
precision: 2
slave: 230
address: 40081
scan_interval: 15

so on, and on…

Anyone have any thoughts to this?

Hi, I have five modbus hubs attached to HA. I have a victron plus four others to control various slaves around the house.
I had this same issue to begin with and found that it was to do with how the modbus.yaml was formatted, and from what i can determine there are many ways to skin a cat, but this works for me.

Im no expert, but broadly how i understand it. You have

modbus: !include modbus.yaml in the main config/configuration.yaml

Then within the modbus.yaml file you need to remember that you have already put in the reference to modbus in the main config, so after that you just need to detail each modbus master.

An extract from my modbus.yaml.

#modbus victron:

  • name: victron
    type: tcp
    host: 192.168.0.143
    port: 502
    delay: 0
    message_wait_milliseconds: 30
    timeout: 4
    sensors:
    • name: “Grid Power”
      scan_interval: 11
      unit_of_measurement: “W”
      slave: 100
      address: 820
      data_type: int16
      unique_id: 40_Grid_Power

    • name: “AC Loads”
      scan_interval: 11
      unit_of_measurement: “W”
      slave: 100
      address: 817
      data_type: uint16
      unique_id: 40_AC_Loads

    • name: “Inverter State”
      scan_interval: 61
      slave: 227
      address: 31
      data_type: uint16
      unique_id: 40_Inverter_State

#modbus Shed i/o

  • name: shed_io
    type: tcp
    host: 192.168.0.150
    port: 502
    delay: 0
    message_wait_milliseconds: 30
    timeout: 4
    sensors:

#Hub Sensors

  - name: "Shed Sensor 1"
    slave: 3
    address: 100
    scan_interval: 41
    data_type: int16
    unit_of_measurement: "mA"        
    input_type: input
    scale: 0.001
    precision: 4
    unique_id: 40_Sensor_Shed_1

  - name: "Shed Sensor 2"
    slave: 3
    address: 101
    scan_interval: 43
    data_type: int16
    unit_of_measurement: "mA"
    input_type: input
    scale: 0.001
    precision: 4
    unique_id: 40_Sensor_Shed_2

sorry, that post seems to have auto formatted half of the code wrong.

#modbus victron:

  • name: victron
    type: tcp
    host: 192.168.0.143
    port: 502

close_comm_on_error: true

delay: 0
message_wait_milliseconds: 30

retries: 3

timeout: 4
sensors:
  - name: "Grid Power"
    scan_interval: 11
    unit_of_measurement: "W"
    slave: 100
    address: 820
    data_type: int16
    unique_id: 40_Grid_Power
    
  - name: "AC Loads"
    scan_interval: 11
    unit_of_measurement: "W"
    slave: 100
    address: 817
    data_type: uint16
    unique_id: 40_AC_Loads
    
  - name: "Inverter State"
    scan_interval: 61
    slave: 227
    address: 31
    data_type: uint16
    unique_id: 40_Inverter_State

so has that, but hopefully you get the idea.