johnlemonse / homebridge-telldus

36 stars 22 forks source link

Support local API #53

Closed mifi closed 6 years ago

mifi commented 6 years ago

We need to make or find an abstraction of both live and local. Currently we are using telldus-live npm module which is unmaintained and has old js code style.

I did not find an npm module that supports local and live at the same time. I found however these potential alternatives: https://github.com/ashpool/telldus-live-promise https://github.com/JakobPetersson/telldus-local

Or we could write a new which abstracts away the authentication.

mifi commented 6 years ago

If we support local, users would be required to do a manual step of requesting a token before setting up their homebridge-telldus. We would have to instruct the user to:

Find his IP_OF_TELLDUS_DEVICE

Run: curl -i -d app="homebridge-telldus" -X PUT http://IP_OF_TELLDUS_DEVICE/api/token

Response:

{
  "authUrl": "http://IP_OF_TELLDUS_DEVICE/api/authorize?token=0996b21ee3f74d2b99568d8207a8add9",
  "token": "0996b21ee3f74d2b99568d8207a8add9"
}

Go to returned authUrl in their browser

Tick One year and Auto renew access

screen shot 2017-10-08 at 23 02 13

Put token from JSON response in homebridge-telldus config file.

Or we could create a simple electron app for assisting with this initial process, as well as configuring unknown devices.

See also: http://api.telldus.net/localapi/api/authentication.html

mifi commented 6 years ago

I have now implemented local support. See readme