Modbus sensors - Unique ID and Device support

Add possibility to have unique ID´s for front-end change of configuration. Device support would also be awesome to specify which modus sensors belongs to certain devices

Unique_id is now supported

But how to assign it. I just finished a ModBus configuration.yaml for a Eastron kWh meter. I can see the registers in de Developer Area but I cannot put in one of those entries (like kWh consumed) in th energy dashboard as it has no Unique-ID. How can a MOdbus integration with 20 attributes be given a Unique ID?

1 Like

Not sure what you mean by an integration having 20 attributes, but you can have a look at how I have incorporated unique_id for a bunch of modbus sensors here: home-assistant-config/ctc.yaml at 6a98585cb6094465db7ce61e688f5924f0f17cf3 · knudsvik/home-assistant-config · GitHub

I would appriciate device support and link according thread talking baout the need to group all the sensors of one device.

How to Associate Modbus Entity with a Home Assistant Device - Configuration - Home Assistant Community (home-assistant.io)

I am developing a YAML-based modbus integration for Sungrow Inverters.

As each inverter comes with around 100 registers / sensors values, it would be great to “link” them to a device and also assign them a location/ room.

Several users have 2 (or even more) Sungrow inverters, which complicates device / sensor handling even more.

Please support the “modbus device support” :slight_smile:

I’m using @mkai’s stunning modbus integration and it gets really messy in HA without a device that groups all entities from modbus. Would be great if that would be supported in the near future!

I am trying to add a Dimplex heatpump with cooling option by the Modbus integration. I am able to add the registers and may be with the HVAC option it will be possible to switch the different modes of it in a Home Assistant natural way.
The missing ids and the missing option to group sensors etc to a device make it quite difficult to get it going as it should be.

I know, HA is mostly developed and maintained by volunteers, so many thanks for your great work so far. I have no clue how to make the needed changes myself, otherwise I would start now.

I’d like to add my vote for the modbus integration to support concept of marking up entries such that there is the concept of a parent device, with it’s own unique_id and name, which then that device’s sensors each inherit as a prefix to allow them to be created in HA as unique identities that are tied to the parent device.

So like:

modbus:

  • name: [parent_name]
    type: [type]
    host: [ip_address]
    port: [port]
    unique_id: [parent_unique_id]
    sensors:
    • name: [sensor_1]
      address: [address]
    • name: [sensor_2]
      address: [address]

And have that passed up to HA such that there is a [parent_name] device created with the [parent_unique_id] as unique_id

Tied to that would be each of the sensors with names like:
[parent_name].[sensor_name1]
[parent_name].[sensor_name2]

Each sensor could also have autogenerated unique ids that are a concatenation of [parent_unique_id].[sensor_name1]
[parent_unique_id].[sensor_name2]

Not sure exactly how it should be laid out but that’s the ‘vibe’ of the thing.

Bonus would be to have syntax to pass to HA the concept of sensor types if that doesn’t already exist, so that sensor type could configured by a template in HA.

2 Likes

I agree with my predecessors and would also be very happy to see an improvement in the structuring. I would add to xanderphillips’ concept. Or attach a question.

name: [parent_name]

type: [type]

host: [ip_address]

port: [port]

unique_id: [parent_unique_id]

This section describes the connection hub, right? In my case it is a Modbus RTU RS485 to USB stick that connects to 4 electricity meters. All 4 counters again have dozens of entities. That’s why I prefer this structure:

Connection hub (TCP or RTU ...)

    Device (e.g. meter_1) > with name and unique_id: [parent_unique_id]

        Entity (e.g. Power A) > with name and unique_id: […]

        Entity (e.g. Voltage A) > with name and unique_id: […]

        Entity (e.g. Frequency A) > with name and unique_id: […]

    Device (e.g. meter_2) > with unique_id: [parent_unique_id]

        Entity (e.g. Power A) > with name and unique_id: […]

        Entity (e.g. Voltage A) > with name and unique_id: […]

        Entity (e.g. Frequency A) > with name and unique_id: […]

Connection hub (TCP or RTU ...)

    ...

I would be very happy about a realization.

+1

Will this ever be implemented?

modbus:
  - name: modbus_hub

I really don’t understand what this “name” (from the docs) is used / intended for.

I’m just adding my vote here too. Did anyone find a workaround for this? I’ve added two different heatpumps over modbus and the data is all over the place. Any tricks on how to solve this maybe on the dashboard level?