Skip to content

Commit

Permalink
Error handling dz read (zigbeefordomoticz#1819)
Browse files Browse the repository at this point in the history
* do not store nor use Domoticz database for plugin db
* more resilient when reading Domoticz db
  • Loading branch information
pipiche38 authored Dec 24, 2024
1 parent b95d2cf commit 7894398
Show file tree
Hide file tree
Showing 3 changed files with 7 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
3 changes: 3 additions & 0 deletions plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,9 @@ def onStart(self):
self.zigbee_communication, self.VersionNewFashion, self.DomoticzMajor, self.DomoticzMinor, Parameters["HomeFolder"], self.HardwareID
)

self.pluginconf.pluginConf["useDomoticzDatabase"] = False
self.pluginconf.pluginConf["storeDomoticzDatabase"] = False

if self.internet_available is None:
self.internet_available = is_internet_available()

Expand Down

0 comments on commit 7894398

Please sign in to comment.