arraylabs / pymyq

Python wrapper for MyQ API
MIT License
112 stars 42 forks source link

Retrieve all device states through 1 request #16

Closed ehendrix23 closed 5 years ago

ehendrix23 commented 5 years ago

Retrieving device states (open, close) from MyQ are now done through 1 request and stored internally. Through each device an update can still be requested however retrieval from the MyQ cloud is restricted to once every 5 seconds.

Requests to the MyQ cloud will also be sent synchronously ensuring only 1 request can be sent at a time.

These changes are to minimize requests to MyQ as there definitely seems to be a throttler on their end for how many requests can come in per account or so.

Note, just put this together today. Working here but would be good if we can get some more people involved to test these updates.

ehendrix23 commented 5 years ago

@arraylabs , been running with this updated version now for about almost a month, with the last change since 1/17. Have had no issues and my refresh time right now is set to 5 seconds. Sometimes there is a timeout, very rarely it happens to be that I get the warning it is taking longer then 10 seconds to update.

I believe this PR is ready to be merged so that we can then update HA to the newer version of pymyq.

towerhand commented 5 years ago

I haven’t been able to test this PR, but I do get a lot of timeouts and update failures without it. I hope this will fix it.

arraylabs commented 5 years ago

@ehendrix23 thanks for the work, this will make alot of people rest a little easier and calm down their logs!

arraylabs commented 5 years ago

@ehendrix23 it has been uploaded to pypi.

ehendrix23 commented 5 years ago

@arraylabs, Thanks. I'll open a PR now to update version requirement for MyQ in HA.