Giter Club home page Giter Club logo

velux-cli's Introduction

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

velux-cli's People

Contributors

nougad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

velux-cli's Issues

REST interface ?

Hi!

First of all, I appreciate all the work you did!

Are you planning to add a rest interface (flask or something) to it?
I.e. the project: Dorota980 (to control an iRobot Roomba) has been given a same sort of Rest interface, in that case a new project had been made for it called REST980.
It would be best to do it in the same project, instead of having forks, etc..

~Roel

setstate: syntax seems to have changed

Hi,

the API works fine, but the syntax for setstate might have changed. The return for setstate is {"error":{"code":10,"message":"Missing home_id"}}. Even if you change the syntax to pass home_id instead of id, other errors come up,
Any updates on the syntax available?

Some Question

Hey nougad/Florian,

first of all thanks very much for this cli tool, it was a great help for me to integrate it as a homebridge plugin (which I'm currently still refining => https://github.com/Droccal/homebridge-velux-active, it is not yet available for homebridge users to install)

I have some questions to the api, would be cool if you could help me out.

Do you know that the "Retrieve Key" does? as when I use it it just answers with "status": "ok".

I'm trying to integrate to open a window with the api, but for that there are some security features implemented. I tried to decompile the android app to understand how it is done but unfortunately I didn't find any clue how.

I intercepted the request from the iOS app to open my window and got the following request data:

{ "home": {
"id": "$homeid",
"modules": [
{
"bridge": "$bridgeId",
"sign_key_id": "$signKey",
"target_position": 18,
"hash_target_position": "$hashedPosition",
"id": "$deviceId",
"timestamp": 1666247623,
"nonce": 0
}
]
},
"app_version": "1.10.0"
}

They use a signing key and hash the target position. I thought maybe with the retrieve key I could also create that hash to control my window.

Best Regards
Thomas

CLIENT_ID & CLIENT_SECRET

This looks perfect for my requirements, so thank you.

I’m probably being stupid, but whilst I know my Velux Active username and password (assuming these are the same used for authentication here), where do the CLIENT_ID and CLIENT_SECRET come from?

Sorry, I’ve realised I need a developer account to get them!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.