mirror of
https://github.com/andvikt/mega_hacs.git
synced 2025-12-11 17:14:28 +05:00
hotfix
This commit is contained in:
@@ -153,10 +153,12 @@ class MegaD:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
if '"value":NA' in msg.payload.decode():
|
if '"value":NA' in msg.payload.decode():
|
||||||
ftr.set_result(None)
|
if not ftr.done():
|
||||||
|
ftr.set_result(None)
|
||||||
return
|
return
|
||||||
ret = json.loads(msg.payload).get('value')
|
ret = json.loads(msg.payload).get('value')
|
||||||
ftr.set_result(ret)
|
if not ftr.done():
|
||||||
|
ftr.set_result(ret)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
ret = None
|
ret = None
|
||||||
self.lg.exception(f'while parsing response from port {port}: {msg.payload}')
|
self.lg.exception(f'while parsing response from port {port}: {msg.payload}')
|
||||||
@@ -167,12 +169,12 @@ class MegaD:
|
|||||||
)
|
)
|
||||||
|
|
||||||
async with self.lck:
|
async with self.lck:
|
||||||
|
unsub = await self.mqtt.async_subscribe(
|
||||||
|
topic=f'{self.mqtt_id}/{port}',
|
||||||
|
msg_callback=cb,
|
||||||
|
qos=1,
|
||||||
|
)
|
||||||
try:
|
try:
|
||||||
unsub = await self.mqtt.async_subscribe(
|
|
||||||
topic=f'{self.mqtt_id}/{port}',
|
|
||||||
msg_callback=cb,
|
|
||||||
qos=1,
|
|
||||||
)
|
|
||||||
await self.mqtt.async_publish(
|
await self.mqtt.async_publish(
|
||||||
topic=f'{self.mqtt_id}/cmd',
|
topic=f'{self.mqtt_id}/cmd',
|
||||||
payload=f'get:{port}',
|
payload=f'get:{port}',
|
||||||
|
|||||||
Reference in New Issue
Block a user