Skip to content

Commit

Permalink
Fix for restart losing config entities (#1192)
Browse files Browse the repository at this point in the history
* Fix for restart losing config entities

* [pre-commit.ci lite] apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
  • Loading branch information
springfall2008 and pre-commit-ci-lite[bot] authored Jun 8, 2024
1 parent 7ee650c commit e8db971
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apps/predbat/predbat.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
if not "PRED_GLOBAL" in globals():
PRED_GLOBAL = {}

THIS_VERSION = "v7.22.3"
THIS_VERSION = "v7.22.4"
PREDBAT_FILES = ["predbat.py"]
TIME_FORMAT = "%Y-%m-%dT%H:%M:%S%z"
TIME_FORMAT_SECONDS = "%Y-%m-%dT%H:%M:%S.%f%z"
Expand Down Expand Up @@ -15037,6 +15037,7 @@ def load_user_config(self, quiet=True, register=False):
Load config from HA
"""
self.config_index = {}
self.log("Refreshing Predbat configuration")

# New install, used to set default of expert mode
new_install = True
Expand Down Expand Up @@ -15112,7 +15113,7 @@ def load_user_config(self, quiet=True, register=False):
if item.get("manual"):
self.manual_times(name, new_value=ha_value)
else:
self.expose_config(item["name"], ha_value, quiet=quiet)
self.expose_config(item["name"], ha_value, quiet=quiet, force=True)

# Update the last time we refreshed the config
self.set_state_wrapper(entity_id=self.prefix + ".config_refresh", state=self.now_utc.strftime(TIME_FORMAT))
Expand Down Expand Up @@ -15667,6 +15668,7 @@ def update_states(self):
return
res = self.api_call("/api/states")
if res:
self.state_data = {}
for item in res:
self.update_state_item(item)
else:
Expand Down

0 comments on commit e8db971

Please sign in to comment.