Velux Solar API from Loxone

1,699 views
Skip to first unread message

sk

unread,
Apr 7, 2021, 12:32:52 PM4/7/21
to Loxone English
Does anyone know if it is possible to control velux solar window controls from Loxone? 

This looks like the bridge (KLF 200).  It looks like there is an API available details here that could be wrapped in Pico but wanted to check if anyone has already done it.  

thanks.

Rob_in

unread,
Apr 8, 2021, 1:39:48 AM4/8/21
to Loxone English
Some good detail on Velux control here:


TLDR; Seems possible, but not for beginners.

Robin

L P

unread,
Apr 8, 2021, 1:45:07 AM4/8/21
to Loxone English
My Velux integration was done with a KLF100 using Loxone relays (no TCP/IP or IO net). The problem with this implementation (not caught by the Loxone installer or the Velux rep) is that it cannot control more than one function of my Velux window - it controls window or blinds or curtains. The device CAN control one function (window or blinds or curtain) on up to 100 Velux devices, which is not very useful for me. Some day I'll fix it, maybe with the KLF 200... 

Ewan Tait

unread,
Apr 8, 2021, 12:31:27 PM4/8/21
to Loxone English
I'm using a Velux KLF 200 to control six solar powered blinds in the kitchen.

I've got FHEM to control the Velux KFL 200, and Loxone talks to FHEM using MQTT. FHEM and MQTT are installed on a Raspberry Pi running Loxberry. There are Loxberry plugins for both for easy install.

The Loxone blind control sends commands via UDP to MQTT, MQTT passes them onto FHEM which then controls the Velux interface. The status can be sent the other way as well, so you could still using the Velux remote controls for the blinds and report the blind hight back to Loxone, but I couldn't see a straight forward way of managing that within Loxone's blind controls, so I've just removed the Velux remote controls from the equation.

Instructions can be found here:
https://www.loxforum.com/forum/hardware-zubehör-sensorik/171217-velux-klf200-endlich-mit-api/page3#post190659
https://wiki.fhem.de/wiki/Velux_KLF200

There is a bit of lag between Loxone and the blinds moving, which varies between blinds. I think this is with the KLF 200. But I've mostly worked round it so that sets of blinds can be controlled together and stop at the same position.

If you're wanting to control the Velux KSX 100K WW solar powered window opener, the FHEM module says that it can do so, but I've not tried. To control it within Loxone, there's no window opener control built in, but I would have thought that a Status module with two switches would work. If I thought that I could get away with buying and fitting it without my wife noticing, I would have done so by now!

For what it's worth, the Loxone recommended way to control the KLF 200 is using relays.

I've not seen a PicoC script that would work.

Regards,
Ewan

sk

unread,
May 4, 2021, 10:11:02 AM5/4/21
to Loxone English
Thanks for this.
We get our windows installed in the next month and will take a look at the API documentation. 

Peter Holden

unread,
Aug 3, 2021, 5:08:52 AM8/3/21
to Loxone English
Having read this thread sometime ago, I thought it might be a good idea to integrate my Kitchen Velux into Loxone. In some respects I wish I hadn't started on this journey because for someone who knows diddly squat about programming this isn't as straightforward as I thought it would be.
I'm not sure that the cost of a RPi and the KLF200 warrants all this head scratching either!!
So far, Loxberry is installed on the RPi, FHEM & MQTT installed and the initial programming on those two plugins complete, except I still need to define the Velux in FHEM though. The links posted by Ewan have been really useful, but inevitably the original authors assume some programming knowledge of Perl as opposed to none at all. 
I've still to configure Loxone at which point I'll find out if all this has been successful or as is more likely, not lol. 
If I can find the time I'll put together an idiot's guide. Watch this space

Jonathan Dixon

unread,
Aug 3, 2021, 5:30:26 AM8/3/21
to Peter Holden, Loxone English
Completely orthogonal and I'm afraid of no help to you, but for anyone reading this and wondering about the idea of installing Velux in future:
We recently put in 3 Fakro roof windows with the Z-Wave motors and I was pleasantly surprised how easy these were to setup. I've paired them to Home Assistant, which supports Fakro devices pretty much out of the box, and then using the PyLoxone custom integration to bridge them to Loxone. I've not used Z-Wave before, and was reluctant about introducing yet another wireless protocol into the home - I much prefer wired control wherever I can. However Z-Wave seems pretty robust (for this limited use case, so far). Only minor quibble is pairing them to the Home Assistant USB stick broke the ability to control them using the manufacturer supplied remote controls. 
I used Home Assistant as that's what I'm familiar with, but there's iobroker support too . node-zwave-js is maturing quite nicely, so I can imaging a Loxberry native plugin for it at some point



Ole Larsen

unread,
Aug 3, 2021, 8:29:41 AM8/3/21
to Loxone English
We've just built a new house, having 3 flat ceiling Velux windows which I would like to control with Loxone as well. However, as with other users of this forum, I'm reluctant to start on another 3rd party journey with programming (which I know nothing about) in Perl etc. 

Therefore, my plan is actually just to use simple relay outputs soldered to the original controls included from Velux. The range is quite far and I can actually keep them in my control room and still operate all windows. This is a simple way to control exactly the same way as with the original control. 
Did anyone do this also?

Cheers
Ole

Peter Holden

unread,
Aug 3, 2021, 11:23:09 AM8/3/21
to Loxone English
Ole

There's another VELUX thread in the Group somewhere, which you should read I think. Apparently it's not quite that straightforward.

Ewan Tait

unread,
Aug 3, 2021, 1:01:48 PM8/3/21
to Loxone English
Peter,

Where have you got? There are a number of interactions, each of which can be looked at in order.

Velux Window <> KLF200
KLF200 <> FHEM
FHEM <> MQTT
MQTT <> Loxone

I'm pretty sure that the KLF200 web interface can control the window.

The FHEM web interface can control the Velux window without having MQTT setup.

Loxone talks to FHEM via MQTT using VIs and VQs.

I can share screenshots of what I've done, including some rather convoluted Loxone config code to get round the delays between the KLF200 and Velux blinds that I'm controlling.

Cheers,
Ewan

Ewan Tait

unread,
Aug 3, 2021, 1:05:18 PM8/3/21
to Loxone English
Ole,

There are a number of home automation systems that interface with the KLF200 unit and with Loxone. I use FHEM/MQTT, but there's an ioBroker solution as well.

The KLF200 unit also has relay inputs and outputs that can be controlled by Loxone, although I think there's a limit of five devices this way. (I have six blinds and I've convinced my wife that we should remotely control one of our windows as well!)

Cheers,
Ewan

On Tuesday, August 3, 2021 at 1:29:41 PM UTC+1 Ole Larsen wrote:

Peter Holden

unread,
Aug 3, 2021, 1:36:20 PM8/3/21
to Loxone English
Hi Ewan

