fix: 修复网页控制台设置页面保存报错

This commit is contained in:
涵曦 2024-07-06 16:04:07 +00:00
parent 7da80594e3
commit 202105a11f

View File

@ -1051,14 +1051,17 @@ class XiaoMusic:
async def getalldevices(self, **kwargs): async def getalldevices(self, **kwargs):
did_list = [] did_list = []
hardware_list = [] hardware_list = []
hardware_data = await self.mina_service.device_list() try:
for h in hardware_data: hardware_data = await self.mina_service.device_list()
did = h.get("miotDID", "") for h in hardware_data:
if did != "": did = h.get("miotDID", "")
did_list.append(did) if did != "":
hardware = h.get("hardware", "") did_list.append(did)
if h.get("hardware", "") != "": hardware = h.get("hardware", "")
hardware_list.append(hardware) if h.get("hardware", "") != "":
hardware_list.append(hardware)
except Exception as e:
self.log.error(f"Execption {e}")
alldevices = { alldevices = {
"did_list": did_list, "did_list": did_list,
"hardware_list": hardware_list, "hardware_list": hardware_list,