From: Benjamin Braatz Date: Wed, 2 Aug 2023 09:05:06 +0000 (+0200) Subject: Fix log message if name not send in conf_command. X-Git-Tag: v0.3.4~1 X-Git-Url: http://git.graph-it.com/?a=commitdiff_plain;h=de990830bc2c3d63d4713c6e178b2389d77625b4;p=graphit%2Fcontrolpi-wsclient.git Fix log message if name not send in conf_command. --- diff --git a/controlpi_plugins/wsclient.py b/controlpi_plugins/wsclient.py index 639e81a..cc88145 100644 --- a/controlpi_plugins/wsclient.py +++ b/controlpi_plugins/wsclient.py @@ -220,8 +220,13 @@ class WSClient(BasePlugin): conf_command['down filter'] = down_filter json_command = json.dumps(conf_command) await websocket.send(json_command) - print(f"WSClient '{self.name}': Connection configured" - f" to {self.conf['url']} as '{conf_command['name']}'.") + if 'name' in conf_command: + print(f"WSClient '{self.name}': Connection configured" + f" to {self.conf['url']}" + f" as '{conf_command['name']}'.") + else: + print(f"WSClient '{self.name}': Connection configured" + f" to {self.conf['url']}.") await self.bus.send(Message(self.name, {'event': 'connection configured'}))