Thank you so much, @guessed!
It has been quite a bit of work and I need to do quite a bit more but at least there’s a functional prototype thanks to your help
I believe the refreshTokens method is not needed as the token stays alive if it’s used within 15 minutes of being given out. Since I’m checking door status every 90 seconds (probably should be user configurable), I figure I can just check the return status and if I get a 33, I can reauthenticate.
I need to try and implement the task method so I can write messages if I can’t connect to the myQ service or if I get something unexpected back (Like from the paragraph above)
I should also probably be using getStatus instead of inspectDevices in the refreshDoors function [function method, I keep mixing them up]
I’m also thinking it should be called “MyQ Gateway”
I’m thinking it might be 80% of the way there!
[quote=“guessed, post:22, topic:180826”]Ok, finally had some time to try it out.
I ran into a problem with it’s [Lua] Library depends, since JSON isn’t one of the standard libs. It took me a while to work that out, so before I dove into it I made a few changes:
a) Reformatted entire code & XML to a single style/convention
b) Refactored a little to put the “base” URL into everything
c) Tweaked the error handling for when Username/Password details weren’t present
d) Used url_encode across the board “just in case”
e) Created a Localized copy of the dkjson.lua library, with a unique name, so the app can be free-standing
f) Added a bunch of [pseudo] constants for various things.
I was able to validate that it created a Lock child device, and that I can open/close my garage door with this mod.
Congrats, this is a great milestone for your efforts!
There are a bunch more things that need to be done to it, but the core is working reasonably at this time.