Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renaming Plant Device doesn't change Source for DLI/mol #64

Open
trankillity opened this issue Mar 21, 2023 · 6 comments
Open

Renaming Plant Device doesn't change Source for DLI/mol #64

trankillity opened this issue Mar 21, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@trankillity
Copy link

If you rename a plant device and accept the rename of the entities associated with it, the source attribute of the DLI/mol sensors does not update - resulting in broken sensors.

Running the service to reassign the sensors also doesn't appear to work for these entity types as I believe that's updating the external_sensor attribute for other sensors.

The DLI sensor
The DLI sensor
The mol sensors
The mol sensors that should be attached
@Knobiwahn
Copy link

Same here

@Olen
Copy link
Owner

Olen commented Aug 1, 2023

I'll look into this. I am not sure the integration gets any notification when the entities changes, but I might be able to run a periodic job to make sure the surce for the DLI is correct.

@Olen Olen added the bug Something isn't working label Aug 1, 2023
@danceoversun
Copy link

Same here

@hermanops
Copy link

me too

@Olen
Copy link
Owner

Olen commented Nov 3, 2023

Me-toos does not help. You may subscribe to the issue, or even better - create a PR.

@ScottG489
Copy link
Contributor

I was curious so I looked up how to do this. I think rather than storing the entity ID as provided by the user, you could look up the entity by entity_id and then get and store unique information about it to look up later. Here's a quick example that goes full circle:

er = entity_registry.async_get(hass)
entity = er.async_get('sensor.foobar')
entity_id = ent_reg.async_get_entity_id(entity.domain, entity.platform, entity.unique_id)

So you'd want to look up the entity object via the entity_id supplied by the user and then store domain, platform, and unique_id of the entity. Then when updating the sensor you'd use those 3 values to get the entity_id and then look up the state using that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants