sort hardware by name

This commit is contained in:
avollkopf 2022-04-11 10:06:54 +02:00
parent 4d95017842
commit 9ac0141e4d
2 changed files with 5 additions and 1 deletions

View file

@ -1,3 +1,3 @@
__version__ = "4.0.5.a7" __version__ = "4.0.5.a8"
__codename__ = "Spring Break" __codename__ = "Spring Break"

View file

@ -33,6 +33,10 @@ class CBPiWebSocket:
for ws in self._clients: for ws in self._clients:
async def send_data(ws, data): async def send_data(ws, data):
try: try:
try:
data['data'].sort(key=lambda x: x.get('name').upper())
except:
pass
await ws.send_json(data=data, dumps=json_dumps) await ws.send_json(data=data, dumps=json_dumps)
except Exception as e: except Exception as e:
self.logger.error("Error with client %s: %s" % (ws, str(e))) self.logger.error("Error with client %s: %s" % (ws, str(e)))