Modbus entities as device and configuration

I use modbus devices in my smart home, each device provides 10 to 100 entities (registers).
All entities are in a pile, without the possibility of combining them into one device, which is very inconvenient. Including for the configuration of entities.

Why not add the ability to bind entities to a device, as is done in mqtt discovery? It would be very convenient.

Another nightmare is that all entities must be described under the hub entry. Previously, you could do this:

modbus:
  - name: hub1
    type: tcp
    host: 192.168.1.22
    port: 23

switch:
  - platform: modbus
    scan_interval: 5
    name: hub1
    ...
    coils:
    - name: switch1
      hub: hub1
      coil: 0
      slave: 123

And this made it possible to separate the entities of one device in one file and connect it using an !include.
It would be just great if it was possible to use device templates. Once describe all the entities of the device and then connect the template using the slave id. They can be shared on github :slight_smile:

Related: How to Associate Modbus Entity with a Home Assistant Device