Modbus TCP multiple connections failed

Modbus TCP works fine with single connection, but fails with several connections. HA version is 2021.1.4. Commenting out either one of modbus connection, other works ok.
Here is my configuration.yaml

modbus:
name: adam6015_1
type: tcp
host: 192.168.10.203
port: 502

name: adam6051_1
type: tcp
host: 192.168.10.202
port: 502

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

Example configuration.yaml entry

sensor:
platform: modbus
registers:
- name: Ulkolämpö
hub: adam6015_1
unit_of_measurement: °C
slave: 1
register: 2
register_type: holding
scale: 0.0030518
offset: -40.0
precision: 1
- name: Kaukolämpö_tulo
hub: adam6015_1
unit_of_measurement: °C
slave: 1
register: 4
register_type: holding
scale: 0.0030518
offset: 160.0
precision: 1
- name: Kaukolämpö_paluu
hub: adam6015_1
unit_of_measurement: °C
slave: 1
register: 3
register_type: holding
scale: 0.0030518
offset: -40.0
precision: 1

Example configuration.yaml entry

binary_sensor:

  • platform: modbus
    scan_interval: 10
    inputs:
    • name: Sensor1
      hub: adam6051_1
      slave: 1
      address: 1
    • name: Sensor2
      hub: adam6051_1
      slave: 1
      address: 2
      input_type: discrete_input

Errors from log file

2021-01-19 15:16:36 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key “name”. Check lines 19 and 24

2021-01-19 15:16:36 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key “type”. Check lines 20 and 25

2021-01-19 15:16:36 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key “host”. Check lines 21 and 26

2021-01-19 15:16:36 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key “port”. Check lines 22 and 27

If you would paste your config as formatted code it would be much easier to help you. It seems your config is wrong.

This is is my configuration.yaml copied from HA. YAML Lint gives Valid YAML!

Configure a default setup of Home Assistant (frontend, api, etc)

default_config:

Text to speech

tts:

  • platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

http:
base_url: https://xxxxxxxx.duckdns.org
ssl_certificate: /ssl/fullchain.pem
ssl_key: /ssl/privkey.pem

modbus:
name: adam6015_1
type: tcp
host: 192.168.10.203
port: 502

name: adam6051_1
type: tcp
host: 192.168.10.202
port: 502

name: adam6051_2

type: tcp

host: 192.168.10.204

port: 502

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

sensor:
platform: modbus
registers:
- name: Ulkolämpö
hub: adam6015_1
unit_of_measurement: °C
slave: 1
register: 2
register_type: holding
scale: 0.0030518
offset: -40.0
precision: 1
- name: Kaukolämpö_tulo
hub: adam6015_1
unit_of_measurement: °C
slave: 1
register: 4
register_type: holding
scale: 0.0030518
offset: 160.0
precision: 1
- name: Kaukolämpö_paluu
hub: adam6015_1
unit_of_measurement: °C
slave: 1
register: 3
register_type: holding
scale: 0.0030518
offset: -40.0
precision: 1

binary_sensor:

  • platform: modbus
    scan_interval: 10
    inputs:
    • name: Sensor1
      hub: adam6051_1
      slave: 1
      address: 1
    • name: Sensor2
      hub: adam6051_1
      slave: 1
      address: 2
      input_type: discrete_input

verisure:
username: [email protected]
password: xxxxxxx

Paste it as reformatted text. That’s what this option is for. Otherwise it’s piece of worthless text.

Ok, got now, here it is again


# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Text to speech
tts:
  - platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

http:
 base_url: https://xxxxxxxx.duckdns.org
 ssl_certificate: /ssl/fullchain.pem
 ssl_key: /ssl/privkey.pem

modbus:
  name: adam6015_1
  type: tcp
  host: 192.168.10.203
  port: 502
  
  name: adam6051_1
  type: tcp
  host: 192.168.10.202
  port: 502
  
#  name: adam6051_2
#  type: tcp
#  host: 192.168.10.204
#  port: 502
  
logger:
  logs:
    homeassistant.components.modbus: debug
    pymodbus.client: debug
 
sensor:
  platform: modbus
  registers:
    - name: Ulkolämpö
      hub: adam6015_1
      unit_of_measurement: °C
      slave: 1
      register: 2
      register_type: holding
      scale: 0.0030518
      offset: -40.0
      precision: 1
    - name: Kaukolämpö_tulo
      hub: adam6015_1
      unit_of_measurement: °C
      slave: 1
      register: 4
      register_type: holding
      scale: 0.0030518
      offset: 160.0
      precision: 1
    - name: Kaukolämpö_paluu
      hub: adam6015_1
      unit_of_measurement: °C
      slave: 1
      register: 3
      register_type: holding
      scale: 0.0030518
      offset: -40.0
      precision: 1

binary_sensor:
  - platform: modbus
    scan_interval: 10
    inputs:
      - name: Sensor1
        hub: adam6051_1
        slave: 1
        address: 1
      - name: Sensor2
        hub: adam6051_1
        slave: 1
        address: 2
        input_type: discrete_input

verisure:
  username: [email protected]
  password: xxxxxxx

type or paste code here

Starting from the beginning it should be like this

modbus:
  - name: adam6015_1
    type: tcp
    host: 192.168.10.203
    port: 502
  
  - name: adam6051_1
    type: tcp
    host: 192.168.10.202
    port: 502

Thanks, works ok now. I must be blind, can’t read doc.

does this still work? I tried configuring multiple hubs and call them through sensor platform but my HA wont boot correctly when I try. Could you paste your config?