From 4f0a77fad94b8e61d515ac3cd8457d7fe5106685 Mon Sep 17 00:00:00 2001 From: flatsiedatsie Date: Mon, 11 Jul 2022 13:40:59 +0200 Subject: [PATCH] Add files via upload --- pkg/presence_adapter.py | 4 ++-- pkg/presence_device.py | 39 ++++++++++++++++++++------------------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/pkg/presence_adapter.py b/pkg/presence_adapter.py index 69375e0..366321c 100644 --- a/pkg/presence_adapter.py +++ b/pkg/presence_adapter.py @@ -1757,7 +1757,7 @@ def handle_unfound_accepted_things(self): if _id in self.previously_found.keys(): if self.DEBUG: - print("hurray, device was found again") + print("hurray, device was found again, not a zombie") else: if self.DEBUG: print("Error, zombie detected. This device was not found in the initial scan, should create it and set it to missing") @@ -1766,7 +1766,7 @@ def handle_unfound_accepted_things(self): name = str(self.saved_devices_from_controller[_id]['title']) if self.DEBUG: print("name in saved_devices_from_controller: " + str(name)) - device = PresenceDevice(self, _id, name, "unknown") + device = PresenceDevice(self, _id, name, None) self.handle_device_added(device) # Set thing to connected state diff --git a/pkg/presence_device.py b/pkg/presence_device.py index 38f9a7c..0783dba 100644 --- a/pkg/presence_device.py +++ b/pkg/presence_device.py @@ -39,28 +39,29 @@ def __init__(self, adapter, _id, name, details): self.last_add_mute_time = 0 self.mute_until = 0 - - self.properties['details'] = PresenceProperty( - self, - 'details', - { - 'title': 'IP address', - 'type': 'string', - 'readOnly': True, - }, - str(details)) + + if details != None: + self.properties['details'] = PresenceProperty( + self, + 'details', + { + 'title': 'IP address', + 'type': 'string', + 'readOnly': True, + }, + str(details)) - if self.adapter.DEBUG: - print("+ Adding new device: " + str(name)) + if self.adapter.DEBUG: + print("+ Adding new device: " + str(name)) - action_meta = { "toggle": - { - "@type": "ToggleAction", - "title": "Toggle", - "description": "Toggggle" + action_meta = { "toggle": + { + "@type": "ToggleAction", + "title": "Toggle", + "description": "Toggggle" + } } - } - self.add_action("Data mute", action_meta) + self.add_action("Data mute", action_meta)