Connecting Velux Active KIX 300

I have extracted the client_id and client_secret from the VELUX active APK using JADX. Those two information are returned by some methods, located all in the same class file.

# client_id: 5931426da127d981e76bdd3f
# client_secret: 6ae2d89d15e767ae5c56b456b452d319
# mgtkey: f3748d873c62f30ef6f7b61b7e725ac6

How to get your oauth2 token?

$ curl --location --request POST '' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=password' \
--data-urlencode 'client_id=5931426da127d981e76bdd3f' \
--data-urlencode 'client_secret=6ae2d89d15e767ae5c56b456b452d319' \
--data-urlencode '' \
--data-urlencode 'password=mypassw' \
--data-urlencode 'app_version=1108002' \
--data-urlencode 'user_prefix=velux'

Hi Hubert,

Thanks for extracting and sharing that. Now working for me. :slight_smile: To get token:

curl -d “grant_type=password&client_id=5931426da127d981e76bdd3f&client_secret=6ae2d89d15e767ae5c56b456b452d319&”

As documented here:

Did anyone succeed in setting state for Departure Switch (NXD)?


curl -s -H “Content-Type: application/json; charset=utf-8” -H “Authorization: Bearer mytoken” -X POST -d “${JSON}” “

with $JSON set to:

“home”: {
“id”: “myhomeid”,
“modules”: [
“id”: “xx:xx:xx:xx:xx:xx”,
“locked”: true

But get this response:

{“error”:{“code”:21,“message”:“cannot set property locked for module xx:xx:xx:xx:xx:xx”}}

Best regards,
Jacob Laursen

@nougad - I may have somehow missed it, but how do you create a request for locking or unlocking your home?


Hi. Thank you very much for all info present in this thread.

I was able to install and run as openhabian the Homekit python version suggested by Bernhard and to define Things/Items as suggested by Rafael.

When I run the command as openhab I get below error:

/usr/bin/python3: Error while finding module specification for ‘homekit.get_characteristic’ (ModuleNotFoundError: No module named ‘homekit’)

The same command executed by openhabian work smoothly.

Python modules owner and group looks fine.

I have tried to move Homekit python site-packages in PATH to /usr/lib/bin but without success.

I have googled the error but without success (I’m not a python programmer nor a linux/raspberry expert).

Could you please give me some suggestions?

Release = Raspbian GNU/Linux 10 (buster)
Kernel = Linux 5.10.11-v7+
Platform = Raspberry Pi 3 Model B Plus Rev 1.3

Thank you in advance for your help.

Hi again. I’m going to answer myself :slight_smile:

To install homekit for openhab user the command is: sudo -u openhab pip3 install --user homekit[IP]

Probably also this command should work but I have not tested it: pip3 install --system homekit[IP]

To be honest I’m not able to understand if this can create problems on the raspberry installation or if it is ok.



I have created a small instruction to patch the APK file and get all required info to interact with windows and unlock your home.
The app is only required once to get the all the keys.

I was able to generate and exchange all other keys via web API except for the HashSignKey which seems to be generated when the app connects directly to the gateway. I could log that exchange with wireshark (~9 requests and responses between app + local gateway) but data seems to be encoded/encrypted.

But having all the keys allows to create own APIs (eg Node-RED).

Maybe this is useful to some people, like everything here was for me.

1 Like

Hi there, I have an OpenHAB setup with a KLF200 to control my windows and rollershutters. It works fine apart from the KLF 200 being a pain to work with (login via its own WI-FI only!). However, whenever I need to restart the OpenHAB service the KLF200 refuses any incoming connection and I have to keep unplugging it completely several times for long periods of time until it hopefully starts working agains. This seems totally random and sometimes takes days.
As this is not acceptable I was hoping the KLX300 could be a solution. Will there be a binding for OpenHAB eventually? I am also happy to tinker with copy-pasting code to make it work. Thanks!

Newer KLF200 devices work reliable only over LAN access. The internal WiFi access point should be disabled automatically 10 minutes after power connection. This has been added to the latest Pull Request documentation.
My setup is running fine for 2 month now.

I have 7 velux integra windows that i need connected to my openhab, but i dunno what solution to use klf200 or kix300.

and i rather not have netamo/velux active controls/sensors honing around the house.
My solution only to have one control in each room for windows/heating/etc…

I’m using a KIX300 (only gateway, no sensors) to manage three windows in different rooms, including curtains and shutters. It has been integrated in OH3 using the approach described in this thread. For my needs, it works well and in fact, I have completely forgotten the velux app :-).
In case, try to further elaborate on your requirements and use cases in order to get more detailed suggestions.

Hi Manuel, which approach did you succeed with - the homekit_python one?

Yes, correct, the homeKit version (actually there were at least two solutions in the thread, sorry… :slight_smile: ). Specifically this post and the related ones (such as this one).

Hi, is there any update on the KIX 300 syntax, as stated by Jacob? I am able to get the access tokens and the homesdata, but it looks like that the setstate syntax for the json data parameter has been changed. I played around with some options but with no luck. Can any control the shutters using the “syncapi/v1/setstate” url?