mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Update ReadOnlyEntityOptions typing (#103813)
This commit is contained in:
parent
c35f56ea77
commit
66d1a7f1dd
@ -17,6 +17,7 @@ from homeassistant.exceptions import HomeAssistantError
|
|||||||
from homeassistant.helpers import entity_registry as er
|
from homeassistant.helpers import entity_registry as er
|
||||||
from homeassistant.helpers.entity import get_device_class
|
from homeassistant.helpers.entity import get_device_class
|
||||||
from homeassistant.helpers.storage import Store
|
from homeassistant.helpers.storage import Store
|
||||||
|
from homeassistant.util.read_only_dict import ReadOnlyDict
|
||||||
|
|
||||||
from .const import DATA_EXPOSED_ENTITIES, DOMAIN
|
from .const import DATA_EXPOSED_ENTITIES, DOMAIN
|
||||||
|
|
||||||
@ -145,7 +146,7 @@ class ExposedEntities:
|
|||||||
assistant, entity_id, key, value
|
assistant, entity_id, key, value
|
||||||
)
|
)
|
||||||
|
|
||||||
assistant_options: Mapping[str, Any]
|
assistant_options: ReadOnlyDict[str, Any] | dict[str, Any]
|
||||||
if (
|
if (
|
||||||
assistant_options := registry_entry.options.get(assistant, {})
|
assistant_options := registry_entry.options.get(assistant, {})
|
||||||
) and assistant_options.get(key) == value:
|
) and assistant_options.get(key) == value:
|
||||||
@ -256,7 +257,8 @@ class ExposedEntities:
|
|||||||
else:
|
else:
|
||||||
should_expose = False
|
should_expose = False
|
||||||
|
|
||||||
assistant_options: Mapping[str, Any] = registry_entry.options.get(assistant, {})
|
assistant_options: ReadOnlyDict[str, Any] | dict[str, Any]
|
||||||
|
assistant_options = registry_entry.options.get(assistant, {})
|
||||||
assistant_options = assistant_options | {"should_expose": should_expose}
|
assistant_options = assistant_options | {"should_expose": should_expose}
|
||||||
entity_registry.async_update_entity_options(
|
entity_registry.async_update_entity_options(
|
||||||
entity_id, assistant, assistant_options
|
entity_id, assistant, assistant_options
|
||||||
|
@ -131,7 +131,7 @@ EventEntityRegistryUpdatedData = (
|
|||||||
|
|
||||||
|
|
||||||
EntityOptionsType = Mapping[str, Mapping[str, Any]]
|
EntityOptionsType = Mapping[str, Mapping[str, Any]]
|
||||||
ReadOnlyEntityOptionsType = ReadOnlyDict[str, Mapping[str, Any]]
|
ReadOnlyEntityOptionsType = ReadOnlyDict[str, ReadOnlyDict[str, Any]]
|
||||||
|
|
||||||
DISLAY_DICT_OPTIONAL = (
|
DISLAY_DICT_OPTIONAL = (
|
||||||
("ai", "area_id"),
|
("ai", "area_id"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user