Jump to content


Photo

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


  • Please log in to reply
69 replies to this topic

#46 JamesR

JamesR

    Newbie

  • New Member
  • Pip
  • 2 posts

Posted 13 March 2009 - 07:20 AM

Honored to see my work used! Hopefully the design proves robust. :-)

Well, you'll be glad to know I have it ticking along in a daemon, logging every event into mysql, with nary a sneeze or sniffle.


Very cool indeed.

#47 Brad Andersen

Brad Andersen

    Newbie

  • New Member
  • Pip
  • 2 posts

Posted 13 April 2009 - 12:05 AM

Hello,

I would like to setup a Central Station to receive alarms from my Elk M1G. Have you looked into the protocol at all yet? Would you happen to know where I can find out more? Page 16 and 17 of the RS-232 Protocol guide indicates the protocol, but I am missing something. Section 4.4.2 states "This acknowledgement is sent to the M1 only if the central station's server acknowledges the Ethernet Module's data packet." How does the Central Server acknowledge those packets, with an "ar" command? I would like to expand upon the work you have already done with ELKM1::Control since the Elk appears to be a little limited. For example, I would like to run this on a home computer and do the following:

*Trigger Alarm
*Elk connects to Central Server (my server with daemon)
*Server receives alarm
*Server queries last message/log
*Server queries additional items
*Server closes communications
*Have a host of if/then/else abilities
-Like the ability to send an email/SMS with variables in it like "$EVENT ($SENSOR) ($TEMPERATURE)", etc. to more than 16 different locations, etc.

I have configured a Central Station and I use Netcat (nc) on my Mac or Linux box to try and see the output (e.g. nc -l -p [port]). The panel connects, but there is no output. I even used tcpdump to no avail.

Any ideas?

Thanks,
Brad

#48 Threadhead

Threadhead

    Cocooner

  • Registered
  • PipPip
  • 61 posts
  • Location:Arizona

Posted 25 April 2009 - 10:33 PM

Received a request for my scripts on logging all Elk events to a database. A bit much to go into here, so please visit my blog post.

Monitor Your Elk-M1, Log to MySQL, and Daemonize it!

#49 elcano

elcano

    Dedicated Cocooner

  • Registered
  • PipPipPip
  • 657 posts
  • Location:San Juan, Puerto Rico (US Territory)
  • Hardware:Elk M1
  • Tech:UPB

Posted 10 May 2009 - 09:41 PM

Well, looks like no one else is interested, ...
Anyone have anything else they would like to see?


Not so fast! Im interested too. I have always been reluctant to keep a PC ON all the time. However, the netbooks are a good low power alternative to home automation. I have an ASUS 701 in which I installed MisterHouse last week but, I get nothing if I cannot make it to talk to my M1.

The ElkM1 wiki page at Misterhouse mentions this module and makes some reference at using it with a serial interface, but in reality it provides no guidance on how to use this module within Misterhouse - much less using the ethernet interface. Since I have no experience in Misterhouse yet, and absolutely no knowledge in Perl, I would like to see some guidance on how to configure Misterhouse to use this module. I dont need anything too fancy. Just some basic example/guidance so that I can continue building on it.

I know that this departs a little from the original topic, so you might want to reply in a separate thread to keep this module thread architecture neutral.

Edited by elcano, 10 May 2009 - 09:43 PM.


#50 Threadhead

Threadhead

    Cocooner

  • Registered
  • PipPip
  • 61 posts
  • Location:Arizona

Posted 10 May 2009 - 10:16 PM

The ElkM1 wiki page at Misterhouse mentions this module and makes some reference at using it with a serial interface, but in reality it provides no guidance on how to use this module within Misterhouse - much less using the ethernet interface. Since I have no experience in Misterhouse yet, and absolutely no knowledge in Perl, I would like to see some guidance on how to configure Misterhouse to use this module. I dont need anything too fancy. Just some basic example/guidance so that I can continue building on it.

About all I can add is that the Elk-M1 Perl script works just dandy over tcp/ip. Very well in fact.

Second, I have never used MH, so I'm no help in that department. Anyone else?

Edited by Threadhead, 10 May 2009 - 10:17 PM.


#51 signal15

signal15

    Cocoonut

  • Registered
  • PipPipPipPip
  • 1273 posts

Posted 12 July 2009 - 10:59 AM

What does this Rails app you have do exactly? Can I download it somewhere? Will it run using the latest version of Rails?

I'm logging all of my Brultech data to a database also, it might be cool to get the Elk data and the Brultech data into a single web app.

Edited by signal15, 12 July 2009 - 11:00 AM.


#52 Threadhead

Threadhead

    Cocooner

  • Registered
  • PipPip
  • 61 posts
  • Location:Arizona

