Domotic with Asterisk / Elastix.

Status
Not open for further replies.

danardf

Joined
Dec 3, 2007
Messages
8,069
Reaction score
12
Hi all.

I made a small code to switch on/off some lamps from Elastix / Asterisk.

I use ab USB stick to manage several devices. It's a radio frequency transmitter that plugs into your computer.

usb.jpg


I use also some X10 modules like TM13, LM12, and AM12.
tm13.jpg
lm12.jpg
am12.jpg

The X10 protocol is based on CPL.

At first, download the driver and software HERE.

Followed the instructions.

Be careful to file permissions /dev/ttyUSB0!!

Use this agi script and past it into /var/lib/asterisk/agi-bin/domotic.php
Code:
#!/usr/bin/php -q
<?php
$cmd="/usr/local/bin/tdtool --list | grep ".$argv[1];
$status_device = exec($cmd);
echo "NoOP $status_device\n";
if (preg_match("/\bOFF\b/i",$status_device)){
       $cmd="/usr/local/bin/tdtool -n d".$argv[1];
       echo "SET VARIABLE DEVICE_STATE(Custom:$argv[1]) INUSE\n";
    }
    else
    {
       $cmd="/usr/local/bin/tdtool -f d".$argv[1];
       echo "SET VARIABLE DEVICE_STATE(Custom:$argv[1]) NOT_INUSE\n";
    }
exec($cmd);
exit;
?>

Do that :
# chmod 755 /var/lib/asterisk/agi-bin/domotic.php
# chmod 666 /var/state/telldus-core.conf

Declare every devices with a d in front like this:
Code:
# tdtool --list
Number of devices: 4
1       d211    OFF
2       d212    OFF
3       d213    OFF
4       d214    OFF

Use /etc/tellstick.conf

Code:
deviceNode = "/dev/ttyUSB0"
device {
  id = 1
  name = "d211"
  protocol = "sartano"
  model = "extel"
  parameters {
        code = "0000001000"
  }
}

device {
  id = 2
  name = "d212"
  protocol = "sartano"
  model = "extel"
  parameters {
        code = "0000010000"
  }
}

device {
  id = 3
  name = "d213"
  protocol = "x10"
  model = "codeswitch"
  controller = 1
  parameters {
    house = "A"
    unit = "1"
  }
}
...Etc.

Insert this part into extensions_custom.conf.
Code:
[Domotic]
exten => 2.,1,Answer()
exten => 2.,n,NoOp(Domotic)
exten => 2.,n,Set(Device=${CALLERID(DNID)})
exten => 2.,n,AGI(domotic.php,${Device})
exten => 2.,n,Hangup()

Domotic.png


Create a custom destination with this: Domotic,2.,1

Next, create some misc applications with its device code (211, 212, 213, ...etc.) with the destination Domotic.

Next, create some blf:
Code:
exten => 211,hint,Custom:211
exten => 212,hint,Custom:212
exten => 213,hint,Custom:213
exten => 214,hint,Custom:214

When you would dial 212, the device d212 will switched on, and dial again to switched off.

Enjoy. :)

Regards
 
Hello,

im interested in your job, i think is wonderful.

X10 is an domotic automation protocol via the electric network in 120 Mhz isn't? you simply transmit with that usb device?

The link you put is broken.

Thanks in advance
 
Hello,

im interested in your job, i think is wonderful.

Hi.
X10 is an domotic automation protocol via the electric network in 120 Mhz isn't?

No, it's based on 120Khz signal

But with this USB device, you could use some others protocols for any devices using a RF signal.

you simply transmit with that usb device.

Yes.

The link you put is broken.
Hmmm sorry, but i don't masters the tellstick website. :cheer:
Visit Tellstick website, or try to find the telldus-core file source (you must to compile it)
Like this: http://download.telldus.se/TellStick/So ... ldus-core/

However, it exist lots of USB stick to make what you want on other or same protocol.
From my side, the tellstick device is based on European RF. (433,92Mhz).

Next, i asked at Elastix team to develope a kind of program to do this kind of stuff.
So, maybe one day.... ;)

Regards.
 
Of course.

This device is based on X10 protocol and you can install heyu software to manage this CM11.
And why not install domuslink too. (working with heyu software).
 
you told:


I use also some X10 modules like TM13, LM12, and AM12.

I don't understand how did you use that x10 modules if you have no way to communicate with them
 
I used a CM11.
But today, i uses a tellstick to sending request to TM13, because at home i've three-phase.
And my devices are not in the same phase that my server.
So, i uses a tellsitck device, but i could use a CM11 too.
 
Status
Not open for further replies.

Members Online Now

Forum statistics

Threads
111,832
Messages
589,278
Members
164,662
Latest member
DejanMDS