Fix log message if name not send in conf_command.
authorBenjamin Braatz <bb@bbraatz.eu>
Wed, 2 Aug 2023 09:05:06 +0000 (11:05 +0200)
committerBenjamin Braatz <bb@bbraatz.eu>
Wed, 2 Aug 2023 09:05:06 +0000 (11:05 +0200)
controlpi_plugins/wsclient.py

index 639e81ada90eb98250a166b5fcff21439999e46b..cc8814520ca55e6f16a9881fb0c6cf6cfb1b7059 100644 (file)
@@ -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'}))