Go Client for Velux Active KIX 300
Go to file
Florian Eitel 6ccddd868d
Mention changes to config.go for client id and client secret
2019-09-15 23:15:37 +02:00
.gitignore Add swagger and Makefile for generating client and install deps 2019-09-15 22:44:40 +02:00
LICENSE Initial commit 2019-09-15 21:03:03 +02:00
Makefile Describe install steps with `go get` 2019-09-15 23:01:06 +02:00
README.md Mention changes to config.go for client id and client secret 2019-09-15 23:15:37 +02:00
config.go Make Debug configurable 2019-09-15 22:44:45 +02:00
dumpjson.go Migate to go-swagger 2019-09-15 22:44:16 +02:00
fetchdata.go Sort imports 2019-09-15 22:44:46 +02:00
main.go Migate to go-swagger 2019-09-15 22:44:16 +02:00
move.go Allow rollershutter to close to state `0` 2019-09-15 22:44:44 +02:00
openhab.md Add documentation and velux protocol 2019-09-15 22:46:35 +02:00
print.go Migate to go-swagger 2019-09-15 22:44:16 +02:00
swagger.yaml Allow rollershutter to close to state `0` 2019-09-15 22:44:44 +02:00
token.go Print refresh token logs only on Debug 2019-09-15 22:44:47 +02:00
velux-protocol.md Add documentation and velux protocol 2019-09-15 22:46:35 +02:00

README.md

velux-cli

Go Client for Velux Active KIX 300

Install

go get github.com/nougad/velux-cli
# will fail with: package github.com/nougad/velux-cli/client: cannot find package "github.com/nougad/velux-cli/client" in any of:
# go then into `src/github.com/nougad/velux-cli` to generate the swagger client
$ cd src/github.com/nougad/velux-cli
# make changes to the `config.go` file and add velux client id and client secret
# and run make
$ make

Auth

Login to Velux using username and password

CLIENT_ID=".."
CLIENT_SECRET=".."
USERNAME="email"
PASSWORD=""
curl -v -d "grant_type=password&client_id=${CLIENT_ID}&client_secret=${CLIENT_SECRET}&username=${USERNAME}&password=${PASSWORD}&user_prefix=velux" https://app.velux-active.com/oauth2/token

Then create a file named token.json

{
 "token": {
  "access_token": "5...d|5...0",
  "refresh_token": "5...d|c...4",
  "scope": [
   "all_scopes"
  ],
  "expires_in": 10800
 },
 "refreshed": "2019-08-11T21:42:51.597296912+02:00"
}

Velux protocol

Documented in velux-protocol.md.

OpenHab integration using exec plugin

Can be found in openhab.md file.

The current OpenHab netatmo binding might be able to use the reading from GetMeasure but it does not allow to override the API endpoint so I could not try.

There is currently no OpenHab binding since it would require disclosing client secret and client id reverse engineered by Android App. More details at https://community.openhab.org/t/connecting-velux-active-kix-300/75696

Swagger definition

Can be found in swagger.yaml. Only relevant methods added.

Due to missing union types in of OpenAPI 2.0 and missing code generators in OpenHab 3.0 the setState only takes percentage right now.

Open issues

  • stopall is missing
  • Only rollershutters supported right now