Enhancing M1G rules with a computer

KentDub

Active Member
I'm looking to purchase a M1G to be the central controller for my house. I write .NET software professionally for large enterprises - so naturally when I found out that some people have written .NET programs to interact with the M1G I've been drawn to it. I already run a home server (Windows Server 2008 Standard) that is on 24-7 - so no issue there. What I would like to do is to use the M1G for everything security, and 'offload' the home automation tasks to a custom-built .NET application running on my server. The primary drivers for this idea is from what I've read the M1G seems to have very (very, very [hey, I am a programmer]) limited rule capabilities (specifically no nested statements or OR conditionals).

Am I out of my mind for trying to do something like this? As long as (via the ethernet module) I can poll and/or get the M1 to broadcast events to the computer - as well as be able to send commands to it I should be OK. This, of course, also requires that I can locate a protocol documentation sheet (RFC of sorts).

I was also looking into installing a UPB lighting system as well, but was very disappointed when I found that the M1G can become out-of-sync with the state of the lights. From what I can figure out from the threads, it seems there is a way to have a computer correct the M1G. (Most people were compaining about the proposed solution because they didn't want to run a server 24-7 -- however, I didn't really understand what all is necessary for the solution). Since this is a retrofit project, will UPB work (correct status of the loads is very important to me)? Or should I just bite the bullet and start cutting the drywall and go with a wired solution?

Also - I don't have a single 32-bit computer in the house... Am I going to need to install a virtual machine to communicate with the M1G (even if only for setup)?

Any help locating the protocol documentation and suggestions/comments would be greatly appriciated.

Thanks much,
Kent
 
This is the exact reason I bought HomeSeer. It has a very good Elk plugin which allows me to do the programming of non security tasks much easier on my PC within HomeSeer and let the Elk do what it needs to do which is security. The integration is excellent.
 
As long as (via the ethernet module) I can poll and/or get the M1 to broadcast events to the computer - as well as be able to send commands to it I should be OK. This, of course, also requires that I can locate a protocol documentation sheet (RFC of sorts).
Yes you can achieve just about total control of the M1 via IP or direct serial attachment. The protocol is the same in either case. If you are committed to this course (which is what I did also) here is the book:
http://elkproducts.com/pdf/ELK-M1_RS232_PROTOCOL.pdf
 
user manual http://elkproducts.com/pdf/M1_Installation...ming_Manual.pdf
RS232 Protocol http://elkproducts.com/pdf/ELK-M1_RS232_PROTOCOL.pdf
Check sum generator for rs232 http://elkproducts.com/downloads/M1_CRC_Calculator.exe


Now I understand you are a programmer, but I would urge you to consider downloading some of the packages already written. These can be improved on by writing drivers ect... and a programmer will puch through those quicker then us non-programmers ;)

I'd download and give J9AE, HomeSeer, Premise, cqc, power-home all a shot. they all have free trials.
 
I also use the Elk with Girder 5 and its Elk plugin to program non security items on the PC side. I also handle all TTS voice announcements with the PC side as well using Paul which is much more naturally sounding.

Elk and PC are a good fit.
 
Actually, I believe HomeSeer is written in vb.net, and they have a developers kit for programmers/developers plus an active forum (board.homeseer.com) so you may want to also look into it based on your programming expertise.
 
... What I would like to do is to use the M1G for everything security, and 'offload' the home automation tasks to a custom-built .NET application running on my server. ...
I was also looking into installing a UPB lighting system as well, ...
Kent,

Welcome to Cocoontech!

If you are a professional programmer then, no, you're not crazy for thinking of writing your own application. However, you will be covering ground that has already been explored and settled. Unless you have a novel approach in mind, you're better off building upon what others have already developed.

FWIW, I use Premise Home Control (free) and tend to document my progress while developing a driver. For example, this post followed by this one describe my journey developing a driver for the ELK M1. The resulting driver and documentation are posted here.

I don't have the stats handy but the ELK M1 driver contains at least two dozen class definitions and several hundred lines of Premise VBScript code. Premise has an IDE that lets you build a driver interactively. Premise is fully object-oriented (including its data-store) so an M1 Zone is a class, with properties and methods, and not simply an element in an array. Compared to some other HA applications, Premise drivers feature a higher degree of abstraction owing to more sophisticated programming and presentation models.

The first attached image shows the objects that comprise the ELK M1 driver. The second image show the properties of an unconfigured Zone object (unconfigured because the driver has not yet performed a 'Discovery'). A Zone's properties are read-only with 'Bypassed' being the sole exception. The third image shows the properties of an Area object.

