From de990830bc2c3d63d4713c6e178b2389d77625b4 Mon Sep 17 00:00:00 2001 From: Benjamin Braatz Date: Wed, 2 Aug 2023 11:05:06 +0200 Subject: [PATCH] Fix log message if name not send in conf_command. --- controlpi_plugins/wsclient.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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'})) -- 2.34.1