Modbus multiple grouped sensors

Greetings,
i have one device that reads this data

modbus:
  - name: hub1
    type: tcp
    host: 192.168.6.3
    port: 502
    binary_sensors:
      - name: "q1"
        address: 8192
        scan_interval: 30
        slave: 1
      - name: "q2"
        address: 8193
        scan_interval: 30
        slave: 1
      - name: i3
        input_type: discrete_input
        address: 2
        slave: 1
        
    sensors:
      - name: vm12
        slave: 1
        address: 12
      - name: vm50
        slave: 1
        address: 50
      - name: vm55
        slave: 1
        address: 55

The thing is that if i wan to add new but identical device i would want to change only one thing lets say a name of the whole device but keep all the sensors lets say like this:

modbus:
  - name: hub2
    type: tcp
    host: 192.168.6.4
    port: 502
    binary_sensors:
      - name: "q1"
        address: 8192
        scan_interval: 30
        slave: 1
      - name: "q2"
        address: 8193
        scan_interval: 30
        slave: 1
      - name: i3
        input_type: discrete_input
        address: 2
        slave: 1
        
    sensors:
      - name: vm12
        slave: 1
        address: 12
      - name: vm50
        slave: 1
        address: 50
      - name: vm55
        slave: 1
        address: 55

But obviosly this will not work as it would have the same name of sensors.
Is it possible to somehow group and use it lets say like this?

hub1.binary_sensors.q1
hub2.binary_sensors.q1
hub1.sensors.vm12
hub2.sensors.vm12

Or if you have any recomendation pls let me know. Thank you.

you cannot group the sensors like that. domain is always the first part of the entity_id, that cannot change. Your current naming convention should just spit out _1 _2 etc for each new sensor with the same name.

1 Like