Premise has a sophisticated UPB driver written in C++ and consists of thousands of lines of code. That's one I wouldn't want to write from scratch. Premise offers an SDK if you wish to write a driver using C++ (you'll need Visual Studio Professional). You can also write Premise drivers using any .NET language (VS Express is sufficient).


Good luck with your project.
 

Attachments

  • elk_m1.png
    elk_m1.png
    11.1 KB · Views: 45
  • ELK_M1_Zone_Properties.png
    ELK_M1_Zone_Properties.png
    11.6 KB · Views: 43
  • ELK_M1_Area_Properties.png
    ELK_M1_Area_Properties.png
    24.4 KB · Views: 44
Welcome to CocoonTech!

While it's cool to play around with programming, and do things yourself, I would use an existing package as well (unless you are convinced you will never get tired of maintaining your app in the future). Most HA apps support the M1 driver, plus both Homeseer and J9 Automation Engine are written in .NET and have a plugin framework. Here's an example of an ELK M1 driver I did in VBscript for Homeseer several years ago (for version 1.x, which isn't .NET, but it's easy to convert). The M1 driver protocol is very easy to implement, I have even converted this driver to PHP and Flash ActionScript.


This is the exact reason I bought HomeSeer. It has a very good Elk plugin which allows me to do the programming of non security tasks much easier on my PC within HomeSeer and let the Elk do what it needs to do which is security. The integration is excellent.
You are starting to sound like a commercial and 'Fan-Boy' ;)
 
If you were looking for the UPB protocol docs you can find them here. I think there are a few things in there that were never implemented in the protocol though.
 
Wow, thank you all for the (very fast!) replies! I'm really excited now, it seems that I'll be able to do, well... anything! I would rate my programming level as advanced. However, that said - I was under the (false it seems) impression that the software controllers were in lue of a hardware controller (M1G). As most programmers, I hate reinventing the wheel (unless I know I can do better - and have the will). I didn't realize that they can also be used as a 'presentation layer' on top of the hardware. I will have to see if I can find some comparisons of them and give them a try. The main things I'm looking for are extensive .NET support as well as a 100% customizable interface (not just simply loading custom graphics - I've seen some screenshots and the designer in me says I can make something custom that I'd enjoy better).

I am unable to post links yet, however, if you google 'Coding4Fun Home Automation with Windows Workflow' the first result is what sparked my idea. I downloaded the source last night after posting this thread and found that it already contains the basic building blocks for interfacing with the M1G (even ZWave too - however, I won't be using ZWave). I took a look at the checksum code too.... after a quick 'wtf' momment I understood what they were doing.

One of my goals is to write a suite of web services to be run on my server to interface with the home automation system. From there, I intend to write an app for my Droid that accomplishes pretty much what that other app does for the iPhone. The existing application for the iPhone looks pretty sweet, and I'm a bit disappointed that it hasn't been ported to the Droid - but it looks to have been made from a 3rd party so I can't complain. I also am interested in writing a custom front-end using SilverLight or WPF (I am not a fan of Flash) to the system to run on my Archos9 PCTablet. Custom windows gadgets would be fun too. I have also toyed around with even writing plugins for Microsoft Outlook - as I always have that application open, working or not.

My main concern now is dealing with UPB. The desync issues that have been reported has me worried. I took a peek at the protocol documentation for it and it'll take a while unless I can find another .NET program that already has the starting blocks. Should I simply run the UPB directly from the computer and not attach it to the M1G? Or -- assuming I can get/write a program that always knows the correct state of the loads -- tell the M1G that "No, the Pantry light really is on" without having the M1G send an unnecessary ON command to that light? If I attach UPB to the M1G, will it forward UPB communications over IP - or do I need to have two PIMs?

Thank you all very, very much for your help!
Kent
 
As far as I know, the only UPB desync issue that exists affects every controller, however some controllers have a work-around. Basically, if you activate a link (scene), the switches know if they should react or not. When they do so, they do not report back that they were turned on (not 100% sure about the exact details here), so the controller has no means of knowing which device activated, all it knows is that a certain link was activated.

If you use a PC, you are going to run into the same issue, unless you somehow force ALL UPB commands to go through your PC, and your PC maintains an active database which associates the links with devices so it can manually change the device state in your application. INSTEON has the same issues, but the ISY folks get around this by basically maintaining this database directly on the device.

I personally don't use UPB links, so I never run into any desync issues, and all my lighting control is done via the ELK M1.
 
Note that although you can execute tasks, interrogate system variables, and control non-security components: enable/disable inputs/outputs/lights, you cannot reprogram the rules on the Elk via your own software. Adding rules/tasks/inputs/outputs requires special security handshaking that only ElkRM provides.
 
Well, I ordered my M1G package today :D A few years from now, when I'm wondering where all my free time went --- I'm sure I'll be able to trace it back to today. Is it recommended to "play" with the board for a few days to figure it out (i.e. just hook it up to a few simple things & a computer -- before mounting everything in a can)?
 
Back
Top