Skip to content

Commit

Permalink
more resilient when reading Domoticz db
Browse files Browse the repository at this point in the history
  • Loading branch information
pipiche38 committed Dec 24, 2024
1 parent ef2419b commit d65b05a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Classes/PluginConf.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,8 +547,8 @@ def _load_Settings(self):
if is_domoticz_db_available(self):
_domoticz_pluginConf = getConfigItem(Key="PluginConf")
if "TimeStamp" in _domoticz_pluginConf:
dz_timestamp = _domoticz_pluginConf["TimeStamp"]
_domoticz_pluginConf = _domoticz_pluginConf["b64Settings"]
dz_timestamp = _domoticz_pluginConf.get("TimeStamp",0)
_domoticz_pluginConf = _domoticz_pluginConf.get("b64Settings",{})
Domoticz.Log(
"Plugin data loaded where saved on %s"
% (time.strftime("%A, %Y-%m-%d %H:%M:%S", time.localtime(dz_timestamp)))
Expand Down
4 changes: 2 additions & 2 deletions Modules/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,8 @@ def _read_DeviceList_Domoticz(self):
ListOfDevices_from_Domoticz = getConfigItem(Key="ListOfDevices", Attribute="Devices")
time_stamp = 0
if "TimeStamp" in ListOfDevices_from_Domoticz:
time_stamp = ListOfDevices_from_Domoticz["TimeStamp"]
ListOfDevices_from_Domoticz = ListOfDevices_from_Domoticz["Devices"]
time_stamp = ListOfDevices_from_Domoticz.get("TimeStamp",0)
ListOfDevices_from_Domoticz = ListOfDevices_from_Domoticz.get("Devices",{})
self.log.logging(
"Database",
"Log",
Expand Down

0 comments on commit d65b05a

Please sign in to comment.