Use dataclass for SsdpServiceInfo#59931
Conversation
|
Should |
Only if it can have arbitrary keys. I think the answer is yes, but it would be good to get a comment from StevenLooman or chishm to confirm |
|
|
Edit: I have moved the sample dlna_dmr PR to #59957 |
|
I'll take a closer look when I've got more time, but the biggest concern I have at the moment is that, for discovery, components often match UPnP info (e.g. `deviceType`) in their manifest.json. That will possibly break if it's not in the top-level discovery info dict.
|
8749eed to
bd2133c
Compare
@chishm this PR is not really a breaking change, as the data is duplicated for now. It is more a warning to other users to show that the real breaking change is coming in a future release. |
|
I have created the draft removal PR: #59960 |
Understood, but I thought it best to flag early that this will break how discovery info is matched to components. For example, arcam_fmj defines in it's manifest.json the following: "ssdp": [
{
"deviceType": "urn:schemas-upnp-org:device:MediaRenderer:1",
"manufacturer": "ARCAM"
}
]In the ssdp component this is matched by This will need more consideration before altering the structure of the |
Yes it is already covered in the tests, and implemented in draft #59960 |
Ah, thank you for pointing that out, I missed it on first read-through. I withdraw my concern and will give this a full review tomorrow 😄 |
bd2133c to
67a9014
Compare
|
I have dropped the I have also dropped the |
|
I'll take a look tomorrow after some sleep. |
|
I've run though this a few times now, and I think its good to go. I'm going to test sonos with it first though |
|
Sonos looks good. Already tested discovery. |
Breaking change
Ssdp discovery now uses a dataclass instead of a dictionary object.
Access using
__getitem__will fail in version 2022.6.Please use
<cls>.<name>or<cls>.upnp.<name>instead.Proposed change
Ssdp discovery now uses a dataclass instead of a dictionary object.
Access using
__getitem__will fail in version 2022.6.Please use
<cls>.<name>or<cls>.upnp.<name>instead.Linked to this comment in the architecture discussion home-assistant/architecture#662 (comment)
This is a central PR to see what needs to be done:
SsdpServiceInfo(TypedDict):SsdpServiceInfo(BaseServiceInfo)class:SsdpServiceInfo(BaseServiceInfo)class:ssdp_locationneeds to be optional: Use SsdpServiceInfo for ssdp tests (part 2) #60322getneeds to be implemented: Use SsdpServiceInfo for ssdp tests (part 3) #60334__iter__needs to be implemented: Use SsdpServiceInfo for SOURCE_SSDP tests (part 4) #60339inchecks SSDP attributes can be present but empty #60340SsdpServiceInfo(BaseServiceInfo)indiscovery_flow.async_create_flowSsdpServiceInfoinasync_step_ssdpType of change
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:
To help with the load of incoming pull requests: