ecowitt2mqtt icon indicating copy to clipboard operation
ecowitt2mqtt copied to clipboard

Fixes HA WARNING message during startup. Defines default_entity_id based on platform and object_id. Removes deprecated object_id

Open IgnacioHR opened this issue 5 months ago • 4 comments

Describe what the PR does:

Fixes HA WARNING message during startup. Renames object_id with default_entity_id

Does this fix a specific issue?

Fixes https://github.com/bachya/ecowitt2mqtt/issues/1324

No new functionality added!

Checklist:

  • [x] Confirm that one or more new tests are written for the new functionality.
  • [x] Run tests and ensure everything passes (with 100% test coverage).
  • [x] Update README.md with any new documentation.

IgnacioHR avatar Nov 24 '25 21:11 IgnacioHR

According to the log the default_entity_id should include the platform before the prefix. I don't think just renaming the key is enough.

"default_entity_id": "sensor.E2m_soilad7"

andrew-codechimp avatar Nov 25 '25 19:11 andrew-codechimp

Hi,

Thanks for reviewing the PR.

I wanted to clarify a point regarding your comment that “the default_entity_id should include the platform before the prefix, and that simply renaming the key is not enough.” In this context, my understanding of “platform” matches what Home Assistant refers to as the domain (sensor, binary_sensor, etc.).

The Home Assistant warning explicitly states that the new value should be the full entity_id, including the domain, for example:

"default_entity_id": "sensor.E2m_soilad7"

In other words, it expects exactly the old object_id prefixed with the domain. This aligns with the standard MQTT discovery format, where the entity ID is constructed as <platform>.<object_id>.

Of course, if in the future you plan to redesign how identifiers are generated or restructure the discovery payloads more broadly, that would be great — but this minimal change already resolves the incompatibility and allows the integration to move forward without warnings.

Thanks again for your work on the project.

IgnacioHR avatar Nov 26 '25 10:11 IgnacioHR

Hi, firstly I'm not the owner of this project, just the person that raised the issue you linked to.

You are right, Platform is an internal name within HA for what are base domains so sensor/switch etc.

I don't think your code change adds the sensor part, I did look at this and there are a couple different domains we'd have to pass through to this function to do the prefix.

andrew-codechimp avatar Nov 26 '25 10:11 andrew-codechimp

Hi, firstly I'm not the owner of this project, just the person that raised the issue you linked to.

You are right, Platform is an internal name within HA for what are base domains so sensor/switch etc.

I don't think your code change adds the sensor part, I did look at this and there are a couple different domains we'd have to pass through to this function to do the prefix.

Digging a little bit into the MQTT server I think you are right, I'm going to change the PR

image

IgnacioHR avatar Nov 26 '25 11:11 IgnacioHR