mirror of
https://github.com/elisspace/core.git
synced 2026-10-01 14:59:53 +00:00
Allow storing other items than untyped dict in StorageCollection (#90932)
Allow storing other items than untyped dict in StorageCollection
This commit is contained in:
@@ -203,7 +203,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
return True
|
||||
|
||||
|
||||
class DateTimeStorageCollection(collection.StorageCollection):
|
||||
class DateTimeStorageCollection(collection.DictStorageCollection):
|
||||
"""Input storage based collection."""
|
||||
|
||||
CREATE_UPDATE_SCHEMA = vol.Schema(vol.All(STORAGE_FIELDS, has_date_or_time))
|
||||
@@ -217,10 +217,10 @@ class DateTimeStorageCollection(collection.StorageCollection):
|
||||
"""Suggest an ID based on the config."""
|
||||
return info[CONF_NAME]
|
||||
|
||||
async def _update_data(self, data: dict, update_data: dict) -> dict:
|
||||
async def _update_data(self, item: dict, update_data: dict) -> dict:
|
||||
"""Return a new updated data object."""
|
||||
update_data = self.CREATE_UPDATE_SCHEMA(update_data)
|
||||
return {CONF_ID: data[CONF_ID]} | update_data
|
||||
return {CONF_ID: item[CONF_ID]} | update_data
|
||||
|
||||
|
||||
class InputDatetime(collection.CollectionEntity, RestoreEntity):
|
||||
|
||||
Reference in New Issue
Block a user