mirror of
https://github.com/elisspace/core.git
synced 2026-10-05 08:46:29 +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:
@@ -231,7 +231,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
return True
|
||||
|
||||
|
||||
class InputSelectStorageCollection(collection.StorageCollection):
|
||||
class InputSelectStorageCollection(collection.DictStorageCollection):
|
||||
"""Input storage based collection."""
|
||||
|
||||
CREATE_UPDATE_SCHEMA = vol.Schema(vol.All(STORAGE_FIELDS, _cv_input_select))
|
||||
@@ -246,11 +246,11 @@ class InputSelectStorageCollection(collection.StorageCollection):
|
||||
return cast(str, info[CONF_NAME])
|
||||
|
||||
async def _update_data(
|
||||
self, data: dict[str, Any], update_data: dict[str, Any]
|
||||
self, item: dict[str, Any], update_data: dict[str, Any]
|
||||
) -> dict[str, Any]:
|
||||
"""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 InputSelect(collection.CollectionEntity, SelectEntity, RestoreEntity):
|
||||
|
||||
Reference in New Issue
Block a user