Standardize Vizio update service schema (#38636)
* update voluptuous schema to match standards and to handle data transformations * improve test
This commit is contained in:
1 parent
50cd6be18d
commit
0d5e279509
3 files changed
+18
-6
No files matched your search
@@ -34,9 +34,9 @@ ATTR_SETTING_NAME = "setting_name"
|
||||
ATTR_NEW_VALUE = "new_value"
|
||||
|
||||
UPDATE_SETTING_SCHEMA = {
|
||||
vol.Required(ATTR_SETTING_TYPE): cv.string,
|
||||
vol.Required(ATTR_SETTING_NAME): cv.string,
|
||||
vol.Required(ATTR_NEW_VALUE): vol.Or(vol.Coerce(int), cv.string),
|
||||
vol.Required(ATTR_SETTING_TYPE): vol.All(cv.string, vol.Lower, cv.slugify),
|
||||
vol.Required(ATTR_SETTING_NAME): vol.All(cv.string, vol.Lower, cv.slugify),
|
||||
vol.Required(ATTR_NEW_VALUE): vol.Any(vol.Coerce(int), cv.string),
|
||||
}
|
||||
|
||||
CONF_ADDITIONAL_CONFIGS = "additional_configs"
|
||||
|
||||
@@ -291,9 +291,7 @@ class VizioDevice(MediaPlayerEntity):
|
||||
) -> None:
|
||||
"""Update a setting when update_setting service is called."""
|
||||
await self._device.set_setting(
|
||||
setting_type.lower().replace(" ", "_"),
|
||||
setting_name.lower().replace(" ", "_"),
|
||||
new_value,
|
||||
setting_type, setting_name, new_value,
|
||||
)
|
||||
|
||||
async def async_added_to_hass(self):
|
||||
|
||||
Reference in new issue
Block a user