Page 1 of 2
Envisalink 2DS - TPI C# Framework (first try)
Posted: Wed Jul 04, 2012 8:25 am
by martin
Hello.
Didn't find any implementation for the TPI interface on Envisalink 2DS.
So gave C# a try and wrote some code to communicate with it.
The Example.cs file, should pretty much be show how it works ( I hope ).
Tested with Envisalink 2DS.
The Implemention is based on EnvisaLinkTPI 1.03 Programmers document.
First try and I'm not really a C# programmer, made this one for fun and to learn C#
Feel free to comment, improve and use
//Martin
Re: Envisalink 2DS - TPI C# Framework (second try)
Posted: Wed Aug 01, 2012 8:56 am
by martin
Logic package is still there.
But added a Service and an installer (compiled code attached as setup.zip).
When installed, there is an example plugins.dll installed in the plugin directory (subdirectory to where you choose to install it).
This can be replace with your own code.
All you need to do to create your own plugin (to handle alarm events) is to extend the AbstractResponseEventHandler class from the Common-project (or Common.dll if you just want to reference the dll-file).
Compile your code and put it in the plugins-folder.
When the service starts it scans that folder and loads all classes that extends the AbstractResponseEventHandler class.
Don't forget to edit the TpiService.exe.config file before starting the service.
smtpserver, from and to values are only used with the plugins.dll that is included in the package, this file can be deleted if you create your own plugin.
I currently using it myself, but instead of emailing alarm events (thats what will happend when using the included plugins.dll and correctly configured TpiService.exe.config) my plugin uses a local http->SMS service to text me if something happends.
Re: Envisalink 2DS - TPI C# Framework (first try)
Posted: Wed Aug 01, 2012 11:51 pm
by cyberbeagle
Hi martin,
Great work! I've used your source code and easily built a console app. This lets me Arm/Disarm from Windows Task Scheduler at midnight til 7AM which is something I've wanted for some time as to garantee my 3 young ones don't step out in the cold by sleepwalking or something.
Thanks and good work!
Re: Envisalink 2DS - TPI C# Framework (first try)
Posted: Mon Aug 06, 2012 4:07 pm
by martin
Plugins loader function was not working, fixed.
Mailfunction now logs message if from/to/smtpserver isn't specified.
The service will try to send an email when it starts, if the from/to/smtpserver vallues exists but are incorrect, the Service will crash.
Added JSON service (address is configured in TpiService.exe.config)
default is:
http://localhost:8732/alarm/
implemented functions are:
Code: Select all
awayarm/{partition}
stayarm/{partition}
disarm/{partition}/{code}
status/{partition}
for example: check status of partition 1
Code: Select all
http://localhost:8732/alarm/status/1
to disarm partition 1 using the user code 9876
Code: Select all
http://localhost:8732/alarm/disarm/1/9876
So far learned a lot
, windows service, installer, assambly loading..
If you want anything added, reply!
Re: Envisalink 2DS - TPI C# Framework (first try)
Posted: Mon Aug 06, 2012 5:02 pm
by cpt_keyboard
Hey Martin,
Thanks for the update, however when I try to install the new version I get an error looking for .net framework v4.0 which I already have installed. I went as far as to repair my installation of .net 4.0 but no luck. I didn't have any issue installing the first version of LinkService.
I've attached the error for reference.
Thanks,
Jody
Re: Envisalink 2DS - TPI C# Framework (first try)
Posted: Tue Aug 07, 2012 5:20 am
by martin
Because of the added JSON/HTTP functionallity it now needs the full .NET4 package.
http://www.microsoft.com/en-us/download ... x?id=17851
//Martin
Re: Envisalink 2DS - TPI C# Framework (first try)
Posted: Sat Aug 25, 2012 11:19 pm
by cyberbeagle
Hey Martin,
I'd like to be able to send X10 commands via Envisalink. Not sure its doable, but I wonder with the Sendkeys if one could send commands that way to the Escort.
I do have an Escort installed on my PC5010 with X10 functionality.
Thanks,
Andre
Re: Envisalink 2DS - TPI C# Framework (first try)
Posted: Wed Oct 17, 2012 10:15 pm
by turnerj42
Hey Martin,
Wondering how complicated it would be to make this code send an email any time a zone is faulted? And then closed. Just wanting to set up zone follower type behaviour without loading down the eyez-on's servers so I think this program is on the right track but I am useless with this level of programming. THe running a service is quite the touch as well. Impressed!
Thanks
Re: Envisalink 2DS - TPI C# Framework (first try)
Posted: Fri Oct 26, 2012 9:22 am
by tinkerfailure
Hi Martin,
Looks like you've done some sterling work there.
I've been trying to get your source code to open in Mono on OS X. I don't have any windows machines, and my main goal is to compile and then run the DSC monitor on a Raspberry Pi.
I've been having problems because Mono doesn't support the .NET4.0 Client Profile yet.
I was wondering whether you could think of a way round this easily?
Thanks!
Chris
Re: Envisalink 2DS - TPI C# Framework (first try)
Posted: Tue Nov 27, 2012 7:06 am
by martin
As requested:
Lowered the required c# version (down to 2.0).
Had to simplify it a bit.
1. No install-as-service included.
2. No installer included.
The solution contains:
MainProgram; Console application, mostly as an example, but is fully functional.
Plugins,Logic,Common; Same as before (modified so it can be compiled under C# 2.0)
Also, any references to EventLog is removed.
(Fully functional == it compiles, haven't actually tested this one yet)