Thank you for the offer. So far then:
Velux window is registered in the KLF200 (it doesn't have blinds - thankfully!)
KLF200 Node is set up in FHEM and I can open and close the window by selecting on or off
But I'm not seeing any FHEM transmissions to the Miniserver in the overview tab of MQTT when doing so. 
If I can get past here I'll be onto the the Loxone programming bit!

Cheers
Peter

Ewan Tait

unread,
Aug 3, 2021, 4:39:25 PM8/3/21
to Loxone English
Peter,

So I followed the instructions on https://www.loxwiki.eu/display/LOXBERRY/MQTT+Gateway+-+Alle+FHEM-Readings+weitergeben to setup the FHEM MQTT functionality.

define lb_mosquitto MQTT localhost:1883 loxberry <MQTT Password>
attr lb_mosquitto room MQTT
define mqttGeneric MQTT_GENERIC_BRIDGE
attr mqttGeneric IODev lb_mosquitto
attr mqttGeneric globalDefaults sub:qos=2 pub:qos=0 retain=1
attr mqttGeneric globalPublish *:topic={"fhem/$device/$reading"}
attr mqttGeneric room MQTT

Screenshot 2021-08-03 at 21.27.52.png

Note that the state in the above screenshot is opened, indicating that they're talking to each other.

attr n_SYS_MQTT_cmnd room MQTT

Screenshot 2021-08-03 at 21.28.06.png

define SYS_MQTT MQTT_DEVICE
attr SYS_MQTT userattr subscribeReading_cmnd
attr SYS_MQTT IODev lb_mosquitto
attr SYS_MQTT alias MQTT-Command
attr SYS_MQTT room MQTT
attr SYS_MQTT subscribeReading_cmnd /fhem/cmnd

Screenshot 2021-08-03 at 21.28.55.png

I've also got the publish and receive commands setup on each blind, but I can't remember if that's required.

Screenshot 2021-08-03 at 21.29.20.png

In the MQTT Gateway, the only subscription required is fhem/#, but you can filter it down such as fhem/Velux_1/pct/state

That assumes that you're publishing as "fhem", whereas the page above suggests publishing as "fhemwohnzimmer".

Cheers,
Ewan

Peter Holden

unread,
Aug 3, 2021, 5:38:32 PM8/3/21
to Loxone English
Hi Ewan

I've compared your setup with my own and with the exception of setting a MQTT Room attribute, which I have now implemented, my files are the same.

I did find this comment:

" Check in your fhem.conf that the definition MQTT comes safely before MQTT_GENERIC_BRIDGE. There was a bug once.!

Mine does not but I don't know how to move it up?

Cheers
Peter

Rob_in

unread,
Aug 4, 2021, 2:37:08 AM8/4/21
to Loxone English
This all sounds waaaaaay overly complicated as Velux motors are just 24v polarity reverse drive. It is all discussed in the link I shared above.

FYI, just last week I installed a Velux SML shutter on an existing roof window. Just the shutter and motor. No control  box. The wireless control that came with the shutter is not required.

When physically in place I connected the motor to a 24v PSU and let it run it's calibration cycle (ie. it closed then opened again). After this is completed, disconnect 24v supply and you're done. For control: 24v drives the shutter in one direction, reverse the polarity to drive in the other direction. This can easily be achieved with 2 x SPDT relays.

HTH,

Robin

David Wallis

unread,
Aug 4, 2021, 3:07:58 AM8/4/21
to Rob_in, Loxone English
I’m not sure it is as simple as the shutters as there is the vent position too.

You’d certainly need to remove the pcb, which people do a drop in replacement for controlling via Loxone or others, Ive previously posted a link.

I’ll find out eventually how hard it is as I’ve finally won our planning battle with the local authorities and can start building work. 

--
You received this message because you are subscribed to the Google Groups "Loxone English" group.
To unsubscribe from this group and stop receiving emails from it, send an email to loxone-englis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/loxone-english/3e498c99-34af-4b0f-bfd4-30ba2d8f8163n%40googlegroups.com.

Peter Holden

unread,
Aug 4, 2021, 8:20:11 AM8/4/21
to Loxone English
Hi Ewan
Have deleted all the MQTT stuff from my FHEM Config file and reinstalled. I am now seeing Velux msgs (when operated) under the MQTT Incoming Overview tab. So, it would appear the code hierarchy within the Config file can cause a problem.  Just the Loxone programming to go now.

Hi Robin
Not disputing your method at all, but isn't that a rather 'dumb' method of operating a window? Using FHEM in conjunction with the Velux KLF200 Api appears to offer all sorts of 'smart' possibilities?

Ewan Tait

unread,
Aug 4, 2021, 1:22:40 PM8/4/21
to Loxone English
Peter,

I think the instructions for the VI and VQ were straight forward. One issue I did find is that the response time for the KLF200 controller talking to the Velux blinds isn't instantaneous, and I'm controlling two banks of three blinds, and each one will start and stop at a slightly different time! (Compared to the Ikea blind that I'm controlling via zigbee, that does start and finish instantaneously, so it's definitely a Velux issue, and even with the controller right under the blinds, it didn't really help.)

To get round this, and to get the position "correct" with all the blinds stopping at the same point, I had to play around with the Loxone config a little. Basically, when I want to move the blind, Loxone sends the Down command and then when I want it to stop, I send the Position command. The movement time in the Loxone config is reduced by around 5s compared to the actual time so that when I stop the blinds, they usually all go down for a second or so and then stop at the same position. If I didn't use the Position command, they would all stop at different locations, and whereas Loxone might think that the blind is 50% down, it might have actually been at 40% or 60%.

Screenshot 2021-08-04 at 17.13.55.png
Screenshot 2021-08-04 at 17.14.56.png
Screenshot 2021-08-04 at 17.15.14.png

One other issue to consider is that the KLF200 controller can sometimes disconnect when running a software update on the Raspberry Pi. There is a Velux state that can be passed from FHEM to Loxone, which you can use to detect when this happens. Use the conversion option in the MQTT Gateway to convert the text string into an integer.

Robin - I didn't put power in to the Velux windows, so I'm using the solar powered blinds and my only option is to control them is wirelessly.

Cheers,
Ewan

Peter Holden

unread,
Aug 6, 2021, 12:02:59 PM8/6/21
to Loxone English
Hi Ewan
Despite my earlier confidence with the Loxone programming aspects, I'm stuck. 
I understand I have to create a Virtual Output, and then a Command(s) associated with that Output to open and close the Velux. 
I'm not sure if the VO should have a user:password and if so what 'user' name to enter? 
Also the text for the commands? 
Thanks

Ewan Tait

unread,
Aug 6, 2021, 12:19:38 PM8/6/21
to Loxone English
Peter,

You need to setup a connection from Loxone to the MQTT gateway as a Virtual Output then specific commands as Virtual Output Commands

Screenshot 2021-08-06 at 17.17.50.png

I've not setup a password on my MQTT Gateway, so the Virtual Output only has an address, /dev/udp/<IP address of MQTT server>/<port of MQTT server>

The virtual output commands can send a command when turned on and when turned off. For my Velux blinds, I just have an On command, such as fhem/Velux_1/pct/set 0 to close them and fhem/Velux_1/pct/set <v> to go to position <v>.

My Zigbee blinds on the other hand have both on and off commands
On: zb/Blind_B3/set {"state": "OPEN"}
Off: zb/Blind_B3/set {"state": "STOP"}

https://www.loxwiki.eu/display/LOXBERRY/MQTT+Gateway has good instructions, albeit you will need to translate them (and when you translate them, be careful when copying and pasting commands from the webpage into Loxone).

Cheers,
Ewan

On Friday, August 6, 2021 at 5:02:59 PM UTC+1 s69...@gmail.com wrote:
Hi Ewan

Peter

unread,
Dec 23, 2022, 8:10:19 AM12/23/22
to Loxone English
For KLF200 users: I stumbled across this Loxone documentation a few days ago


I've connected one Velux using 4 MS relays as documented and can't believe how easy this method is as opposed to using a RPi / Loxberry and MQTT / FHEM.

Rob_in

unread,
Dec 24, 2022, 11:25:13 AM12/24/22
to Loxone English
On Friday, 23 December 2022 at 14:10:19 UTC+1 s69...@gmail.com wrote:
...can't believe how easy this method is as opposed to using a RPi / Loxberry and MQTT / FHEM.


You don't even need the KLF200. All you need are 2 relays.

Robin 
Reply all
Reply to author
Forward
0 new messages