Author Topic: X10 CM19A  (Read 44793 times)

Riggs

  • Guru
  • ****
  • Posts: 185
    • View Profile
    • Kotonix LLC
X10 CM19A
« on: July 11, 2010, 06:58:12 am »
Ok so i got a CM19a and want it to work in LMCE

so first i did a search and fount a driver:
download it here: http://m.lemays.org/projects/x10-cm19a-linux-driver

Install the driver: http://pr0gr4mm3r.com/linux/getting-your-x10-cm19a-module-working-in-linux/

1 Go to your terminal, and cd into that extracted directory.
2 As per the instructions in the software’s readme file, run the following commands:

    sudo make
    sudo make install
    sudo modprobe x10-cm19a

sudo gedit /etc/modprobe.d/blacklist
    Then add to the end of the file:

    # causes the custom cm19a driver to fail
    blacklist lirc_atiusb
    blacklist ati_remote

Type in a terminal:

    sudo rmmod lirc_atiusb
    sudo rmmod ait_remote

sudo gedit /etc/udev/rules.d/40-permissions.rules
     Add the following to the end of the file:

    KERNEL==”cm19a0″, MODE=”0666″

reboot

then type sudo chmod 0666 /dev/cm19a0

You’re done, yay! Now it’s time to test it out. Remember, this driver only provides an interface to the module. You will have to write your own software / scripts / cron jobs to make it useful.The interface works by sending strings to it. To turn on A1, we send +A1 to it. To turn off C4, we send -C5 to it. In practice, type in the following command to turn on A1:

    echo +A1 > /dev/cm19a0

I found all this info so i'm no expert if you need help you will need to ask at the above forum.

Now i have a working drive I have now got to get LMCE to work with it any help would be greate

Thanks to Thom on the IRC for giving so pointers



Dell XPS Gen5 P4 3.2Ghz 64 x2, 3Gbs Ram, GeForce 8600GT 1Gb VRam, Creative Audigy 2 ZS, LinuxMCE 10.04 32bit,, 2 Eth Cards, Comcast business 25Mbs/5Mbs. Zwave, X10, Vera 3.

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: X10 CM19A
« Reply #1 on: July 11, 2010, 06:14:58 pm »
These steps will have to be placed into a post install script for the driver package you will need to create, so people will not have to do this by hand.

-Thom

Riggs

  • Guru
  • ****
  • Posts: 185
    • View Profile
    • Kotonix LLC
Re: X10 CM19A
« Reply #2 on: July 12, 2010, 01:58:21 am »
so far i have created a template
Device Template #2148
Description CM19A
Implements DCE
Command line: Generic_Serial_Device
Device Category*: Interfaces #71
Manufacturer*: Pluto #1
This device is controlled via category: Device Category: Computers
Packages: Pluto Generic Serial Device
Comm Method: USB
Comments: Active Home Pro CM19A

Device data:
#162  Only One Per PC(bool)     only one per pc    1

Commands:
Ruby Internal Commands

Plug & Play:
Vendor Model ID 0bc70002    PNP protocol HAL USB
Comments CM19A USB device.

No code has been written yet as i don't know how yet
Dell XPS Gen5 P4 3.2Ghz 64 x2, 3Gbs Ram, GeForce 8600GT 1Gb VRam, Creative Audigy 2 ZS, LinuxMCE 10.04 32bit,, 2 Eth Cards, Comcast business 25Mbs/5Mbs. Zwave, X10, Vera 3.

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: X10 CM19A
« Reply #3 on: July 12, 2010, 02:07:46 am »
Have you verified that the device is found when you plug it in?

-Thom

Riggs

  • Guru
  • ****
  • Posts: 185
    • View Profile
    • Kotonix LLC
Re: X10 CM19A
« Reply #4 on: July 12, 2010, 02:08:56 am »
how would i do that
Dell XPS Gen5 P4 3.2Ghz 64 x2, 3Gbs Ram, GeForce 8600GT 1Gb VRam, Creative Audigy 2 ZS, LinuxMCE 10.04 32bit,, 2 Eth Cards, Comcast business 25Mbs/5Mbs. Zwave, X10, Vera 3.

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: X10 CM19A
« Reply #5 on: July 12, 2010, 02:10:27 am »
*hmm*

make sure the device isn't in your device tree.

Plug it in.

Does an orbiter mention that it has found the device?

-Thom

Riggs

  • Guru
  • ****
  • Posts: 185
    • View Profile
    • Kotonix LLC
Re: X10 CM19A
« Reply #6 on: July 12, 2010, 02:12:17 am »
LOL sorry just looked at the weborbiter it has fount it and ask me if i want to use it
Dell XPS Gen5 P4 3.2Ghz 64 x2, 3Gbs Ram, GeForce 8600GT 1Gb VRam, Creative Audigy 2 ZS, LinuxMCE 10.04 32bit,, 2 Eth Cards, Comcast business 25Mbs/5Mbs. Zwave, X10, Vera 3.

Riggs

  • Guru
  • ****
  • Posts: 185
    • View Profile
    • Kotonix LLC
Re: X10 CM19A
« Reply #7 on: July 12, 2010, 02:14:10 am »
im reading up on ruby stuff on the wiki and im not getting any where so my brain is a bit slow to think about the obvious, orbiter 
Dell XPS Gen5 P4 3.2Ghz 64 x2, 3Gbs Ram, GeForce 8600GT 1Gb VRam, Creative Audigy 2 ZS, LinuxMCE 10.04 32bit,, 2 Eth Cards, Comcast business 25Mbs/5Mbs. Zwave, X10, Vera 3.

