diff --git a/custom_components/sector/__init__.py b/custom_components/sector/__init__.py index f406132..be57766 100644 --- a/custom_components/sector/__init__.py +++ b/custom_components/sector/__init__.py @@ -84,6 +84,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: new_options = entry.options.copy() new_options.pop(UPDATE_INTERVAL) hass.config_entries.async_update_entry(entry, options=new_options) + if not entry.options.get(CONF_CODE_FORMAT): + new_options = entry.options.copy() + new_options[CONF_CODE_FORMAT] = 6 + hass.config_entries.async_update_entry(entry, options=new_options) await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) diff --git a/custom_components/sector/lock.py b/custom_components/sector/lock.py index 409bc35..fa8e35e 100644 --- a/custom_components/sector/lock.py +++ b/custom_components/sector/lock.py @@ -19,7 +19,7 @@ async def async_setup_entry( """Lock platform.""" coordinator: SectorDataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id] - code_format: int | None = entry.options.get(CONF_CODE_FORMAT, 6) + code_format: int | None = entry.options[CONF_CODE_FORMAT] lock_list: list = [] for panel, panel_data in coordinator.data.items():