Skip to content

Commit

Permalink
Allow storing device options in DeviceEntry
Browse files Browse the repository at this point in the history
  • Loading branch information
frenck committed Nov 14, 2021
1 parent c323815 commit 2b07378
Showing 1 changed file with 7 additions and 0 deletions.
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 @@ -257,6 +258,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 @@ -312,6 +314,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 @@ -336,6 +339,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 @@ -353,6 +357,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 @@ -376,6 +381,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 @@ -436,6 +442,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

0 comments on commit 2b07378

Please sign in to comment.