Skip to content

Commit

Permalink
Fix missing validation of entry
Browse files Browse the repository at this point in the history
  • Loading branch information
elad-bar committed Oct 11, 2022
1 parent 60b5c57 commit 8503379
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2.0.1

- Fix missing validation of entry

## 2.0.0
Component refactored to allow faster future integration for additional features.

Expand Down
27 changes: 14 additions & 13 deletions custom_components/edgeos/component/managers/home_assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,25 +135,26 @@ async def async_initialize_data_providers(self):

has_legacy_configuration = False

if self._entry.data is not None:
unit = self._entry.data.get(CONF_UNIT)
if self._entry is not None:
if self._entry.data is not None:
unit = self._entry.data.get(CONF_UNIT)

if unit is not None:
await self.storage_api.set_unit(unit)
if unit is not None:
await self.storage_api.set_unit(unit)

has_legacy_configuration = True
has_legacy_configuration = True

if self._entry.options is not None:
consider_away_interval = self._entry.options.get(CONF_LOG_INCOMING_MESSAGES)
log_incoming_messages = self._entry.options.get(CONF_CONSIDER_AWAY_INTERVAL)
if self._entry.options is not None:
consider_away_interval = self._entry.options.get(CONF_LOG_INCOMING_MESSAGES)
log_incoming_messages = self._entry.options.get(CONF_CONSIDER_AWAY_INTERVAL)

has_legacy_configuration = consider_away_interval is not None or log_incoming_messages is not None
has_legacy_configuration = consider_away_interval is not None or log_incoming_messages is not None

if consider_away_interval is not None:
await self.storage_api.set_consider_away_interval(consider_away_interval)
if consider_away_interval is not None:
await self.storage_api.set_consider_away_interval(consider_away_interval)

if log_incoming_messages is not None:
await self.storage_api.set_log_incoming_messages(log_incoming_messages)
if log_incoming_messages is not None:
await self.storage_api.set_log_incoming_messages(log_incoming_messages)

if has_legacy_configuration:
_LOGGER.info("Starting configuration migration")
Expand Down
2 changes: 1 addition & 1 deletion custom_components/edgeos/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"codeowners": ["@elad-bar"],
"requirements": ["aiohttp"],
"config_flow": true,
"version": "2.0.0",
"version": "2.0.1",
"iot_class": "local_polling"
}

0 comments on commit 8503379

Please sign in to comment.