Fix loading created_at/modified_at from entity registry store (#122486)
parent
57c554f516
commit
e00f159ebe
|
@ -1286,7 +1286,7 @@ class EntityRegistry(BaseRegistry):
|
|||
categories=entity["categories"],
|
||||
capabilities=entity["capabilities"],
|
||||
config_entry_id=entity["config_entry_id"],
|
||||
created_at=entity["created_at"],
|
||||
created_at=datetime.fromisoformat(entity["created_at"]),
|
||||
device_class=entity["device_class"],
|
||||
device_id=entity["device_id"],
|
||||
disabled_by=RegistryEntryDisabler(entity["disabled_by"])
|
||||
|
@ -1303,7 +1303,7 @@ class EntityRegistry(BaseRegistry):
|
|||
id=entity["id"],
|
||||
has_entity_name=entity["has_entity_name"],
|
||||
labels=set(entity["labels"]),
|
||||
modified_at=entity["modified_at"],
|
||||
modified_at=datetime.fromisoformat(entity["modified_at"]),
|
||||
name=entity["name"],
|
||||
options=entity["options"],
|
||||
original_device_class=entity["original_device_class"],
|
||||
|
@ -1335,10 +1335,10 @@ class EntityRegistry(BaseRegistry):
|
|||
)
|
||||
deleted_entities[key] = DeletedRegistryEntry(
|
||||
config_entry_id=entity["config_entry_id"],
|
||||
created_at=entity["created_at"],
|
||||
created_at=datetime.fromisoformat(entity["created_at"]),
|
||||
entity_id=entity["entity_id"],
|
||||
id=entity["id"],
|
||||
modified_at=entity["modified_at"],
|
||||
modified_at=datetime.fromisoformat(entity["modified_at"]),
|
||||
orphaned_timestamp=entity["orphaned_timestamp"],
|
||||
platform=entity["platform"],
|
||||
unique_id=entity["unique_id"],
|
||||
|
|
|
@ -19,6 +19,7 @@ from homeassistant.const import (
|
|||
from homeassistant.core import CoreState, HomeAssistant, callback
|
||||
from homeassistant.exceptions import MaxLengthExceeded
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
from homeassistant.util.dt import utc_from_timestamp
|
||||
|
||||
from tests.common import (
|
||||
ANY,
|
||||
|
@ -442,6 +443,8 @@ async def test_filter_on_load(
|
|||
assert entry_with_name.name == "registry override"
|
||||
assert entry_without_name.name is None
|
||||
assert not entry_with_name.disabled
|
||||
assert entry_with_name.created_at == utc_from_timestamp(0)
|
||||
assert entry_with_name.modified_at == utc_from_timestamp(0)
|
||||
|
||||
entry_disabled_hass = registry.async_get_or_create(
|
||||
"test", "super_platform", "disabled-hass"
|
||||
|
|
Loading…
Reference in New Issue