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

Incoming events not processed after renaming entity #61

Closed
weitzelb opened this issue Jun 20, 2023 · 2 comments
Closed

Incoming events not processed after renaming entity #61

weitzelb opened this issue Jun 20, 2023 · 2 comments

Comments

@weitzelb
Copy link
Contributor

weitzelb commented Jun 20, 2023

Everything worked as expected until I renamed the entities. For readability and usability I wanted to re-name the entities to something more meaningful e.g. "binary_sensor.ds_2cd2387g2_lu######_1_fielddetection" to "binary_sensor.frontyard_1_fielddetection".

Now once an event is triggered from the camera it is not processed anymore. A log message is shown.

Source: custom_components/hikvision_next/notifications.py:47 Cannot process incoming event Entity not found binary_sensor.ds_2cd2387g2_lu######_1_fielddetection

Seemingly some internal references are still set to the original entity id.

I just glanced through the code and I was wondering if it was related to

entity = hass.states.get(entity_id)

Most other instances you used the unique id but in this case you are re-building the original entity id based on the camera information.

@maciej-or
Copy link
Owner

Hi, as far changing entity ids is forbidden, explained here: #32 (comment)

@weitzelb
Copy link
Contributor Author

Thanks for the hint. I didn't regard that issue earlier since the name stated a different topic.
I kept on reading your code and doing some tests. I then noticed that it's because of the traceability of the incoming event. To be neccesarilly maped to something known (which the unique id is not at that point).

I am not too faimilar with the development of Home Assistant integrations, honestly. First time I actually looked into it. So just a random thought: There is no "metadata" that could be written to the entity or device containing the original camera identifier? Upon a request arriving select the entity containing that specific "metadata"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants