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

[Bug] Device tracker entities lost after 2.1.3 upgrade #301

Closed
clau-bucur opened this issue Sep 13, 2023 · 20 comments
Closed

[Bug] Device tracker entities lost after 2.1.3 upgrade #301

clau-bucur opened this issue Sep 13, 2023 · 20 comments
Labels
bug Something isn't working

Comments

@clau-bucur
Copy link

Describe the issue

After upgrading to 2.1.3 the already existing device_tracker entities got disabled and new entites were created with different entiy_id.

How to reproduce the issue

Expected behavior

The order defined in #86 to remain in place.

Screenshots

image
New device tracker: device_tracker.attic_light
Old, now unavailable, device tracker: device_tracker.light_attic

Software versions

  • Home Assistant version: HA 2023.9.2
  • Mikrotik Router integration version:v2.1.3
  • Mikrotik Hardware: RB3011UiAS
  • RouterOS version: v7.10.2
@clau-bucur clau-bucur added the bug Something isn't working label Sep 13, 2023
@alexdelprete
Copy link

alexdelprete commented Sep 13, 2023

I'm not using device tracking feature, but I noticed this error popping up in HA logs on every restart:

Logger: homeassistant.components.device_tracker
Source: custom_components/mikrotik_router/device_tracker.py:72
Integration: Device Tracker (documentation, issues)
First occurred: 04:42:10 (2 occurrences)
Last logged: 05:07:10

Error while setting up mikrotik_router platform for device_tracker
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 359, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/mikrotik_router/device_tracker.py", line 110, in async_setup_entry
    await async_add_entities(hass, config_entry, dispatcher)
  File "/config/custom_components/mikrotik_router/device_tracker.py", line 89, in async_add_entities
    await async_update_controller(
  File "/config/custom_components/mikrotik_router/device_tracker.py", line 72, in async_update_controller
    data = coordinator.data[entity_description.data_path]
           ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable

Software versions:

  • Home Assistant version: HA 2023.9.2
  • Mikrotik Router integration version:v2.1.3
  • Mikrotik Hardware: CRS305-1G-4S+
  • RouterOS version: v7.11.2

@tomaae
Copy link
Owner

tomaae commented Sep 14, 2023

Order didnt changed, thats looks like device hostname was renamed. can you give more examples?

@alexdelprete
Copy link

alexdelprete commented Sep 14, 2023

can you give more examples?

This happened at last restart, couple of hours ago:

image

@clau-bucur
Copy link
Author

Order didnt changed, thats looks like device hostname was renamed. can you give more examples?

The thing is that I did not change a bit on my MT setup.
The things changed as soon as I upgraded from 2.1.2 to 2.1.3 and rebooted HA.

I have watchdogs setup to notify me when device trackers go offline, and they kicked in after reboot because of the entity_id changes.

@tomaae I'll enable debug for the component and attach it here if you need that.

@tomaae
Copy link
Owner

tomaae commented Sep 14, 2023

Check why there are 2 names, what defines the device as "attic light" and "light attic" in mikrotik.
Based on that I can check it.

@tomaae
Copy link
Owner

tomaae commented Sep 14, 2023

can you give more examples?

This happened at last restart, couple of hours ago:

image
This is not related, I have opened it as new issue #302

@clau-bucur
Copy link
Author

Check why there are 2 names, what defines the device as "attic light" and "light attic" in mikrotik. Based on that I can check it.

I don't really get it. I can't find anywhere in Mikrotik where it's refered as attic light.

  1. DNS comment and hostname:
    image
  2. DHCP comment (this should get used) and hostname:
    image

The same is for all the rest of my similar light devices:
image

image

Looking at other devices I think that the device tracker entity_id is now derived from the HomeAssistant device name.
Take for example this HomeAssistant device called Garden. In Mikrotik it's named Light Garden as you can see above.
Earlier it's device tracker entity was device_tracker.light_garden.
Now it looks like this:
image
image

@tomaae
Copy link
Owner

tomaae commented Sep 14, 2023

yes, entity id is derivated from device name. thats how it always been. there is no separate way to specify entity id to be different from device name

@clau-bucur
Copy link
Author

Understood. Then it means upgrade de HA 2023.9 triggered the changes actually.

Thanks!

@clau-bucur clau-bucur closed this as not planned Won't fix, can't repro, duplicate, stale Sep 15, 2023
@tomaae
Copy link
Owner

tomaae commented Sep 15, 2023

no, you have misunderstood. it was like that before, nothing should have changed.

@clau-bucur
Copy link
Author

Then I don't get what happened on my system, really.

I upgraded Mikrotik from 2.1.2 to 2.1.3 then HA from 2023.8.? to 2023.09.2.
HA upgrade triggered a restart, after which the changed entities appeared 😕

@tomaae
Copy link
Owner

tomaae commented Sep 16, 2023

no idea really, we will need to run it in debug. possibly there will be a clue

@tomaae tomaae reopened this Sep 16, 2023
@tomaae
Copy link
Owner

tomaae commented Sep 18, 2023

@clau-bucur can you test it now with 2.1.4 and include debugs and diagnostics?

@clau-bucur
Copy link
Author

Enabled debug for component, upgraded to 2.14, then rebooted HA.
Here are the logs. Let me know if more details are neede.
home-assistant_mikrotik_router_2023-09-18T11-41-13.585Z.log

@tomaae
Copy link
Owner

tomaae commented Sep 18, 2023

can you also share your integration diagnostics?

@clau-bucur
Copy link
Author

@tomaae
Copy link
Owner

tomaae commented Sep 18, 2023

"attic light" is not mentioned anywhere, except generated entity id.
I have a suspicion that this was not defined by integration, as I dont see any possibility of that. If could be caused by new HA device linking. So it could be attac taken from device name and light from entity and truncating "attac" at the end as some sort of name consolidation.
Can you rest of the screen from your first screenshot and also setting pages for both entities you underscored as red?
Also can you test if that tracker entity really reacts to correct device?

@clau-bucur
Copy link
Author

All these changes seem to be caused by changes in the Tasmota integration, starting with HA 2023.09. Some info can be found under: home-assistant/core#100089

I have adjusted my device names to account for the changes.

We can close this one as seems it's not related to this integration.
Thank you for your time!

Copy link
Owner

tomaae commented Sep 28, 2023

well, that explains why we could not find it anywhere, no matter how fine comb we used :)

@Zarox666
Copy link

Zarox666 commented Oct 9, 2023

I seem to have the same with Shelly devices.
But there was no change on the side of the Shelly integration.

@github-actions github-actions bot locked and limited conversation to collaborators Nov 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants