I’ve got the basics working. It’s worth noting that this is still cloud-based - there’s no local control.
read the hierarchy
update and read individual devices (or “featuresets” as called by Lightwave).
Things I haven’t done yet
worked out a good way to reauthenticate. When you first authenticate you need a “refresh key” from the official LW web app (the docs also say the mobile app will provide this). But this is single use; when you authenticate it returns an access key and also a new refresh key to use for the next authentication. I need to find a good way of storing the refresh key and using that if needed on next authentication.
receiving events from LW. Just haven’t got around to trying this out because it uses webhooks and I didn’t have the energy to set up a webhook endpoint.
There’s some working code at
(the LWRFLinkPublic class is the one using the published API, there is an older LWRFLink class that uses the reverse-engineered protocol used in the official app).
I’ve been playing around as well. The authentication docs are very sparse and, yes, seem to imagine you’ll go back to the Lightwave app to get a refresh token if it expires.
However, I’ve captured the traffic from logging into the app itself and it seem like the app is issued the same bearer and refresh token as you get within the app, although the App POSTs to a different auth route:
Example here (with fake data):
Using the access_token returned above with the puplicapi endpoint works.
The Webhook endpoint doesn’t seem to work though. If I POST to create one using the documented format:
I am having issues with webhooks for last few days. It used to work just fine. Now webhooks will register and I can see them when I list all events but nothing gets send. Tested on my own app, then on https://webhook.site/. I have emailed technical. Would be nice if someone could confirm that they are having issues as well. Thanks