From 9ac0141e4d49e87540b633f352842515f337c830 Mon Sep 17 00:00:00 2001 From: avollkopf <43980694+avollkopf@users.noreply.github.com> Date: Mon, 11 Apr 2022 10:06:54 +0200 Subject: [PATCH] sort hardware by name --- cbpi/__init__.py | 2 +- cbpi/websocket.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cbpi/__init__.py b/cbpi/__init__.py index 8e2c938..07288d7 100644 --- a/cbpi/__init__.py +++ b/cbpi/__init__.py @@ -1,3 +1,3 @@ -__version__ = "4.0.5.a7" +__version__ = "4.0.5.a8" __codename__ = "Spring Break" diff --git a/cbpi/websocket.py b/cbpi/websocket.py index fa6bc5c..842f46f 100644 --- a/cbpi/websocket.py +++ b/cbpi/websocket.py @@ -33,6 +33,10 @@ class CBPiWebSocket: for ws in self._clients: async def send_data(ws, data): try: + try: + data['data'].sort(key=lambda x: x.get('name').upper()) + except: + pass await ws.send_json(data=data, dumps=json_dumps) except Exception as e: self.logger.error("Error with client %s: %s" % (ws, str(e)))