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

[Feature] Create a new entity from the "hostname" field #119

Open
oleksandr-belei opened this issue Jun 8, 2022 · 3 comments
Open

[Feature] Create a new entity from the "hostname" field #119

oleksandr-belei opened this issue Jun 8, 2022 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@oleksandr-belei
Copy link

The problem

Can we have possibility to choose whether new device_tracker entities are created from the name or hostname field? If I'm not mistaken, the AsusWRT integration with hostname value known to the router creates object names from it. That would be much more convenient.

Specific device(s)?

No response

Firmware type

No response

@oleksandr-belei oleksandr-belei added the enhancement New feature or request label Jun 8, 2022
@Vaskivskyi
Copy link
Owner

Hey, @Oligarch,

I would need a bit more explanation of what exactly you mean by "name" for this feature.

Currently, the device_tracker entity name (and its host_name attribute) are obtained from the router with the following priority:

  1. Friendly name of the device if set manually in the router configuration (e.g. user has renamed the device by going to Clients - View list - click on Client name)
  2. Name as reported by the device (e.g. Device name for Android / iOS, System Product name for Win 11 and whatever it is called for other OSs). For most WiFi smart things this could be a model name)
  3. If neither of the above, this would be just MAC address

This priority list is built with the following thoughts:

  • if the user has named a device - of course, this is the way to name an entity
  • if not, but it reports some name - this is enough to distinguish the device
  • if not, MAC is unique and this way user again can find out what is the device

So, what other option do you see to improve the naming?

Does it not work this way for you?

@oleksandr-belei
Copy link
Author

oleksandr-belei commented Jun 8, 2022

I meant to give priority to the hostname while creating entity_id
Screenshot_20220608-194209_Edge

@Vaskivskyi
Copy link
Owner

Vaskivskyi commented Jun 8, 2022

Unfortunately, this data is not available in any of the API endpoints with device information. The only way to get it - directly read dhcp_staticlist value from NVRAM. But NVRAM doesn't have almost any other value used for identifying connected devices and their connection.

So if I add the possibility to read this value, the integration will have to do 2 different requests (NVRAM read + get everything else from API - those requests cannot be merged), - this would take twice more time and may significantly influence the performance of some slower Asus models. Also, if any of the 2 requests fail, part of the data will be missing - should it then be:

  • acquired again (will take even more time and the result is not guaranteed)
  • submitted to HA partial, keeping not-available part as was before (there is a chance of keeping data which became wrong)
  • submitted to HA partial with removing non-available part (some data will be missing from the device_trackers)
  • or should it be completely not updated in HA (so HA will have older data of tracker)?

For now, I am not sure this feature will be as useful, as it would influence the performance.

But, in any case, I am not completely denying the idea. Just need to find a way to not make anything worse for XX% of users, who don't use this optional field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Planned
Development

No branches or pull requests

2 participants