I'm a new user of Domoticz but it's a great project and nice to see how many different systems it can integrate with, well done to all those involved in creating it.
After the best part of 3 days trying to use a cheap £2 433MHz transmitter and receiver with Domoticz I must say it has been more difficult than I'd expected but I've finally figured it and and it's working like a charm so I thought I would write a little guide to help anyone else who may be having difficulty with it as I haven't seen any other guides anywhere detailing the whole process. This may not be the best or easiest way to do it but it worked for me so may help others too. If this is the wrong part of the forum to post it in I apologise, please could a mod move it to somewhere more appropriate?
Hardware
So, I started out by getting a cheap 433MHz transmitter and receiver from ebay, there are hundreds of sellers and brands of the same device, they are incredibly cheap so well worth giving it a try instead of buying an expensive £83 RFXCom device as I've seen suggested multiple times in various forums. This is the one I purchased for £1.68 including free UK postage: http://cgi.ebay.co.uk/221786845451
As I'm fairly inexperienced with all things GPIO this was new territory for me. After about half an hour of hunting I found a decent picture and guide for which pins to hook the transmitter/receiver up to on the NinjaBlocks website. Follow the guide on that website and you can't go far wrong, although it's worth checking the voltage of your transmitter and receiver before hooking up the VCC leads to the Pi, I'm sure many of you on here know the various Pi pinouts, I'm using a Model B Rev2 Pi and I used the 5V headers (pins 1 and 3) for VCC and pin 6 and 14 for the grounds, Pin 11 for the data line of the transmitter, and pin 13 for the data line of the receiver (the receiver has 4 pins, the middle two are both data and it doesn't matter which one you use).
That's it for the hardware side of things, sit down and have a cup of coffee for a few minutes (if your brain is hurting as much as mine was by this point).
Software
At this stage you will need to install WiringPi, this guide was perfect and describes the process if you're not familiar with it.
So, still following the NinjaBlocks site I mentioned above, you'll get to Phase 2 which details downloading the programs for testing the hardware via SSH. I downloaded the utils mentioned there and ran the RFSniffer program and made a note of the RF codes for all buttons on my remote control, in my case this was for a 'Watts Clever ES-UK1203' remote socket. The original remote can support up to 6 sockets, sadly for me I've only got one to play with at the moment but I made a note of all the codes for future use. It's also worth noting that these sockets can learn new codes, so if you want more than 6 sockets you can just hold the button on the front of it until the light flashes, send a new code and it will learn that, you could also get two sockets to learn the same code to have them both turn on/off together.
So far, you should have downloaded the utils and made a note of all your remote codes. Now go back to your SSH connection and browse to the folder named RPi_utils from the guide above. You'll now need to change ownership of the codesend program so that Domoticz can execute it. The command I used for this was "sudo chown -v pi codesend" (without quotes).
Still remaining in your SSH session, and following the Domoticz Wiki guide on GPIO, you need to export the pins you are using to allow Domoticz access to them. start by typing "sudo nano /etc/init.d/domoticz.sh" (without quotes) into your SSH window, go to the bottom of the file and add the following below the colon:
Code: Select all
/usr/local/bin/gpio export 17 out
/usr/local/bin/gpio export 18 in
Once you're up and running again, move over to the web interface of Domoticz to continue. Go to Setup > Hardware and add a new device. Give it a nice name, I chose "433MHz", for the type select "Raspberry's GPIO Port and leave the data timeout to Disabled. You're done with this part.
Then go to the Switches page and click Manual Light/Switch. Here you'll want to use the hardware you just added in the top box, give it a descriptive name in the second box, set the switch type to On/Off and the Type to GPIO. In the GPIO box, select "gpio17 (GPIO. 0) on pin 11 (OUTPUT)" if it says NOT EXPORTED instead of OUTPUT at the end of this line, go back to the paragraph about about exporting the GPIO pins and make sure you reboot afterwards (which is required). Don't worry about the Test button, it won't help us here. You've now added your 'Device'.
Then go back to your switches page and click Edit under the one you have just added. The fields we are interested in here are 'On Action' and 'Off Action'. For these, we will tell it to run the codesend script from the NinjaBlocks tutorial we did earlier so you need to type in the path to that script, followed by one of your remote codes that we noted earlier. For me, the 'On Action' line reads "script://home/pi/433/433Utils-master/RPi_utils/codesend 2505742" where 2505742 is the code to switch on my socket, the path to your script will likely vary, you should know where you downloaded it to so you may need to change the path and your remote code accordingly. My 'Off Action' line reads "script://home/pi/433/433Utils-master/RPi_utils/codesend 2505734" where the code 2505734 is the code to turn my socket off. Click Save, and you're done here! If you find that it is not working, make sure you run the 'chown' command as described earlier, that's one problem I ran into when it wouldn't work for me.
Complete!
You should now have a fully functioning remote control plug socket controlled by Domoticz. As I'm very new to it, and don't have the greatest linux skills myself there may be errors in the above guide but I've tried as best as possible to describe it clearly and correctly, I'll try and update it later on with some pictures and screenshots for clarity when I get more time. This guide was somewhat rushed as I wanted to detail it before I forgot what I did As I've only got the one remote socket at the moment, I don't know if the settings I have put in will allow to have more than one socket controlled by the same transmitter/hardware but hopefully it can. If anyone knows of any improvements or if I've made any errors in this guide please feel free to mention it and I'll update the guide accordingly.