mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Avoid double dict conversion in bluetooth serialize_entity_description (#115551)
This commit is contained in:
parent
09b209245a
commit
7e84158fad
@ -116,11 +116,10 @@ def deserialize_entity_description(
|
||||
|
||||
def serialize_entity_description(description: EntityDescription) -> dict[str, Any]:
|
||||
"""Serialize an entity description."""
|
||||
as_dict = dataclasses.asdict(description)
|
||||
return {
|
||||
field.name: as_dict[field.name]
|
||||
field.name: value
|
||||
for field in cached_fields(type(description))
|
||||
if field.default != as_dict.get(field.name)
|
||||
if (value := getattr(description, field.name)) != field.default
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user