Posted 13 July 2009 - 02:59 PM

What does this Rails app you have do exactly? Can I download it somewhere? Will it run using the latest version of Rails?

It basically outputs a lot of graphs based on your thermostat data and zone data. Simple statistics as well. Nice if you want to see trends in activity and temps.

If you are on windows, then running a rails app is in the intermediate skill range. Easy for linux or Mac. I have it running on rails 2.1.0, but it should be simple to move up to 2.3.2. Uses Open Flash Chart for the graphs.

I haven't made it available because I wrote it for me and my setup. With some arm twisting, I might move it on to github if others are really interested.

#53 roussell

roussell

    Dedicated Cocooner

  • Registered
  • PipPipPip
  • 517 posts
  • Twitter:roussell
  • Location:Birmingham, Alabama
  • Experience:average
  • Software:Indigo
  • Hardware:Custom
  • Tech:INSTEON, 1-Wire, Custom
  • Audio:Custom
  • CCTV:ip, dvr
  • Phone:Linksys PAP2

Posted 13 July 2009 - 03:27 PM

Twist :)

#54 signal15

signal15

    Cocoonut

  • Registered
  • PipPipPipPip
  • 1273 posts

Posted 13 July 2009 - 06:50 PM

Twist ;)

I've run and written Rails apps before, I shouldn't have much trouble making it work. I'll likely throw it on either a linux or FreeBSD box.

Edited by signal15, 13 July 2009 - 06:51 PM.


#55 Threadhead

Threadhead

    Cocooner

  • Registered
  • PipPip
  • 61 posts
  • Location:Arizona

Posted 13 July 2009 - 10:42 PM

Twist ;)


Jeez, that came fast :D

Give me a bit of time and I'll bump it up to rails 2.3.2, OFC2, and try to make it a bit easier to adapt to other setups.

Doesn't sound like it's going to be a problem with signal15 or roussell, but for others that are interested you will have to be comfortable doing some basic config editing and rails/ruby experience will be helpful.

Oh yea, this was pretty much thrown together late nights, so don't expect any modicum of rails programming prowess.

#56 Threadhead

Threadhead

    Cocooner

  • Registered
  • PipPip
  • 61 posts
  • Location:Arizona

Posted 13 July 2009 - 11:16 PM

I guess I should post a pic to see if you guys are really interested before I invest the time:

Attached File  Picture_9.png   92.03K   124 downloads

#57 Threadhead

Threadhead

    Cocooner

  • Registered
  • PipPip
  • 61 posts
  • Location:Arizona

Posted 13 July 2009 - 11:21 PM

And a pic for the zone stats:

Attached File  Picture_8.gif   60.15K   90 downloads

#58 signal15

signal15

    Cocoonut

  • Registered
  • PipPipPipPip
  • 1273 posts

Posted 16 July 2009 - 03:24 PM

Whoops, didn't realize you were still waiting for a reply on this. Yes, I'm still interested. This looks like the perfect thing to add my brultech stats to also.

#59 Threadhead

Threadhead

    Cocooner

  • Registered
  • PipPip
  • 61 posts
  • Location:Arizona

Posted 16 July 2009 - 10:09 PM

Whoops, didn't realize you were still waiting for a reply on this. Yes, I'm still interested. This looks like the perfect thing to add my brultech stats to also.

Headed out for a Cub Scout camp-out. Be back Monday and I'll put her up on github.

#60 TulsaDigital

TulsaDigital

    Newbie

  • New Member
  • Pip
  • 2 posts

Posted 21 July 2009 - 03:41 PM

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

If you have a linux computer connected (via serial cable) to the ElkM1 you can use the linux tool "socat" to redirect TCP packets to the Serial interface.

Then you could use the Perl script here (I assume, haven't actually tried it) to connect via TCP to the Serial port.

You can also use ElkRP (I've tested this) to connect from any computer on your network to the ElkM1.

This supports simultaneous connections to the M1 too. Though all connections will receive anything the M1 outputs. But you could use one connection to log everything, another to do some automation tasks, and still be able to connect via the ElkRP. Anyhow, here's the commands I use.

This connects to the ElkM1 on COM1 or /dev/ttyS0. You may need to modify it to point to the correct device on your system. Once done with these two commands you can connect to that linux computer on port 9750 with the ElkRP or any other software to communicate with the ElkM1. You can use any port you want, just change the 9750 below to the port you want to use. Special thanks to Gerhard Rieger w/ socat for helping me get the right commands to do this.

socat /dev/ttyS0,raw,b115200 ip-datagram:127.0.0.2:250,bind=127.0.0.1 &
socat tcp-l:9750,reuseaddr,fork ip-datagram:127.0.0.1:250,bind=127.0.0.2 &




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users