Envisalink 2DS - TPI C# Framework (first try)

Information and support for EnvisaLink modules.

Moderators: EyezOnRich, GrandWizard

martin
Posts: 6
Joined: Wed Jul 04, 2012 8:18 am

Envisalink 2DS - TPI C# Framework (first try)

Post 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
Attachments
DSCLogic.zip
(11.84 KiB) Downloaded 763 times
martin
Posts: 6
Joined: Wed Jul 04, 2012 8:18 am

Re: Envisalink 2DS - TPI C# Framework (second try)

Post 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.
Attachments
DSC.zip
Source code (Visual Studio 2k10)
(35.88 KiB) Downloaded 650 times
Setup.zip
Installation package.
You will have to edit the TpiService.exe.config after installation and before starting the service
(190.59 KiB) Downloaded 589 times
cyberbeagle
Posts: 4
Joined: Tue Jul 17, 2012 2:32 pm

Re: Envisalink 2DS - TPI C# Framework (first try)

Post 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! :)
martin
Posts: 6
Joined: Wed Jul 04, 2012 8:18 am

Re: Envisalink 2DS - TPI C# Framework (first try)

Post 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! :)
Attachments
dsc.zip
complete source code
(99.31 KiB) Downloaded 649 times
Setup.zip
Service setup package.
Don't forget to run uninstall from add/remove program if you installed an earlier version
(192.7 KiB) Downloaded 585 times
cpt_keyboard
Posts: 1
Joined: Mon Aug 06, 2012 12:04 pm

Re: Envisalink 2DS - TPI C# Framework (first try)

Post 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
Attachments
LinkService .net installation error.
LinkService .net installation error.
installl_error.jpg (24.96 KiB) Viewed 14246 times
martin
Posts: 6
Joined: Wed Jul 04, 2012 8:18 am

Re: Envisalink 2DS - TPI C# Framework (first try)

Post 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
cyberbeagle
Posts: 4
Joined: Tue Jul 17, 2012 2:32 pm

Re: Envisalink 2DS - TPI C# Framework (first try)

Post 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
turnerj42
Posts: 26
Joined: Wed Sep 19, 2012 10:08 am

Re: Envisalink 2DS - TPI C# Framework (first try)

Post 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
tinkerfailure
Posts: 3
Joined: Thu Oct 11, 2012 6:04 am
Contact:

Re: Envisalink 2DS - TPI C# Framework (first try)

Post 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
martin
Posts: 6
Joined: Wed Jul 04, 2012 8:18 am

Re: Envisalink 2DS - TPI C# Framework (first try)

Post 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)
Attachments
SimpleDSC.zip
Simplied project, C# 2.0 compatible.
(30.64 KiB) Downloaded 681 times
Post Reply