Connecting Velux Active KIX 300

Tags: #<Tag:0x00007f5c9f90da78> #<Tag:0x00007f5c9f90d988> #<Tag:0x00007f5c9f90d898>

@nougad: I just got my Velux window rollershutter installed and have a KIX 300 now. You mentioned earlier you want to have something done for openhab using the exec binding. Do you have something done already?

Thanks so far for the effort you spend on this!

Sorry for the month of silence. I was finally able to put everything together and publish a early state on github: https://github.com/nougad/velux-cli

It contains the API documentation and a go client. I documented the openHab integration using exec binding here: https://github.com/nougad/velux-cli/blob/master/openhab.md

I still haven’t published the ClientID and ClientSecret from the Velux App. You still require extracting this yourself. I know, that’s not a awesome experience but I don’t want to publish private keys.

For the same reason I’m not working on a openHab binding at the moment.

Contributions welcome.

Thanks will check it out as soon as I find time. Regarding the keys … the question is how private is private if it is part of every application installed on customers devices :slight_smile:

yes, that’s correct the keys are kind of public by including it into a obfuscated Android app. It’s not on me to define “private” :slight_smile: Feel free to publish the keys but I will not take the risk

@nougad
How you solve the issue with the Gateway pairing at the first login.
How you get the sign_key_id to open a window?

Hey @tombox. I don’t fully understand what you mean with sign_key_id and opening a window. My code works by getting the oAuth2 keys and directly talking with the Velux backend.

Ok this means you never open a Velux window with your code.

@tombox Ah, now I understand. I only own Velux roller shutter which don’t require a sign_key_id. Right now the code does not support windows since I can’t try it. It would require someone with a window to captures the network traffic and either create a pull request to the swagger definition or to provide me the wire dump of the network traffic.

Unfortunately there is only encrypted communication between the gateway and the phone nothing capturable via https

@tombox that’s correct. I described above how you can remove the certificate pinning and route the network traffic through a mitm proxy. It’s a bit tricky to setup but I think the only way to get the necessary data.

This is not the issue because the the is no traffic via https is looks like a direct connection between gateway and phone. The Gateway sends a broadcast and the app on the receive the package and generate a hash. This hash will be send to the gateway with a hashed target position. But the decompiled hash algorithm are hard to reproduce.

@nougad:
Finally found the time to go through your howTo and got everything working. Great Kudos!

Is it ok for you if I cut you a PR with some improvement ideas?

Sure, all contributions are welcome. Right now the velux-cli is just an example for accessing the Velux CLI and it works pretty well for me in combination with OpenHab.

Hello there,
I am very interested in this topic, as I was really unhappy that velux-active is such a closed system without any public api. I currently have 8 windows, 2 blackout blinds and 6 sun screens/awning blinds running. As someone said before, the system works perfectly, but the automation features are poor and I want to log the sensor data in openhab.

I tried @nougad’s manual for retrieving the client_id and client_secret - but I’m stuck. I should add that I have no experience with java or android develepement. Maybe someone could give me a hint? :wink:

Current status:

  • I decompiled the app, changed the xml file (2 occurences), built it again
  • signed it with a developer key (using apk signer)
  • installed the apk on an android device
  • changed the proxy settings, but via android ui, not with adb
  • i get http requests of the browser on the android device in mitmproxy ->should work?
  • the app starts, but fails to connect to netatmo-server at login (brief error message at the bottom of the screen).

UPDATE: right after posting this I found my error (it always works…) – I didn’t install the mitm-certs. It works now!

I will test @nougad’s velux-cli in the next few days.

1 Like

Many thanks @nougad for all your reverse engineering! Out of curiosity: Are the KIX 300 APIs the same as the ones of the KLF 200?

A link to the fully documented KLF 200 APIs can be found in the docs of the Velux binding. On that note: Based on my understanding of the API docs, KLF 200 supports more than 5 devices (up to 200 if I get it right).

I could imagine that Velux is using parts of the KLF 200 code base for the KIX 300 (this would mean that the existing integration could be amended without too much effort). And given that Velux documented the KLF 200 APIs I could further imagine that they would eventually do the same thing for the KIX 300.

I will certainly follow this discussion with high interest! I just installed a Somfy Connexoon to control my two Velux roller shutters (the rest of my apartment is KNX), just to find out that things are controlled through the Somfy cloud (which I don’t really like). Setting the Connexoon up with my OpenHAB Raspberry worked like a charm, but I will eventually replace it with a solution with more privacy.

Hey @peter.janes. As far as I know the KIX300 API has nothing to do with the KLF 200 API. The KLF 200 API is a local wire protocol with the hub while the KIX 300 API ist talking with an Cloud-based endpoint. THE KIX 300 API has some overlap with the netatmo API. Therefore the marketing name VELUX ACTIVE with NETAMO - which I personally find quiet a stretch since the the only overlap between the two products is some common terms in an undocumented API. In addition the KIX 300 supports homekit which I personally haven’t tried.

Thanks for your quick feedback @nougad!

In another forum article (#11) I read that Velux Active can be operated without the Velux cloud (only HomeKit local) - so I would assume there must be locally available APIs, at least for HomeKit.

Did you compare your reverse engineered APIs with the KLF 200 documentation?

Yes, as I mentioned the KIX 300 has HomeKit support which I didn’t tried. Above Connecting Velux Active KIX 300 mentioned HomeKit simulators/bridges which probably work completely local.

The API I use is the cloud-based-Netatmo-like-API which is also used in the Velux APP.

And then again there is the KLF200 which has absolutely nothing to do with the KLX 200 (neither netatmo cloud nor homekit API)

Thanks for the clarifications, @nougad! I will certainly continue to follow this conversation.

Hi guys,

I see that Velux Active now supports Google Home / Assistant since few months ago.

I have configured it with my KIX300 and it works, it is still buggy, but I believe that they will fix this with future versions.

So, here is the question; does this mean that they opened some api? Would it be possible now to use this for OH-KIX300 binding?