Change unique_id for webostv#34979
Conversation
|
This should preferably be solved as in the braviatv integration where the media_player entity is added regardless if the TV is on or not. The unique_id is taken from the config entry. The TV is only required to be on during the config flow where the needed info is fetched after connecting to the TV. |
|
Agree that moving to a config flow/entry would be ideal, but that will take some time. As of now this is addressing a regression in the integration. Looking through the library I saw two values that appeared to be unique enough: MAC address and paring ID. This one is readily available today while exposing MAC would require a change in the library. Another alternative is to remove the |
|
If the pairing code isn't a good enough If it is good enough then I feel this is a good stopgap solution to keep entity registry support and restore functionality until a config entry overhaul can be done by someone. |
|
For some context, the pairing ID for my TV has never changed since it was added ~2 years ago. |
I was looking forward to doing that after I finish the works on Panasonic Viera. It'd be very straight forward I guess, practically the same kind of flow. |
|
@jjlawren maybe this service could retrieve data containing a stable unique id: |
I checked the available data provided by the TV. The only usable unique identifiers would be the pairing code or the MAC address. |
|
Using a MAC address is ok I think (at least that's what the docs say) |
|
But then, the config flow implies for lots of other settings. We'd need to implement the source editing list, for example (unless it was something YAML-exclusive) |
|
Until this integration uses config flow, I think |
|
I agree, so long as the |
|
that is what's being used to reauthenticate, so if that changes you would need to set it up again anyway. |
|
It is ok to change unique id if we are sure that we won't change again later. IP address is not good as they could be swapped between two TVs. Is the |
|
Yes, those are the same thing. |
|
I'm not familiar with the necessity/benefits of having a unique_id defined, but this seems like a reasonable solution in order to have one. The client_key will only change if the tv is factory reset, and in that case it needs to be re-paired anyways. |
|
@bendavid Entities with unique IDs can have their names and entity IDs changed through the UI, and are tied to their respective config entries |
|
Are we sure that we will never be able to get the serial number from the TV? |
|
I haven't found anything yet. Closest I've come across is a private call (i.e., not available) for a different API on the open source version of the OS: https://www.webosose.org/docs/reference/ls2-api/com-webos-service-systemservice/#deviceinfo-query. Honestly, for our purposes of requiring a stable unique identifier per device, the |
Breaking change
A new
unique_idis used forwebostvmedia players for users running a 0.109.X release. Duplicate entities will be created with new entity IDs and old entities will need to be manually removed.Proposed change
Summary from here:
Since we can't know the MAC address if the device is unavailable, we have either the IP or pairing code available before we connect. This will have the side-effect of creating a new entity if the device is ever reset to factory defaults or unpaired.
Type of change
Example entry for
configuration.yaml:Additional information
Checklist
black --fast homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all..coveragerc.The integration reached or maintains the following Integration Quality Scale: