albertogeniola / MerossIot

Async Python library for controlling Meross devices
https://albertogeniola.github.io/MerossIot/
MIT License
478 stars 88 forks source link

performance/inconsistent device polls when multiple devices are listed on account #398

Open vbabson opened 4 hours ago

vbabson commented 4 hours ago

When using the example toggle code, I am sometimes presented with all six of my current devices and sometimes half of them. When looping through the dev array and looking for the device I want to act on I sometimes get a match, sometimes don't. I often have to execute my code a number of times. Am I missing something?

python /opt/camboot.py vb INFO:Login successful against https://iotx-us.meross.com INFO:

------- Triggering Manager Discovery, filter_device: [None] ------- INFO:Allocating new mqtt client for mqtt-us-4.meross.com:443... INFO:Subscribed to topics, scheduling state update for already known devices. INFO:

------- Triggering Manager Discovery, filter_device: [None] ------- ERROR:Timeout occurred while waiting a response for message b'{"header":{"from":"/app/3301789-545b02675bd017ffc35c8b59703fc909/subscribe","messageId":"3592e216c97e3b317dc767ff8cee7f9f","method":"GET","namespace":"Appliance.System.Ability","payloadVersion":1,"sign":"0a9f7870aec0ca7f67914ecccd4919dc","timestamp":1726870366,"triggerSrc":"Android","uuid":"2212143829244551080948e1e9b35727"},"payload":{}}' sent to device uuid 2212143829244551080948e1e9b35727. Timeout was: 10.000000 seconds. Mqtt Host: mqtt-us-4.meross.com:443. WARNING:Device Master bedroom (2212143829244551080948e1e9b35727) is online, but timeout occurred when fetching its abilities. ERROR:Timeout occurred while waiting a response for message b'{"header":{"from":"/app/3301789-545b02675bd017ffc35c8b59703fc909/subscribe","messageId":"60a54e84af34cdabcf9aa1f5ac2568c2","method":"GET","namespace":"Appliance.System.Ability","payloadVersion":1,"sign":"0e4eec800b3d63e43410e96545ba81c2","timestamp":1726870366,"triggerSrc":"Android","uuid":"2212143829244551080948e1e9b35727"},"payload":{}}' sent to device uuid 2212143829244551080948e1e9b35727. Timeout was: 10.000000 seconds. Mqtt Host: mqtt-us-4.meross.com:443. WARNING:Device Master bedroom (2212143829244551080948e1e9b35727) is online, but timeout occurred when fetching its abilities. INFO:Device Garage pi (#BASE:2212140436515251080948e1e9b3e17c) has been already added to the registry. INFO:Device Kitchen pi (#BASE:2212143407783651080948e1e9b3df6a) has been already added to the registry. INFO:Device Dining room pi (#BASE:2212145425359351080948e1e9b3c38e) has been already added to the registry. INFO:Fetch and update done INFO: ------- Manager Discovery ended -------

INFO:Device Living room pi (#BASE:2212149598018651080948e1e9b3c3b2) has been already added to the registry. INFO:Device Basement (#BASE:2212142584735451080948e1e9b38746) has been already added to the registry. INFO:Fetch and update done INFO: ------- Manager Discovery ended -------

WARNING:Found a new device Garage pi (mss110, HW 8.0.0, FW 6.2.5, class: mss110:8.0.0:6.2.5) that has become online while we were offline. WARNING:Found a new device Kitchen pi (mss110, HW 8.0.0, FW 6.2.5, class: mss110:8.0.0:6.2.5) that has become online while we were offline. WARNING:Found a new device Dining room pi (mss110, HW 8.0.0, FW 6.2.5, class: mss110:8.0.0:6.2.5) that has become online while we were offline. WARNING:Found a new device Living room pi (mss110, HW 8.0.0, FW 6.2.5, class: mss110:8.0.0:6.2.5) that has become online while we were offline. WARNING:Found a new device Basement (mss110, HW 8.0.0, FW 6.2.5, class: mss110:8.0.0:6.2.5) that has become online while we were offline. dev name: Garage pi user: vb

and a run 2 seconds later:

root@AutoPi:~# python /opt/camboot.py vb INFO:Login successful against https://iotx-us.meross.com INFO:

------- Triggering Manager Discovery, filter_device: [None] ------- INFO:Allocating new mqtt client for mqtt-us-4.meross.com:443... INFO:Subscribed to topics, scheduling state update for already known devices. INFO:

------- Triggering Manager Discovery, filter_device: [None] ------- INFO:Device Kitchen pi (#BASE:2212143407783651080948e1e9b3df6a) has been already added to the registry. INFO:Device Dining room pi (#BASE:2212145425359351080948e1e9b3c38e) has been already added to the registry. INFO:Device Living room pi (#BASE:2212149598018651080948e1e9b3c3b2) has been already added to the registry. INFO:Device Basement (#BASE:2212142584735451080948e1e9b38746) has been already added to the registry. WARNING:Received a push notification (Namespace.SYSTEM_ONLINE, raw_data: {"online": {"status": 2}}) for device(s) (2212143829244551080948e1e9b35727) that are not available in the local registry. Trigger a discovery to intercept those events. WARNING:Received a push notification for a device that is not available in the local registry. You may need to trigger a discovery to catch those updates. Device-UUID: 2212143829244551080948e1e9b35727 WARNING:Uncaught push notification Namespace.SYSTEM_ONLINE. Raw data: {"online": {"status": 2}} WARNING:Received a push notification (Namespace.SYSTEM_ONLINE, raw_data: {"online": {"status": 1}}) for device(s) (2212143829244551080948e1e9b35727) that are not available in the local registry. Trigger a discovery to intercept those events. WARNING:Received a push notification for a device that is not available in the local registry. You may need to trigger a discovery to catch those updates. Device-UUID: 2212143829244551080948e1e9b35727 WARNING:Uncaught push notification Namespace.SYSTEM_ONLINE. Raw data: {"online": {"status": 1}} ERROR:Timeout occurred while waiting a response for message b'{"header":{"from":"/app/3301789-65051773a6fd1b7a432b9090b4f16d50/subscribe","messageId":"c1f1816c2ec8a4d2a2155473596a4402","method":"GET","namespace":"Appliance.System.Ability","payloadVersion":1,"sign":"e857e0494266e135806228d9665d338e","timestamp":1726870616,"triggerSrc":"Android","uuid":"2212143829244551080948e1e9b35727"},"payload":{}}' sent to device uuid 2212143829244551080948e1e9b35727. Timeout was: 10.000000 seconds. Mqtt Host: mqtt-us-4.meross.com:443. WARNING:Device Master bedroom (2212143829244551080948e1e9b35727) is online, but timeout occurred when fetching its abilities. ERROR:Timeout occurred while waiting a response for message b'{"header":{"from":"/app/3301789-65051773a6fd1b7a432b9090b4f16d50/subscribe","messageId":"9bc392ec193fd908829f9bba9780c5b3","method":"GET","namespace":"Appliance.System.Ability","payloadVersion":1,"sign":"6c4bf39e3d6fa12aaff3b562e6f4d547","timestamp":1726870616,"triggerSrc":"Android","uuid":"2212143829244551080948e1e9b35727"},"payload":{}}' sent to device uuid 2212143829244551080948e1e9b35727. Timeout was: 10.000000 seconds. Mqtt Host: mqtt-us-4.meross.com:443. WARNING:Device Master bedroom (2212143829244551080948e1e9b35727) is online, but timeout occurred when fetching its abilities. INFO:Fetch and update done INFO: ------- Manager Discovery ended -------

dev name: Kitchen pi user: vb

donations-bot-prod[bot] commented 4 hours ago

Donation bot here. Supporters can mark their interest in this issue by adding a comment starting with "+1" (without quotes) or adding the "#supporter_sponsor" keyword (without quotes) in their comments.

You can become a donor by subscribing as Sponsor from the GitHub sponsorship page or from the BuyMeACoffee page.

Issues marked by donors will be labeled accordingly and handled with special care