mirror of
https://github.com/elisspace/core.git
synced 2026-09-30 22:39:55 +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:
@@ -56,7 +56,7 @@ STORAGE_KEY = DOMAIN
|
||||
STORAGE_VERSION = 1
|
||||
|
||||
|
||||
class InputButtonStorageCollection(collection.StorageCollection):
|
||||
class InputButtonStorageCollection(collection.DictStorageCollection):
|
||||
"""Input button collection stored in storage."""
|
||||
|
||||
CREATE_UPDATE_SCHEMA = vol.Schema(STORAGE_FIELDS)
|
||||
@@ -70,10 +70,10 @@ class InputButtonStorageCollection(collection.StorageCollection):
|
||||
"""Suggest an ID based on the config."""
|
||||
return cast(str, 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
|
||||
|
||||
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user