Author Topic: X10 CM19A  (Read 44815 times)

Riggs

  • Guru
  • ****
  • Posts: 185
    • View Profile
    • Kotonix LLC
Re: X10 CM19A
« Reply #15 on: July 12, 2010, 05:55:42 pm »
where would i start looking for this code, ie wiki or forum
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 #16 on: July 12, 2010, 06:06:43 pm »
It is in the private method listing for the Insteon PLM driver. Either by looking at the Ruby Codes attached to the device template for the Insteon PLM, or by looking at the Insteon PLM page in the wiki.

-Thom

Riggs

  • Guru
  • ****
  • Posts: 185
    • View Profile
    • Kotonix LLC
Re: X10 CM19A
« Reply #17 on: July 12, 2010, 06:11:22 pm »
are you talking about this: http://wiki.linuxmce.org/index.php/Insteon_PLM_Ruby_Code_373

looking at this code is like an English speaking guy trying to read native Latin, and then trying to talks his way out of not getting killed in Latin  

for instance: Latina lingua non utor (I don't speak Latin) yahoo answers
« Last Edit: July 12, 2010, 06:14:12 pm by Riggs »
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 #18 on: July 12, 2010, 06:32:07 pm »
the code is wrong i know, i want to start basic and see something work and then make it better:

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:
sendToDevice = File.new("/dev/cm19a0", "a")

case cmdId
       when 192 #192 is ON
               sendToDevice.puts "+devPort"
       when 193 #193 is OFF
               sendToDevice.puts "-devPort"
       when 184 #184 is Level of dimmer
               sendToDevice.puts ""
end
Now i don't know what is right and what is wrong in this code I just got it from the wiki because it looked like what i need and all i needed to do was change it a bit.
i do not understand any of it, well I know that sendToDevice = File.new("/dev/cm19a0", "a")  
means from now on File.new("/dev/cm19a0", "a") is gonna be called  sendToDevice,
and File.new is the command RB use to write to a file, /dev/cm19a0 is the file i want to write to and "a" means append to file

so i came up with sendToDevice.puts "+devPort"   as in i want RB to write a + and the devport in said file, but i guessing it is writing +devPort in the file instead of A1

« Last Edit: July 12, 2010, 06:37:08 pm by Riggs »
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 #19 on: July 12, 2010, 06:43:25 pm »
I guess i should scrap that code and write it from scratch, to do so i need some basic info,

does device_.childdevices_[cmdTo].devdata_[12] get me the channel and port number ie, A1
does cmdId_ get me the switch type ie, on off
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 #20 on: July 12, 2010, 06:44:42 pm »
If you look at the database table, DeviceData, it will become clear, look at the primary keys...

-Thom

Riggs

  • Guru
  • ****
  • Posts: 185
    • View Profile
    • Kotonix LLC
Re: X10 CM19A
« Reply #21 on: July 12, 2010, 08:01:12 pm »
ok is the template messed up as well as my code or just my code, see log below:

Complete log
Device CM19A, # 60    
Device Template CM19A, device category Specialized, manufacturer Pluto.   
   
157 lines, displaying from 0 to 157   
1   

== ATTEMPT FRESH START ==
1   07/11/10 19:21:46   /usr/pluto/bin/Spawn_Device.sh 60 (spawning-device)   23901 Dev: 60; Already Running list: 15,16,18,19,31,32,46,44,21,27,25,26,30,36,23,22,34,
== FRESH START ==
1   07/11/10 19:21:46   /usr/pluto/bin/Spawn_Device.sh 60 (spawning-device)   device: 60 ip: localhost cmd_line: Generic_Serial_Device
0   07/11/10 19:21:46   60 (spawning-device)   Entering 60
========== NEW LOG SECTION ==========
1   07/11/10 19:21:46   60 (spawning-device)   Starting... 1
1   07/11/10 19:21:46   60 (spawning-device)   Found /usr/pluto/bin/Generic_Serial_Device
05   07/11/10 19:21:46.904      Connection for client socket reported NEED RELOAD IP=127.0.0.1, device 60 last error 2 <0xb70938d0>
05   07/11/10 19:21:46.904      The router must be reloaded before this device is fully functional <0xb70938d0>
05   07/11/10 19:21:46.905      void ClientSocket::Disconnect() on this socket: 0xa0201e8 (m_Socket: 5) <0xb70938d0>
05   07/11/10 19:21:46.909      Connection for client socket reported NEED RELOAD IP=127.0.0.1, device 60 last error 2 <0xb70938d0>
05   07/11/10 19:21:46.910      Running without DeviceData, will try to add device <0xb588fb90>
01   07/11/10 19:21:46.952      GSD Port is not specified. Instantiating non-IO Wrapper. <0xb588fb90>
RCODE:
   0:require 'Ruby_Generic_Serial_Device'
   1:class Command < Ruby_Generic_Serial_Device::RubyCommandWrapper
   2:end
   3:class Device_60 < Ruby_Generic_Serial_Device::RubySerialWrapper
   4:#### START SETTERS ####################################################################
   5:def initialize()
   6:super
   7:@returnParamArray=Array.new
   8:end
   9:####  END  SETTERS ####################################################################
  10:end
 12:05   07/11/10 20:03:56.947      Got a reload command from 0  <0xb588fb90>
05   07/11/10 20:03:57.275      void ClientSocket::Disconnect() on this socket: 0xa0205a8 (m_Socket: 8) <0xb70938d0>
Return code: 2
2   07/11/10 20:03:57   60 (spawning-device)   Device requests restart... count=1/50 dev=60
Sun Jul 11 20:03:57 CDT 2010 Restart
========== NEW LOG SECTION ==========
1   07/11/10 20:04:05   60 (spawning-device)   Starting... 1
1   07/11/10 20:04:05   60 (spawning-device)   Found /usr/pluto/bin/Generic_Serial_Device
05   07/11/10 20:04:06.488      Connect() failed, Error Code 111 (Connection refused)) <0xb6ff68d0>
05   07/11/10 20:04:07.496      Connect() failed, Error Code 111 (Connection refused)) <0xb6ff68d0>
01   07/11/10 20:04:10.781      GSD Port is not specified. Instantiating non-IO Wrapper. <0xb57f2b90>
RCODE:
   0:require 'Ruby_Generic_Serial_Device'
   1:class Command < Ruby_Generic_Serial_Device::RubyCommandWrapper
   2:end
   3:class Device_60 < Ruby_Generic_Serial_Device::RubySerialWrapper
   4:def cmd_ReceiveCommandForChild(cmd)
   5:cmdId            = cmd.id_                                                                       # Command ID: ON, OFF, SET LEVEL
   6:cmdTo           = cmd.devidto_                                                             # Device ID in LinuxMCE
   7:devPort         = device_.childdevices_[cmdTo].devdata_[12]      # 12 contains a port/channel
   8:childType      = device_.childdevices_[cmdTo].devtemplid_       # Template ID to know type of device: switch or dimmer
   9:
  10:case cmdId
  11:      when 192 #192 is ON                     
  12:           command = 'echo +devPort > /dev/cm19a0'           
  13:      when 193 #193 is OFF                       
  14:           command = 'echo -devPort > /dev/cm19a0'
  15:      when 184 #184 is Level of dimmer
  16:           command = ''                   
  17:end
  18:
  19:conn_.Send(command)
  20:
  21:end
  22:#### START SETTERS ####################################################################
  23:def initialize()
  24:super
  25:@returnParamArray=Array.new
  26:end
  27:####  END  SETTERS ####################################################################
  28:end
 30:05   07/11/10 21:19:06.388      Process Queue = 1 <0xb57f2b90>
