Get your Conrad RSL system working with Domoticz

This is a how-to as to get a conrad rsl domotics system work with Domoticz. I have the Domoticz system running but I can't control my Conrad RSL set with it. So I thought if I could control this set in another way with a Raspberry PI, i am close to getting it controlled with Domoticz.
Here's what I did:
First I build an rd sniffer with the help of an arduino mini pro, a breadboard and a very cheap set of rf433 transmitter and receiver from ebay. The transmitter to pin 7 and the receiver to pin 2. look here for a picture. I imported the library rcSwitch in my arduino IDE and installed a programm from the examples in this library on the mini pro. Now I tried to sniff the code from my conrad remote control. It took quit some time before I noticed that I had to press the button quickly 3 times. Once this was clear I sniffed a code that had a decimal value and some other properties like protocol 2 and pulselenght 683. Now I can investigate if and how I can send this code.

When I used the sketch senddemo from the examples in RCswitch library, I noticed that I could configure the pulselength and the protocol. I did this accordingly to the sniffed values. Now I programmed my arduino as a sender with the slightly adopted senddemo sketch (examles in the library). look here for the code.
. This worked, the corresponding lights went on an off.

So I seemed to be possible with the arduino so why not with a Raspberry.
So I installed wiringPI and 422Utils on my raspberry. I also connected the former mentioned RFtransmitter (ebay) (pin4 vcc, pin6 gnd, pin 11 data) to the raspberry. look here After hours of experimenting I found a the solution
. First I tried to send the sniffed code with codesend 123456789, this worked, I could see this in my sniffer, but no reaction of the conrad receivers. On the sniffer I saw a decimal and digital value that matched with the remote control but the raw sata was different. The raw data is a sequence of pulses with a certain length, so here seemed to be the problem.

Next what I did was make a copy of the codesend.cpp file and called it conrad.cpp. In this file I added a call to mySwitch.setProtocol(2) and mySwitchset.PulseLength(680) right after the mySwitch.enableTransmit(PIN). look here for the code.
I saved this file and opened the makefile. I copied the line for the codesendline and changed it to conrad and conrad.o. The receipeline must begin with a tab!!!! otherwise you get a missing separator error. I saved this file too.
Now I typed make conrad and this worked without any errors. Next i tried ./conrad 123456789 and...YES!!!!!!!!!!!!
Next thing was running this executable via the network, this did not work, I saw a message in the apache error log: "wiringPiSetup must be root". I solved this with "chmod +s conrad". The last thing I did was build a script which i can control from a website. Would be nice if I just have to call "script?nr+gr+on"and the script translates that into the right code to send. The code for the script you can see here To make this complete, the html for the webpage with the controls you'l find here

Even better: In Domoticz i made a dummy hardware and created a switch that referred to this hardware. Then i altered the properties of the switch with a link to the script that controls the switch e.g. script ///usr/lib/cgi-bin/conrad 123456789 32. Now I can control the switch with domoticz.... This can also be done for other brands like KaKU (CoCo) so maybe we don't need that expensive RFXcom transceiver at all...