From 413df9d32c88b11cfdd937037adf2ca2e739673b Mon Sep 17 00:00:00 2001 From: flatsiedatsie Date: Tue, 23 Jan 2024 13:42:38 +0100 Subject: [PATCH] Add files via upload --- js/extension.js | 2 +- manifest.json | 2 +- pkg/presence_adapter.py | 13 +++++++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/js/extension.js b/js/extension.js index 4b0e45b..6018348 100644 --- a/js/extension.js +++ b/js/extension.js @@ -173,7 +173,7 @@ if(typeof body.debug != 'undefined'){ this.debug = body.debug; if(this.debug){ - console.log("Network presence Init API result: ", body); + console.log("Network presence: debug: init API result: ", body); if(document.getElementById('extension-network-presence-debug-warning') != null){ document.getElementById('extension-network-presence-debug-warning').style.display = 'block'; } diff --git a/manifest.json b/manifest.json index 90fe956..3e83efc 100644 --- a/manifest.json +++ b/manifest.json @@ -70,7 +70,7 @@ } }, "short_name": "Network pres", - "version": "2.1.3", + "version": "2.1.4", "web_accessible_resources": [ "css/*.css", "images/*.svg", diff --git a/pkg/presence_adapter.py b/pkg/presence_adapter.py index 8a0b6e0..8c40836 100644 --- a/pkg/presence_adapter.py +++ b/pkg/presence_adapter.py @@ -117,8 +117,10 @@ def __init__(self, verbose=False): #if self.DEBUG: #print("Persistent data was loaded succesfully") # debug will never be true here unless set in the code above if 'devices' in self.previous_data: + #pass self.previously_found = self.previous_data['devices'] else: + #pass self.previously_found = self.previous_data else: print("loaded json was from version 1.0, clearing incompatible persistent data") @@ -1418,7 +1420,7 @@ def parse_found_device(self,ip_address,found_device_name="unnamed",mac_address=" new_device = False possible_name = found_device_name - + abort_adding = False _id = mac_to_id(mac_address) #mac_address.replace(":", "") @@ -1440,7 +1442,7 @@ def parse_found_device(self,ip_address,found_device_name="unnamed",mac_address=" if _id not in self.previously_found: if self.DEBUG: - print("\n\n\n! NEW !\n\nparse_found_device: _id NOT already in previously_found: " + str(_id) + ", ip: " + str(ip_address)) + print("\n\n\n!? NEW ?!\n\nparse_found_device: _id NOT already in previously_found: " + str(_id) + ", ip: " + str(ip_address)) print("self.avahi_lookup_table: " + str(self.avahi_lookup_table)) print("self.candle_controllers_ip_list: " + str(self.candle_controllers_ip_list)) print("") @@ -1527,7 +1529,9 @@ def parse_found_device(self,ip_address,found_device_name="unnamed",mac_address=" found_device_name = vendor - found_device_name = "Presence - " +str(found_device_name) + ' (' + str(ip_address) + ')' + + + found_device_name = "Presence - " + str(found_device_name) + ' (' + str(ip_address) + ')' possible_name = found_device_name @@ -1579,6 +1583,7 @@ def parse_found_device(self,ip_address,found_device_name="unnamed",mac_address=" if str(ip_address) == str(self.previously_found[key]['ip']): if self.DEBUG: print('\n--> SOMETHING FISHY: same name, same ip address.. just not the same mac?: ' + str(key) + ' =?= ' + str(_id) + '\n') + abort_adding = True except: if self.DEBUG: print("Error, no ip in previously found device data?") @@ -1641,7 +1646,7 @@ def parse_found_device(self,ip_address,found_device_name="unnamed",mac_address=" if self.previously_found[_id] != None: if self.DEBUG: print("Error, somehow this id was already in the previously_found dict") - else: + elif abort_adding == False: if self.DEBUG: print('\nADDING new entry to previously_found') self.previously_found[_id] = {}