Install Gambas
TracNav
Linux
Table of Contents
Supported Modules
- Intro
- RFXCom
- RRDTool
- Barcode
- HDDTemp
- Sound
- VoiceText
- Asterisk
- UPS
- Weeder
- Xanura CTX35
- Bluetooth
- Sony Visca
- 1-Wire
- XMLTV
- Heyu
- IRMan
- X10
- Plugwise
- Sony AIBO
- Fritz!Box
- IPVideo
- CER ELS1700
- Bwired
- DSC Security
- Falcom SMS
- KNX/EIB
- Z-Wave
- Pachube
- WeatherBug
- PLCBUS
Just Started
Requested
Development
More Info
Gambas
Domotica Links
Remote Management Install
If you want remote login, install ssh and nomachine's nx:
$ sudo apt-get install ssh
I use nx for remote X sessions, but you can also use something else like vnc for example ...
$ mkdir ~/install/nx $ cd ~/install/nx x86_i386: $ wget http://64.34.161.181/download/3.3.0/Linux/nxclient_3.3.0-6_i386.deb $ wget http://64.34.161.181/download/3.3.0/Linux/nxnode_3.3.0-12_i386.deb $ wget http://64.34.161.181/download/3.3.0/Linux/FE/nxserver_3.3.0-15_i386.deb $ sudo dpkg -i nxclient_3.3.0-6_i386.deb $ sudo dpkg -i nxnode_3.3.0-12_i386.deb $ sudo dpkg -i nxserver_3.3.0-15_i386.deb x86_64: $ wget http://64.34.161.181/download/3.3.0/Linux/nxclient_3.3.0-6_x86_64.deb $ wget http://64.34.161.181/download/3.3.0/Linux/nxnode_3.3.0-12_x86_64.deb $ wget http://64.34.161.181/download/3.3.0/Linux/FE/nxserver_3.3.0-14_x86_64.deb $ sudo dpkg -i nxclient_3.3.0-6_x86_64.deb $ sudo dpkg -i nxnode_3.3.0-12_x86_64.deb $ sudo dpkg -i nxserver_3.3.0-14_x86_64.deb
You can download clients here.
If you enable Multimedia support while defining a connection you can hear the audio from your server too!
Apache install
If you want to use the web client module, you have to run Apache with the php5 and xmlrpc modules. Please be aware of the security risks you take, the software is not fully tested. You can also use lighttpd see below, not tested the security/user auth part, but xmlrpc ajax runs ok.
Install Apache2, PHP and XMLRPC support:
$ sudo apt-get install apache2 php5 libapache2-mod-php5 php5-xmlrpc
Then you need to tweak the apache config file a bit, to be able to have authentication and customlog settings changed:
NOTE: The example below is from default Ubuntu Hardy installation, your file may look a bit different.
$ sudo vi /etc/apache2/sites-available/default
You see this, change the two lines where the arrows point below.
NameVirtualHost *
<VirtualHost *>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
------> AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
------> CustomLog /var/log/apache2/access.log combined env=!dontlog
ServerSignature On
Next restart Apache to let it read the config file, watch for error messages.
$ sudo /etc/init.d/apache2 restart
lighttpd install
Install base part.
$ sudo aptitude install lighttpd
Install PHP modules.
$ sudo aptitude install php5-cgi php5-mysql php5-xmlrpc
To enable PHP5 in Lighttpd, we must modify /etc/php5/cgi/php.ini and add the line cgi.fix_pathinfo = 1 right at the end of the file:
$ sudo vi /etc/php5/cgi/php.ini cgi.fix_pathinfo = 1
To enable the fastcgi configuration (which is stored in /etc/lighttpd/conf-available/10-fastcgi.conf), run the following command:
$ sudo lighttpd-enable-mod fastcgi
This creates a symlink /etc/lighttpd/conf-enabled/10-fastcgi.conf which points to /etc/lighttpd/conf-available/10-fastcgi.conf
Then reload Lighttpd:
$ sudo /etc/init.d/lighttpd force-reload
Clock synchronisation with ntp
It's important that your domotica server has the right time, you can achieve this by running ntpd on it, this describes how you can get it running.
Install the needed package:
$ sudo apt-get install ntp
Change it's config file to choose nearby ntp servers: $ sudo vi /etc/ntp.conf }}}
Replace line with server ntp.ubuntu.com with the following (if you live in the Netherlands):
server 0.nl.pool.ntp.org server 1.nl.pool.ntp.org server 2.nl.pool.ntp.org server 3.nl.pool.ntp.org
Restart the daemon:
$ sudo /etc/init.d/ntp restart * Stopping NTP server ntpd [ OK ] * Starting NTP server ntpd [ OK ]
Now you can check it with:
ntpq> peers
remote refid st t when poll reach delay offset jitter
==============================================================================
metronoom.dmz.c PPS(0) 2 u 18 64 1 28.042 36694.5 0.001
ntp1.hro.nl 193.67.79.202 2 u 17 64 1 30.153 36694.5 0.001
canopus.no-sens 192.87.106.3 2 u 16 64 1 26.090 36694.6 0.001
ntp1.trans-ix.n 193.79.237.14 2 u 15 64 1 25.615 36696.2 0.001
The offset is the difference between your servers clock and the atomclock time. After a few minutes you will see that the difference is corrected.
ntpq> peers
remote refid st t when poll reach delay offset jitter
==============================================================================
metronoom.dmz.c PPS(0) 2 u 10 64 1 26.920 -0.251 0.001
ntp1.hro.nl 193.67.79.202 2 u 25 64 1 30.268 0.648 0.001
canopus.no-sens 192.87.106.3 2 u 25 64 1 26.651 0.273 0.001
ntp1.trans-ix.n 193.79.237.14 2 u 49 64 1 24.986 2.846 0.001
ntpq> exit
Lock serial device names
USB Serial devices get a random device name after reboot on Linux, they don't stay the same, which makes it very difficult to find out which is which every time. By writing udev rules you can lock names to adapters with a certain serial number embedded. But the adapters using a Prolific PL2303 chip all have the same device id and serial number, so you have a small problem. What I have done, is lock the usb port to a certain serial device (actually to another symlink) Here is how I did it.
Plug in all your interfaces, remove one and plug it back in, look up it's device name.
$ dmesg [ 3041.219431] usb 1-3.2.4: USB disconnect, address 19 [ 3041.222094] pl2303 ttyUSB9: pl2303 converter now disconnected from ttyUSB9 [ 3041.222158] pl2303 1-3.2.4:1.0: device disconnected [ 3045.257373] usb 1-3.2.4: new full speed USB device using ehci_hcd and address 20 [ 3045.355654] usb 1-3.2.4: configuration #1 chosen from 1 choice [ 3045.356225] pl2303 1-3.2.4:1.0: pl2303 converter detected [ 3045.359626] usb 1-3.2.4: pl2303 converter now attached to ttyUSB9
Now find out which device path it has.
$ udevadm info --attribute-walk -p /class/tty/ttyUSB9
looking at device '/devices/pci0000:00/0000:00:04.1/usb1/1-3/1-3.2/1-3.2.4/1-3.2.4:1.0/ttyUSB9/tty/ttyUSB9':
KERNEL=="ttyUSB9"
SUBSYSTEM=="tty"
DRIVER==""
looking at parent device '/devices/pci0000:00/0000:00:04.1/usb1/1-3/1-3.2/1-3.2.4/1-3.2.4:1.0/ttyUSB9':
KERNELS=="ttyUSB9"
SUBSYSTEMS=="usb-serial"
DRIVERS=="pl2303"
ATTRS{port_number}=="0"
looking at parent device '/devices/pci0000:00/0000:00:04.1/usb1/1-3/1-3.2/1-3.2.4/1-3.2.4:1.0':
KERNELS=="1-3.2.4:1.0"
SUBSYSTEMS=="usb"
DRIVERS=="pl2303"
ATTRS{bInterfaceNumber}=="00"
ATTRS{bAlternateSetting}==" 0"
ATTRS{bNumEndpoints}=="03"
ATTRS{bInterfaceClass}=="ff"
ATTRS{bInterfaceSubClass}=="00"
ATTRS{bInterfaceProtocol}=="00"
ATTRS{modalias}=="usb:v067Bp2303d0300dc00dsc00dp00icFFisc00ip00"
ATTRS{supports_autosuspend}=="1"
Look for the first KERNELS string with a path in it, so KERNELS=="1-3.2.4:1.0" in the above example.
Create or edit the custom udev rules file and add a line for this device.
$ sudo vi /etc/udev/rules.d/10-usbadapter.rules
BUS=="usb",SYSFS{serial}=="A4003x7e",KERNEL=="ttyUSB*",SYMLINK+="ttyUSBD1"
BUS=="usb",SYSFS{serial}=="A1001gV5",KERNEL=="ttyUSB*",SYMLINK+="ttyUSBD0"
BUS=="usb",KERNELS=="1-3.1.2:1.0",KERNEL=="ttyUSB*",SYMLINK+="ttyUSBD2"
BUS=="usb",KERNELS=="1-3.1.4:1.0",KERNEL=="ttyUSB*",SYMLINK+="ttyUSBD3"
BUS=="usb",KERNELS=="1-3.1.3:1.0",KERNEL=="ttyUSB*",SYMLINK+="ttyUSBD4"
BUS=="usb",KERNELS=="1-3.2.1:1.0",KERNEL=="ttyUSB*",SYMLINK+="ttyUSBD5"
BUS=="usb",KERNELS=="1-3.4:1.0",KERNEL=="ttyUSB*",SYMLINK+="ttyUSBD6"
BUS=="usb",KERNELS=="1-3.2.2:1.0",KERNEL=="ttyUSB*",SYMLINK+="ttyUSBD7"
BUS=="usb",KERNELS=="1-3.2.3:1.0",KERNEL=="ttyUSB*",SYMLINK+="ttyUSBD8"
BUS=="usb",KERNELS=="1-3.2.4:1.0",KERNEL=="ttyUSB*",SYMLINK+="ttyUSBD9"
Let udev reload it's rules.
$ sudo /etc/init.d/udev restart
Now unplug the adapter and put it back in. Check the creation of the extra symlinked device name.
$ ls -l /dev/ttyUSB* crw-rw---- 1 root dialout 188, 0 2009-09-03 12:20 /dev/ttyUSB0 crw-rw---- 1 root dialout 188, 1 2009-09-02 18:59 /dev/ttyUSB1 crw-rw---- 1 root dialout 188, 2 2009-09-02 19:01 /dev/ttyUSB2 crw-rw---- 1 root dialout 188, 3 2009-09-02 18:59 /dev/ttyUSB3 crw-rw---- 1 root dialout 188, 4 2009-09-03 12:10 /dev/ttyUSB4 crw-rw---- 1 root dialout 188, 5 2009-09-02 19:02 /dev/ttyUSB5 crw-rw---- 1 root dialout 188, 6 2009-09-03 12:20 /dev/ttyUSB6 crw-rw---- 1 root dialout 188, 7 2009-09-03 12:20 /dev/ttyUSB7 crw-rw---- 1 root dialout 188, 8 2009-09-02 18:59 /dev/ttyUSB8 crw-rw---- 1 root dialout 188, 9 2009-09-02 19:49 /dev/ttyUSB9 lrwxrwxrwx 1 root root 7 2009-09-02 18:59 /dev/ttyUSBD0 -> ttyUSB8 lrwxrwxrwx 1 root root 7 2009-09-02 18:59 /dev/ttyUSBD1 -> ttyUSB7 lrwxrwxrwx 1 root root 7 2009-09-02 18:59 /dev/ttyUSBD2 -> ttyUSB1 lrwxrwxrwx 1 root root 7 2009-09-02 18:59 /dev/ttyUSBD3 -> ttyUSB3 lrwxrwxrwx 1 root root 7 2009-09-02 18:59 /dev/ttyUSBD4 -> ttyUSB2 lrwxrwxrwx 1 root root 7 2009-09-02 18:59 /dev/ttyUSBD5 -> ttyUSB4 lrwxrwxrwx 1 root root 7 2009-09-02 18:59 /dev/ttyUSBD6 -> ttyUSB0 lrwxrwxrwx 1 root root 7 2009-09-02 18:59 /dev/ttyUSBD7 -> ttyUSB5 lrwxrwxrwx 1 root root 7 2009-09-02 18:59 /dev/ttyUSBD8 -> ttyUSB6 lrwxrwxrwx 1 root root 7 2009-09-02 19:49 /dev/ttyUSBD9 -> ttyUSB9
Now use the symlinks in your program to address the adapters. So /dev/ttyUSBD1 in case of the example above. The link between the /dev/ttyUSB and /dev/ttyUSBD devices change, but not the link between the physical USD port and the ttyUSBD symlink.