01   07/11/10 21:19:06.401      For obscure reasons could not handle the message <0xb4ff1b90>
05   07/11/10 21:19:26.388      Socket::ReceiveData 0x967e5a8 failed, bytes left 0 start: 89160000 1: 0 1b: 0 2: 0 2b: 0 m_Socket: 8 Command_Impl1 Dev #60 <0xb57f2b90>
05   07/11/10 21:19:26.389      Socket::ReceiveString2 ReceiveData failed m_Socket: -1 Command_Impl1 Dev #60 <0xb57f2b90>
01   07/11/10 21:19:26.389      Receive string failed in HandleRequestSocket 18:ReceiveData failed Command_Impl1 Dev #60 <0xb57f2b90>
05   07/11/10 21:19:26.389      Dumping 1 locks <0xb57f2b90>
05   07/11/10 21:19:26.389      finished check for exceptions <0xb57f2b90>
05   07/11/10 21:19:26.389      OL: (0x967e6f4) (>93) MessageQueue Command_Impl.cpp l:822 time: 6:00:00p (1278901166 s) thread: 3053403024 Rel: Y Got: Y <0xb57f2b90>
Return code: 2
2   07/11/10 21:19:26   60 (spawning-device)   Device requests restart... count=1/50 dev=60
Sun Jul 11 21:19:26 CDT 2010 Restart
========== NEW LOG SECTION ==========
1   07/11/10 21:19:34   60 (spawning-device)   Starting... 1
1   07/11/10 21:19:34   60 (spawning-device)   Found /usr/pluto/bin/Generic_Serial_Device
01   07/11/10 21:19:34.697      GSD Port is not specified. Instantiating non-IO Wrapper. <0xb57fbb90>
RCODE:
   0:require 'Ruby_Generic_Serial_Device'
   1:class Command < Ruby_Generic_Serial_Device::RubyCommandWrapper
   2:end
   3:class Device_60 < Ruby_Generic_Serial_Device::RubySerialWrapper
   4:def cmd_ReceiveCommandForChild(cmd)
   5:cmdId         = cmd.id_                                    # Command ID: ON, OFF, SET LEVEL
   6:cmdTo         = cmd.devidto_                               # Device ID in LinuxMCE
   7:devPort       = device_.childdevices_[cmdTo].devdata_[12]  # 12 contains a port/channel
   8:childType     = device_.childdevices_[cmdTo].devtemplid_   # Template ID to know type of device: switch or dimmer
   9:sendToDevice  = File.new("/dev/cm19a0", "a")
  10:case cmdId
  11:      when 192 #192 is ON                     
  12:           sendToDevice.puts "echo +devPort"           
  13:      when 193 #193 is OFF                       
  14:           sendToDevice.puts "echo -devPort"
  15:      when 184 #184 is Level of dimmer
  16:           sendToDevice.puts ""                 
  17:end
  18:end
  19:#### START SETTERS ####################################################################
  20:def initialize()
  21:super
  22:@returnParamArray=Array.new
  23:end
  24:####  END  SETTERS ####################################################################
  25:end
 27:05   07/12/10 7:38:55.767      Going to rotate logs... <0xb57fbb90>
