Fix vizio bug to use 'get' to get volume_step since it is optional (#32151)

* use get to get volume_step since it is optional

* always set volume_step to default in options and data if its not included
This commit is contained in:
Raman Gupta authored and Paulus Schoutsen committed 2020-02-24 19:36:14 -08:00
1 parent 6edef444a7
commit 45d63e22d5
2 files changed
+8 -5

No files matched your search

@@ -177,8 +177,11 @@ class VizioConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
if entry.data[CONF_NAME] != import_config[CONF_NAME]:
updated_name[CONF_NAME] = import_config[CONF_NAME]
if entry.data[CONF_VOLUME_STEP] != import_config[CONF_VOLUME_STEP]:
updated_options[CONF_VOLUME_STEP] = import_config[CONF_VOLUME_STEP]
import_volume_step = import_config.get(
CONF_VOLUME_STEP, DEFAULT_VOLUME_STEP
)
if entry.data.get(CONF_VOLUME_STEP) != import_volume_step:
updated_options[CONF_VOLUME_STEP] = import_volume_step
if updated_options or updated_name:
new_data = entry.data.copy()