Hey guys,
I just discovered the great application heimcontrol.js from
http://ni-c.github.io/heimcontrol.js/
If you want to control your existing rc-switches (for example from intertechno etc.) you may follow this quick guide.
0. Install raspbian on your raspberry pi (may work with other distributions too!)
1. open a terminal and copy paste (you can c&p all the commands at once):
sudo apt-get update
sudo apt-get install git-core git scons build-essential scons libpcre++-dev xulrunner-dev libboost-dev libboost-program-options-dev libboost-thread-dev libboost-filesystem-dev
If you are running ubuntu you may receive errors (packages not found). You can remove all "not found" packages from the list and install the rest. Also you can try to install the following programs through the software center (but you may have to add some repos)
2. Install node.js
wget http://nodejs.org/dist/v0.10.18/node-v0.10.18.tar.gz
tar -zxf node-v0.10.18.tar.gz
cd node-v0.10.18
./configure
make
sudo make install
3. mongodb - on ubuntu use the software center and skip step 3 (don't forget to add an startup script!)
(3.0: If you are using a Raspberry PI with 256MB RAM, then you have to edit the file /etc/dphys-swapfile and change the value of CONF_SWAPSIZE from 100 to 200)
3.1: install mongodb
cd ~
git clone git://github.com/RickP/mongopi.git
cd mongopi
scons
sudo scons --prefix=/opt/mongo install
scons -c
3.2. open '/etc/environment' (
sudo nano /etc/environment ) and add:
PATH=$PATH:/opt/mongo/bin/
export PATH
3.3. Add mongodb user, directory and upstart script:
sudo useradd mongodb
sudo mkdir /var/lib/mongodb
sudo chown mongodb:mongodb /var/lib/mongodb
sudo mkdir /etc/mongodb/
sudo sh -c 'echo "dbpath=/var/lib/mongodb" > /etc/mongodb/mongodb.conf'
cd /etc/init.d
sudo wget -O mongodb https://gist.github.com/ni-c/fd4df404bda6e87fb718/raw/36d45897cd943fbd6d071c096eb4b71b37d0fcbb/mongodb.sh
sudo chmod +x mongodb
sudo update-rc.d mongodb defaults
sudo service mongodb start
4. install heimcontrol.js
cd ~
git clone git://github.com/ni-c/heimcontrol.js.git
cd heimcontrol.js
npm install
5.1 install duino:
npm install duino
5.2 DON'T FORGET TO INSTALL THE REQUIRED LIB ON YOUR ARDUINO!!! Compile and upload (with Arduino from the softwarecenter) the code from ~/heimcontrol.js/node_modules/duino/src/du.ino to your arduino and connect it to your new heimcontrol server.
6. MODIFY FILES (or else you will get the error: "events.js:2817: Uncaught Error: Cannot open /dev/")
nano ~/heimcontrol.js/node_modules/duino/lib/board.js
search around line 75 for 'ls /dev | grep ACM' or similar and change it to:
'ls /dev | grep -e usb -e USB -e ACM'
save and exit.
7. start heimcontrol.js:
cd ~/heimcontrol.js
node heimcontrol.js
8. open a browser and go to localhost:8080
set up as you please :-)
FYI: If you are using intertechno codes, you have to change the last 4 bits of the hardcoded transmission code!!! Further informations can be found on
http://www.fhemwiki.de/wiki/Intertechno_Code_Berechnung
nano ~/heimcontrol.js/plugins/arduino/index.js
Edit the codes:
// Send RC code
if (item.value) {
return that.pins[item.pin].triState(item.code + "0FFF");
} else {
return that.pins[item.pin].triState(item.code + "0FF0");
}
Save and exit. Restart heimcontrol.js