Riggs

  • Guru
  • ****
  • Posts: 185
    • View Profile
    • Kotonix LLC
Re: X10 CM19A
« Reply #8 on: July 12, 2010, 02:41:44 am »
To control the transceiver, format the commands as

[-+][a-p][01][1-9]

For example:
echo +A1 > /dev/cm19a0
 - to turn on device a1: +a1
 - to turn off device a1: -a1
 - etc.

[udlr][a-p]

Ninja Pan'n'Tilt commands:
 u = up
 d = down
 l = left
 r = right

[bs][a-p][01][0-9]
Lamp module commands:
 b = brighten
 s = soften
Dell XPS Gen5 P4 3.2Ghz 64 x2, 3Gbs Ram, GeForce 8600GT 1Gb VRam, Creative Audigy 2 ZS, LinuxMCE 10.04 32bit,, 2 Eth Cards, Comcast business 25Mbs/5Mbs. Zwave, X10, Vera 3.

Riggs

  • Guru
  • ****
  • Posts: 185
    • View Profile
    • Kotonix LLC
Re: X10 CM19A
« Reply #9 on: July 12, 2010, 02:59:42 am »
So reading the wiki i fount some code I figure i could use this and a just it:
no i need to send echo +A > /dev/cm19a0 for on so do i replace A with devPort

cmdId       = cmd.id_                                                      # Command ID: ON, OFF, SET LEVEL
cmdTo       = cmd.devidto_                                              # Device ID in LinuxMCE
devPort     = device_.childdevices_[cmdTo].devdata_[12]      # 12 contains a port/channel
childType   = device_.childdevices_[cmdTo].devtemplid_       # Template ID to know type of device: switch or dimmer

case cmdId
      when 192 #192 is ON                    
           command = 'echo +devPort > /dev/cm19a0'          
      when 193 #193 is OFF                        
           command = 'echo -devPort > /dev/cm19a0'
      when 184 #184 is Level of dimmer
           command = '<your SET LEVEL command format>'                  
end

conn_.Send(command)
Dell XPS Gen5 P4 3.2Ghz 64 x2, 3Gbs Ram, GeForce 8600GT 1Gb VRam, Creative Audigy 2 ZS, LinuxMCE 10.04 32bit,, 2 Eth Cards, Comcast business 25Mbs/5Mbs. Zwave, X10, Vera 3.

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: X10 CM19A
« Reply #10 on: July 12, 2010, 03:06:40 am »
Not quite.

If you read, by default GSD assumes that you are opening a connection to a serial port, or to a TCP port. Conn_.send contents go to the port specified in your interface's devicedata.

Since your device falls outside this constraint (it is a device file being exposed by a kernel device driver.), you need to use Ruby's IO commands to read and write to it, instead of using the Conn object.

However, the basic code structure of using the case statements to determine which command to send is correct
What I would do, is define a new method inside the Private Method Listing. Call it something useful like def sendToDevice, and use this method instead of Conn_.send to send the needed strings.

Since this device doesn't really expose any events, you can choose to do the opening and closing of the file handle inside your new method, to make things transactionally atomic, either that, or if you want to leave it open, open the device in Process Initialize, and set a class variable for it, so that your sendToDevice method can use it. It's up to you.

-Thom

Riggs

  • Guru
  • ****
  • Posts: 185
    • View Profile
    • Kotonix LLC
Re: X10 CM19A
« Reply #11 on: July 12, 2010, 04:44:10 am »
So to start simple i did this
created a file named "test.rb" and in it i put
#!/usr/bin/ruby
sendToDevice = File.new("/dev/cm19a0", "a")
sendToDevice.puts "+A5"

then i did chmod +x
then ./test.rb
and it switched on a light

so no i know how to write to the device file

I'm sorry Thom but i'm not a programmer so i need to start simple and work up

Dell XPS Gen5 P4 3.2Ghz 64 x2, 3Gbs Ram, GeForce 8600GT 1Gb VRam, Creative Audigy 2 ZS, LinuxMCE 10.04 32bit,, 2 Eth Cards, Comcast business 25Mbs/5Mbs. Zwave, X10, Vera 3.

Marie.O

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 3675
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: X10 CM19A
« Reply #12 on: July 12, 2010, 08:26:41 am »
Riggs,

hang in there, you are progressing nicely!

Riggs

  • Guru
  • ****
  • Posts: 185
    • View Profile
    • Kotonix LLC
Re: X10 CM19A
« Reply #13 on: July 12, 2010, 05:44:12 pm »
how do i get it to log, so i can see what my code is doing, i know it don't work but don't know why
Dell XPS Gen5 P4 3.2Ghz 64 x2, 3Gbs Ram, GeForce 8600GT 1Gb VRam, Creative Audigy 2 ZS, LinuxMCE 10.04 32bit,, 2 Eth Cards, Comcast business 25Mbs/5Mbs. Zwave, X10, Vera 3.

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: X10 CM19A
« Reply #14 on: July 12, 2010, 05:46:39 pm »
GSD does not provide a logging function, for the running code itself.

However, you can use the log method that ddamron wrote for his PLM device, just cut and paste it into your private method listing. You can then call it to output a log line to xx_Generic_Serial_Device.log.

But GSD does provide rudimentary logging for the interpreter in the abovementioned log file.

-Thom