Skip to content

Commit

Permalink
Fix configuration load, save and import processes
Browse files Browse the repository at this point in the history
  • Loading branch information
elad-bar committed Oct 13, 2022
1 parent 3acf63f commit 06171f6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## 2.0.6

- Fix configuration save
- Fix configuration load, save and import processes

## 2.0.5

Expand Down
12 changes: 9 additions & 3 deletions custom_components/edgeos/component/managers/home_assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,12 @@ async def async_component_initialize(self, entry: ConfigEntry):
self._config_manager = ConfigurationManager(self._hass, self.api)
await self._config_manager.load(entry)

await self.storage_api.initialize(self.config_data)

update_entities_interval = timedelta(seconds=self.storage_api.update_entities_interval)
update_api_interval = timedelta(seconds=self.storage_api.update_api_interval)

_LOGGER.info(f"Setting intervals, API: {update_api_interval}, Entities: {update_entities_interval}")
self.update_intervals(update_entities_interval, update_api_interval)

except Exception as ex:
Expand Down Expand Up @@ -157,12 +160,13 @@ async def async_initialize_data_providers(self):
}

for key in storage_data_import_keys:
if key in self._entry.options:
entry_key = key.replace(STRING_DASH, STRING_UNDERSCORE)

if entry_key in self._entry.options:
if not has_legacy_configuration:
has_legacy_configuration = True

data_key = key.replace(STRING_DASH, STRING_UNDERSCORE)
data = self._entry.options.get(data_key)
data = self._entry.options.get(entry_key)
set_func = storage_data_import_keys.get(key)

await set_func(data)
Expand Down Expand Up @@ -221,6 +225,8 @@ def load_devices(self):
self._load_interface_device(interface_item)

def load_entities(self):
_LOGGER.info("Loading entities")

if not self._can_load_components:
return

Expand Down

0 comments on commit 06171f6

Please sign in to comment.