MQTT: Use default_entity_id instead of object_id#1351
MQTT: Use default_entity_id instead of object_id#1351FrankBakkerNl merged 2 commits intonet-daemon:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the MQTT Entity Manager to use default_entity_id instead of the deprecated object_id property when creating MQTT entities in Home Assistant. The main change is that default_entity_id now contains the full entity ID in the format domain.identifier (e.g., "sensor.kitchen_temp") rather than just the identifier portion (e.g., "kitchen_temp").
Key Changes:
- Replaced
ObjectIdproperty withDefaultEntityIdinEntityCreationPayload - Updated JSON serialization to use
default_entity_idinstead ofobject_id - Implemented
DefaultEntityId()helper method that constructs the full entity ID format
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/Extensions/NetDaemon.Extensions.MqttEntityManager/MqttEntityManager.cs |
Added DefaultEntityId() helper method and updated entity creation to use it instead of passing just the identifier to ObjectId |
src/Extensions/NetDaemon.Extensions.MqttEntityManager/Models/EntityCreationPayload.cs |
Renamed ObjectId property to DefaultEntityId and updated JSON property name from object_id to default_entity_id; minor whitespace cleanup |
src/Extensions/NetDaemon.Extensions.MqttEntityManager/MqttEntityManager.cs
Show resolved
Hide resolved
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1351 +/- ##
====================================
Coverage 82% 82%
====================================
Files 199 199
Lines 3909 3910 +1
Branches 443 443
====================================
+ Hits 3221 3225 +4
+ Misses 518 515 -3
Partials 170 170
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@helto4real Any plans on merging this? Current implementation wil break in HA 2026.4. |
|
@brechtvhb looks like you did not sign the commit. That is a requirement for this repo |
de40c6a to
e68ea0d
Compare
e68ea0d to
83f18eb
Compare
|
@FrankBakkerNl Thanks for the heads up, commits are signed now. Can you re-run the workflows? |
Breaking change
Proposed change
This pull request updates the MQTT Entity Manager to improve how entity IDs are handled when creating MQTT entities. The main change is the replacement of the
ObjectIdproperty with a newDefaultEntityIdproperty, which is now constructed using both the domain and identifier for greater clarity and uniqueness. The old ObjectId will be deprecated in 2026.4.NetDaemon generated entities generate these warnings in the home assistant logs:
Type of change
Additional information
object_id#1338Checklist
If user exposed functionality or configuration are added/changed: