The myq-api lib I was using is still not updated to the new API, and as
a result doesn't work. This lib is recent and seems to be powering an
active project.
I'm sure this isn't exactly how it needs to be done long-term, but this
gets things functional for me right now and I can iterate on it as I go.
Async/await made github workflows upset for some reason even though it worked for me locally, so just switch back to .then() handling instead. I'm a little miffed that this never failed for me locally, but don't have enough experience with eslint/javascript to understand why.
Added catch() handlers to all promise chains since myq-api throws exceptions when stuff goes wrong.
Added LOGIN_REQUIRED handling because I've seen at least one instance where a computer was running MagicMirror, was put to sleep, then woken up a while later. Each update after that fired exceptions about the login session having expired.
The myq-api library just calls into getDevices() again and filters the response down to just the device and attribute requested, so we can skip this and handle it ourselves without the extra hit to the API and the delay that request incurs. All necessary state information is included on the device object.
The only minor bummer is that we were previously able to skip a full DOM update when the state hadn't changed, but realistically that pattern was dicey anyway since if there is more than one device being monitored, we'd potentially need to push an update for other device(s) anyway.
This changes the appearance such that the button is a little closer to the desired end result. The device's name and current state are printed on the button which is large enough to be easily pressed on a touch screen.
This also updates from the single-device expectation to support multiple devices being present at once.
This needs a bunch of error handling added to it (what if the button press doesn't go through for some reason? etc.) but proves the concept in the ideal case. Now the page will continue to refresh every 5 seconds after a button press until the door is moved to the state it's expected to be in.
This also resets the node_helper 5-minute auto-update timer every time an update is queued so that frontend updates/door toggles don't overlap with backend update intervals.
This makes the button respond to the current state of the garage door and issue a Close if it's open or an Open if it's closed. After issuing the command, it polls every 5 seconds until the door has reached either closed or open, then presents the button again.
Super rough implementation of receiving door state, binding the 'close' action to a button, and having it send the command. Lots more to do here, but the guts are in and functional.
Framework for a MagicMirror module to talk to MyQ about
registered devices. This just makes sure we can use the api library to
get information. Actually hooking it up to the display is forthcoming.