Skip to content

Commit

Permalink
Merge pull request #162 from gjohansson-ST/ensure-code-format
Browse files Browse the repository at this point in the history
Ensure code format
  • Loading branch information
gjohansson-ST authored Nov 3, 2023
2 parents ae1fd17 + 07b1660 commit 5c2f459
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions custom_components/sector/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion custom_components/sector/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit 5c2f459

Please sign in to comment.