Skip to content

Commit

Permalink
refactor test and make storeDomoticzDatabase or useDomoticzDatabase t…
Browse files Browse the repository at this point in the history
…o read Domoticz
  • Loading branch information
pipiche38 committed Oct 30, 2024
1 parent f57cd04 commit 95fc966
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions Modules/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def LoadDeviceList(self):
if self.pluginconf.pluginConf["storeDomoticzDatabase"]:
ListOfDevices_from_Domoticz, saving_time = _read_DeviceList_Domoticz(self)

if self.pluginconf.pluginConf["storeDomoticzDatabase"] and self.pluginconf.pluginConf["useDomoticzDatabase"] and is_domoticz_recent(self, saving_time, txt_devicelist_filename):
if ( self.pluginconf.pluginConf["storeDomoticzDatabase"] or self.pluginconf.pluginConf["useDomoticzDatabase"]) and is_domoticz_recent(self, saving_time, txt_devicelist_filename):
self.log.logging( "Database", "Debug", "Database from Domoticz is recent: Loading from Domoticz Db")
res = "Success"

Expand All @@ -168,7 +168,6 @@ def LoadDeviceList(self):
self.log.logging("Database", "Status", "Z4D %s entries loaded from Domoticz" % (len(self.ListOfDevices)))

else:

# Loading from TXT file
if os.path.isfile(txt_devicelist_filename):
res = loadTxtDatabase(self, txt_devicelist_filename)
Expand All @@ -186,9 +185,6 @@ def LoadDeviceList(self):
self.log.logging("Database", "Debug", "LoadDeviceList - DeviceList filename : %s" % txt_devicelist_filename)
Modules.tools.helper_versionFile(txt_devicelist_filename, self.pluginconf.pluginConf["numDeviceListVersion"])

# Keep the Size of the DeviceList in order to check changes
self.DeviceListSize = os.path.getsize(txt_devicelist_filename)

remove_stale_entries_from_tables( self)

if self.pluginconf.pluginConf["ZigpyTopologyReport"]:
Expand Down

0 comments on commit 95fc966

Please sign in to comment.