From 23b3e17e979e44c9347c0a16c544735fffd2487e Mon Sep 17 00:00:00 2001 From: tomaae <23486452+tomaae@users.noreply.github.com> Date: Sun, 8 Dec 2019 19:19:26 +0100 Subject: [PATCH] skip scripts without a name #3 --- custom_components/mikrotik_router/mikrotik_controller.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/custom_components/mikrotik_router/mikrotik_controller.py b/custom_components/mikrotik_router/mikrotik_controller.py index 73b66ae..f2ad2bb 100644 --- a/custom_components/mikrotik_router/mikrotik_controller.py +++ b/custom_components/mikrotik_router/mikrotik_controller.py @@ -205,7 +205,7 @@ class MikrotikControllerData(): self.data['interface'][uid] = {} self.data['interface'][uid]['default-name'] = from_entry(entry, 'default-name') - self.data['interface'][uid]['name'] = from_entry(entry, 'name', entry['default-name']) + self.data['interface'][uid]['name'] = from_entry(entry, 'name', default=entry['default-name']) self.data['interface'][uid]['type'] = from_entry(entry, 'type', 'unknown') self.data['interface'][uid]['running'] = from_entry_bool(entry, 'running') self.data['interface'][uid]['enabled'] = from_entry_bool(entry, 'disabled', reverse=True) @@ -450,6 +450,9 @@ class MikrotikControllerData(): if 'name' not in entry: continue + if not entry['name']: + continue + uid = entry['name'] if uid not in self.data['script']: self.data['script'][uid] = {}