From 717a0c2b2d3bbbd0c08fe5642d522280288aaa2d Mon Sep 17 00:00:00 2001 From: Fredrik Erlandsson Date: Tue, 29 Jan 2019 01:46:37 +0100 Subject: [PATCH] fix #20387 devices without model/protocol (#20530) --- homeassistant/components/tellduslive/entry.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/tellduslive/entry.py b/homeassistant/components/tellduslive/entry.py index 929dc700afb6af..d6e56329699baa 100644 --- a/homeassistant/components/tellduslive/entry.py +++ b/homeassistant/components/tellduslive/entry.py @@ -116,10 +116,17 @@ def unique_id(self) -> str: def device_info(self): """Return device info.""" device = self._client.device_info(self.device.device_id) - return { + device_info = { 'identifiers': {('tellduslive', self.device.device_id)}, 'name': self.device.name, - 'model': device['model'].title(), - 'manufacturer': device['protocol'].title(), - 'via_hub': ('tellduslive', device.get('client')), } + model = device.get('model') + if model is not None: + device_info['model'] = model.title() + protocol = device.get('protocol') + if protocol is not None: + device_info['manufacturer'] = protocol.title() + client = device.get('client') + if client is not None: + device_info['via_hub'] = ('tellduslive', client) + return device_info