05   07/12/10 12:44:40.338      Socket::ReceiveData 0x98245a8 failed, bytes left 0 start: 724540000 1: 0 1b: 0 2: 0 2b: 0 m_Socket: 8 Command_Impl1 Dev #60 <0xb57fbb90>
05   07/12/10 12:44:40.338      Socket::ReceiveString2 ReceiveData failed m_Socket: -1 Command_Impl1 Dev #60 <0xb57fbb90>
01   07/12/10 12:44:40.338      Receive string failed in HandleRequestSocket 18:ReceiveData failed Command_Impl1 Dev #60 <0xb57fbb90>
05   07/12/10 12:44:40.338      Dumping 1 locks <0xb57fbb90>
05   07/12/10 12:44:40.338      finished check for exceptions <0xb57fbb90>
05   07/12/10 12:44:40.338      OL: (0x98246f4) (>75) MessageQueue Command_Impl.cpp l:822 time: 6:00:00p (1278956680 s) thread: 3053439888 Rel: Y Got: Y <0xb57fbb90>
== ATTEMPT FRESH START ==
1   07/12/10 12:47:38   /usr/pluto/bin/Spawn_Device.sh 60 (spawning-device)   16919 Dev: 60; Already Running list: 15,16,18,19,31,32,46,
== FRESH START ==
1   07/12/10 12:47:38   /usr/pluto/bin/Spawn_Device.sh 60 (spawning-device)   device: 60 ip: localhost cmd_line: Generic_Serial_Device
0   07/12/10 12:47:38   60 (spawning-device)   Entering 60
========== NEW LOG SECTION ==========
1   07/12/10 12:47:38   60 (spawning-device)   Starting... 1
1   07/12/10 12:47:38   60 (spawning-device)   Found /usr/pluto/bin/Generic_Serial_Device
05   07/12/10 12:47:38.271      Creating child 61 <0xb6ff48d0>
05   07/12/10 12:47:38.272      Note: Device manager has attached a device of type 38 that this has no custom event handler for.  It will not fire events. <0xb6ff48d0>
05   07/12/10 12:47:38.272      Note: Device manager has attached a device of type 38 that this has no custom handler for.  This is normal for IR. <0xb6ff48d0>
05   07/12/10 12:47:38.272      Creating child 62 <0xb6ff48d0>
05   07/12/10 12:47:38.272      Note: Device manager has attached a device of type 37 that this has no custom event handler for.  It will not fire events. <0xb6ff48d0>
05   07/12/10 12:47:38.272      Note: Device manager has attached a device of type 37 that this has no custom handler for.  This is normal for IR. <0xb6ff48d0>
01   07/12/10 12:47:38.305      GSD Port is not specified. Instantiating non-IO Wrapper. <0xb57f0b90>
RCODE:
   0:require 'Ruby_Generic_Serial_Device'
   1:class Command < Ruby_Generic_Serial_Device::RubyCommandWrapper
   2:end
   3:class Device_60 < Ruby_Generic_Serial_Device::RubySerialWrapper
   4:def cmd_ReceiveCommandForChild(cmd)
   5:def cmd_ReceiveCommandForChild(cmd)
   6:devPort      = device_.childdevices_[cmdTo].devdata_[12] #port/channel
   7:sendToDevice = File.new("/dev/cm19a0", "a")
   8:  if cmd.id == 192                 
   9:     sendToDevice.puts "devPort"
  10:     sendToDevice.puts "+"
  11:end
  12:end
  13:#### START SETTERS ####################################################################
  14:def initialize()
  15:super
  16:@returnParamArray=Array.new
  17:end
  18:####  END  SETTERS ####################################################################
  19:end
 21:01   07/12/10 12:47:38.360      Failed loading code: Error loading code:
error: (eval):9: compile error
(eval):9: unterminated string meets end of file
(eval):9: syntax error, unexpected tSTRING_END, expecting tSTRING_CONTENT or tREGEXP_END or tSTRING_DBEG or tSTRING_DVAR, line: 9
. <0xb4fefb90>
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 #22 on: July 12, 2010, 09:01:15 pm »
if i run  in the echo +A1 > /dev/cm19a0 terminal i get -bash: /dev/cm19a0: Invalid argument
and if i look in dnesg i see  [ 190.812686] x10-cm19a: devf_open: Couldn't submit interrupt input URB: -22

Now if i reboot the core and do echo +A1 > /dev/cm19a0 in the terminal before the core is fully up it works 
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 #23 on: July 12, 2010, 09:38:43 pm »
I have deleted my ruby code then clicked update so i could just start from scratch but there is now a load of code in there and i dint put it there
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 #24 on: July 12, 2010, 10:01:40 pm »
I think i might as well give up and just type terminal commands to use x10.
I'm not a programmer and it seems i never will be, i cant get anything working not even a simple peace of code that writes to a file when it receives the on command, F*&^ knows how i will get the x10 IR blaster working.
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.

rperre

  • Guru
  • ****
  • Posts: 264
    • View Profile
Re: X10 CM19A
« Reply #25 on: August 03, 2010, 04:51:56 am »
Riggs, have you tried using the cm15a code in lmce, looks like it's a similar device.

I have a bunch of x10 stuff and think this cm15A or cm19A would be nice to have and hopefully more reliable then the cm11a i have now.

Richard

Riggs

  • Guru
  • ****
  • Posts: 185
    • View Profile
    • Kotonix LLC
Re: X10 CM19A
« Reply #26 on: August 03, 2010, 06:20:40 pm »
No never tried it, I now have a CM15A that i thought would work with LMCE but it never did, and i'm no dev so i dont think there is any chance of me using my X10 stuff on LMCE it seem as Linux world will only support what the main people have at the time, so I'm just using Active Home Pro with smart macros and VB Script with some .bat files to get what i want.

The guys here are doing a great job i just don't have the Linux skills to support my stuff.
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 #27 on: August 03, 2010, 06:22:04 pm »
Do yourself a favour and go z-wave. a lot easier to set up, as much of it is automatic.

-Thom

rperre

  • Guru
  • ****
  • Posts: 264
    • View Profile
Re: X10 CM19A
« Reply #28 on: August 03, 2010, 06:50:16 pm »
Yes Z-wave is better, it's also 4 times more expensive (at least). X10 supported devices could get more people to run lmce because of the ease and cheap way to get modules, etc... more people that run it gives more people that are able to create devices or even help develop. I know i'm not the best in programming, i'm trying though to understand the system and hopefully make it better in some way.

The same with the USB UIRT vs Vista MCE IR receivers, but that's another thread.

I've had my eyes on the CM19A, it's only $10 shipped and RF which will help in reliability!!!

Richard

Marie.O

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 3675
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: X10 CM19A
« Reply #29 on: August 03, 2010, 06:58:28 pm »
But at the moment there is no support for the CM19A.

rperre, please invest some time and write a device template for it, so other people can save some money and use the CM19A