Jump to content


Photo

[How-To] Control an Elk M1 via External Perl Scripting


  • Please log in to reply
70 replies to this topic

#61 Threadhead

Threadhead

    Cocooner

  • Registered
  • PipPip
  • 63 posts
  • Location:Arizona

Posted 21 July 2009 - 03:53 PM

For those of you wanting a way to access your ElkM1 via the Serial port here's another option. <snip>

I don't need this for the ElkM1 perl script, but I sure can use this on another project. A big THANKS for the info.

#62 Threadhead

Threadhead

    Cocooner

  • Registered
  • PipPip
  • 63 posts
  • Location:Arizona

Posted 21 July 2009 - 07:52 PM

Ok, my arm was twisted, so I did it. A new github repository was created for HomeGraph, the "rails app to display graphs and stats that are accumulated by the elkm1--control perl script".

Word of Caution :)
If you don't have a bit of Rails experience, ruby experience, and MySQL experience, there is a good change you will not get this to work for you. It is not intended for the novice or casual user. You will lose considerable hair trying to get it to run for you.

That said, I'm more than willing to help any hacks out there who want to give it a try.

If I didn't frighten you, you can clone the project from github.

#63 signal15

signal15

    Cocoonut

  • Registered
  • PipPipPipPip
  • 1282 posts

Posted 21 July 2009 - 10:03 PM

Thanks! Now I just have to get around to setting up the perl script to log to a database. I've been too busy running wire and installing sensors and cross-connects. 1500 feet of wire in the last week.

#64 TulsaDigital

TulsaDigital

    Newbie

  • New Member
  • Pip
  • 2 posts

Posted 22 July 2009 - 08:18 AM

For those of you wanting a way to access your ElkM1 via the Serial port here's another option. <snip>

I don't need this for the ElkM1 perl script, but I sure can use this on another project. A big THANKS for the info.


No prob. Just some detail on those commands. The first pipes the serial port via UDP packets to a raw socket on the linux computer. The second connects that raw socket to a TCP port.

That's the key to getting the simultaneous connections to work. Also the b115200 sets the baud rate and there are options for several other baud rates, bits, and parity that you may need to adjust.

If you were making just a single connection you could use a command like

socat /dev/ttyS0,raw,b115200 tcl-l:9750

And that'd get you connected to TCP port 9750.

Good luck with your other project! I think next I'm thinking about porting ElkM1::Control to PHP. Mostly just because I'm so much more comfortable with PHP and I want to create a web interface for the ElkM1.

OH! Using these same commands one could probably connect to an Insteon PLM. That might be handy for many of you folks here. I haven't tried it yet but I plan to get that figured out too. Then if I could find a small linux capable device with duel serial ports and 2 NIC ports I could replace the functionality of a ISY-99i and the ELK M!XEP.

#65 Elmars

Elmars

    Newbie

  • New Member
  • Pip
  • 1 posts

Posted 16 April 2010 - 01:46 PM

Hi floks-

Been playing with the script for a few days, but I seem to be missing where I configure the Access Code. I have two devices configured with the RP Access Code and am not able to get any data out of them with the std test script...

Any ideas?

Thanks

Elmars

#66 darryl

darryl

    Cocooner

  • Registered
  • PipPip
  • 72 posts

Posted 19 April 2010 - 07:58 PM

Hi floks-

Been playing with the script for a few days, but I seem to be missing where I configure the Access Code. I have two devices configured with the RP Access Code and am not able to get any data out of them with the std test script...

Any ideas?

Thanks

Elmars



I don't know anything about a rp access code but the script requires your alarm disarm code aka PIN.

#67 Dewy

Dewy

    Cocooner

  • Registered
  • PipPip
  • 11 posts

Posted 03 December 2010 - 03:15 AM

With this module is there anyway to see which user disarmed the alarm, looking though the documentation it looks like you might be able to pull up event details? Has anyone ever tried this?

#68 cheekymonkey

cheekymonkey

    Cocooner

  • Registered
  • PipPip
  • 28 posts
  • Location:Australia

Posted 28 June 2011 - 03:45 AM

I recently tried to use the PLC functionality in this module and discovered some problems. Below is what I had to do to fix them

The lines and modules I changed on my installation were

/usr/local/share/perl/5.10.1/ElkM1/Control/Message/PLCStatusReply.pm
line 68
<       'PLCStatusReply: bank='.$self->getBank.', status='.join ',', map { $self->getStatus($i)} (0..63);
to
>       'PLCStatusReply: bank='.$self->getBank.', status='.join ',', map { $self->getStatus($_)} (0..63);

/usr/local/share/perl/5.10.1/ElkM1/Control.pm
lines 906-910 (note the first }, is removed and a } appears at the end )
<         },
<         'index' => {
<             allow => sub { ( $_[0] >= 1 and $_[0] <= 256 ) },
<             var         => \$index,
<             description => 'an device index from 1..256'
to
>             'index' => {
>               allow => sub { ( $_[0] >= 1 and $_[0] <= 256 ) },
>               var         => \$index,
>               description => 'an device index from 1..256'
>            }

line 1020
<     $self->sendCommand( sprintf( 'pf%c%02d', $house, $unit ) );
to
>     $self->sendCommand( sprintf( 'pt%s%02d', $house, $unit ) );
line 1390
<     $self->sendCommand( sprintf( 'ua%05d', $code ) );
to
>     $self->sendCommand( sprintf( 'ua%06d', $code ) );

line 1569
<           . ". Adding to queue.\n";
to
>           . ". Adding to queue.\n" if ( $self->{debug}) ;


#69 markmuri

markmuri

    Newbie

  • New Member
  • Pip
  • 2 posts

Posted 20 July 2012 - 04:27 PM

Hey. I'm trying to access the github and make some minor typo fixes to the 'man' page contents.

I'm really confused by 'git' - I think I'm doing everything per the documentation.

Is this thread still alive and/or of interest? I'd like to tinker with some files and make them available for inclusion in the mainline.

Thanks.

#70 Dan (electron)

Dan (electron)

    CocoonTech Admin

  • Admin
  • PipPipPipPip
  • 10853 posts
  • Twitter:@CocoonTech
  • Location:Central NY
  • Experience:guru
  • Software:EventGhost, HomeSeer
  • Hardware:Elk M1, Mi Casa Verde Vera, Ocelot
  • Tech:X10-RF, UPB, Z-Wave, ZigBee
  • Audio:AirPlay
  • Video:SageTV
  • CCTV:analog, ip, dvr
  • Phone:OBi100/110

Posted 24 July 2012 - 04:38 PM

Not much has changed with the M1, so this is still a very useful script. That said, between the many migrations, some of the 'subscriptions' might have gotten lost, so the author of this thread might not have gotten notified that you posted. You might want to send him a PM directly if you don't get a response soon.

#71 ghurty

ghurty

    Dedicated Cocooner

  • Registered
  • PipPipPip
  • 120 posts

Posted 30 April 2014 - 11:01 PM

I was able to disam using this script but arming does nothing. Did something change?






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users