In Europe, most of the roof windows are produced by Velux, to the point that in current language Velux has become a common noun like frigidaire was a while back. Well, now Velux produces motorized windows. The obvious questions is what do we need to add to be able to control such a window from a computer?
Controlling this Velux roof window from a computer, how tempting...
The first idea that came to mind was to hack the remote control by placing relays in parallel with the buttons. Unfortunately, this is not possible: the remote control is based on a contextual button principle. This implies that the buttons of the remote control are not directly linked to the window functions.
Let's not even think of hacking the remote control: too complex
However, Velux commercializes the KLF 100 interface, specifically dedicated to this kind of job. In brief, it's a remote control with three contacts in input. It's possible to program it to perform some actions when the inputs are put in contact with one another.
The KLF 100 interface, however is designed for this...
... you only need to put these pins in contact to control the Velux
Therefore, a simple Yocto-Relay is all we need: If we connect it to the KLF 100 in such a way to be able to put in contact the up and C pins (close) or down and C pins (open). We are now able to control the window by USB, which is a good start.
Wiring is very trivial
There is even lots of space under the enclosure to install our Yocto-Relay
However, controlling windows from inside our home is not as exciting as the possibility to do so from anywhere in the world. Therefore, the idea is to create a little application which drives the KLF 100 and for this application to be itself controlled by email.
The advantage of this method is that it is not necessary to open a port on your DSL router. The disadvantage is poor reactivity. Several minutes can elapse between when a command is sent and when it is executed, but when the opening of windows is concerned, a time lag of a couple of minutes shouldn't be a big concern.
Home control goes through the intermediary of the servers of the email host
We are therefore going to create an email address for our home. And we are going to send our open/close orders directly to this address. The control application will need to retrieve these emails, run the corresponding orders, and send a confirmation. To have more leeway, we are going to code this application as a Windows service: in this way, not need to start the control application by hand, it is enough for the control computer to be switched on.
Coding itself is performed in C#. As usual, the part managing the Yocto-Relay is only a few lines long.
public bool ExecuteCommand(string command, ref string errmsg)
case "OPEN": fctname = "openWindow"; break;
case "CLOSE": fctname = "closeWindow"; break;
default: errmsg = "unknown command: " + command;return false;
YRelay r = YRelay.FindRelay(fctname);
errmsg = "Command "+command+"failed, Relay "+fctname+" is offline";
The application is expecting to find a Yocto-Relay with a first YoctoRelay function called "openWindow" and a second called "closeWindow". Once per minute, it connects itself by Imap on the mail box created for this purpose, downloads all new emails, and runs the order found in the latest email, then sends a confirmation email to the sender.
The remainder of the implementation is of no great interest for this article. You can nevertheless find the complete project, with sources here. You can even see it in action.
Note that this email based technique is not simply limited to opening a window: possibilities are huge. Nothing prevents you from turning you heater up remotely in the same way; add solenoid valve and you can control your plant watering; with a Yocto-Temperature you could even ask your home for the temperature. All of this from anywhere in the world.
It might be a good idea to think about implementing some kind of password system in your control emails if you don't want for anybody to be able to play with your home...