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

Allow storing device options in DeviceEntry #59668

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions homeassistant/helpers/device_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class DeviceEntry:
model: str | None = attr.ib(default=None)
name_by_user: str | None = attr.ib(default=None)
name: str | None = attr.ib(default=None)
options: dict[str, Any] = attr.ib(factory=dict)
suggested_area: str | None = attr.ib(default=None)
sw_version: str | None = attr.ib(default=None)
via_device_id: str | None = attr.ib(default=None)
Expand Down Expand Up @@ -259,6 +260,7 @@ def async_get_or_create(
manufacturer: str | None | UndefinedType = UNDEFINED,
model: str | None | UndefinedType = UNDEFINED,
name: str | None | UndefinedType = UNDEFINED,
options: dict[str, Any] | UndefinedType = UNDEFINED,
suggested_area: str | None | UndefinedType = UNDEFINED,
sw_version: str | None | UndefinedType = UNDEFINED,
via_device: tuple[str, str] | None = None,
Expand Down Expand Up @@ -314,6 +316,7 @@ def async_get_or_create(
merge_identifiers=identifiers or UNDEFINED,
model=model,
name=name,
options=options,
suggested_area=suggested_area,
sw_version=sw_version,
via_device_id=via_device_id,
Expand All @@ -338,6 +341,7 @@ def async_update_device(
name_by_user: str | None | UndefinedType = UNDEFINED,
name: str | None | UndefinedType = UNDEFINED,
new_identifiers: set[tuple[str, str]] | UndefinedType = UNDEFINED,
options: dict[str, Any] | UndefinedType = UNDEFINED,
remove_config_entry_id: str | UndefinedType = UNDEFINED,
suggested_area: str | None | UndefinedType = UNDEFINED,
sw_version: str | None | UndefinedType = UNDEFINED,
Expand All @@ -355,6 +359,7 @@ def async_update_device(
name_by_user=name_by_user,
name=name,
new_identifiers=new_identifiers,
options=options,
remove_config_entry_id=remove_config_entry_id,
suggested_area=suggested_area,
sw_version=sw_version,
Expand All @@ -378,6 +383,7 @@ def _async_update_device(
name_by_user: str | None | UndefinedType = UNDEFINED,
name: str | None | UndefinedType = UNDEFINED,
new_identifiers: set[tuple[str, str]] | UndefinedType = UNDEFINED,
options: dict[str, Any] | UndefinedType = UNDEFINED,
remove_config_entry_id: str | UndefinedType = UNDEFINED,
suggested_area: str | None | UndefinedType = UNDEFINED,
sw_version: str | None | UndefinedType = UNDEFINED,
Expand Down Expand Up @@ -438,6 +444,7 @@ def _async_update_device(
("manufacturer", manufacturer),
("model", model),
("name", name),
("options", options),
("suggested_area", suggested_area),
("sw_version", sw_version),
("via_device_id", via_device_id),
Expand Down