.NET (C#) Library for Vera

Hi All,
I have uploaded the first version of my .NET Library for Vera to Codeplex.

You can find it here: http://veradotnet.codeplex.com/

I developed a tool to generate some parts of the source code. As soon as I finish up a few minor touches in the tool, I am also planning to release that tool at Codeplex.

I really appreciate your feedback.

Regards,
Ercan

http://www.linkedin.com/in/ercanturkarslan

I have uploaded a newer version of the library.

This new version provides incremental polling functionality using SDATA or USER_DATA/STATUS.

Simply by calling Poll method of MiosEngine class, you can update the variables that have changed since last update.

I have not used this C# API - however you might want to release a built EXE command-line wrapper for it (I realize not all use cases will fit neatly into a single commandline, perhaps figure out the 90/10 cases) also as part of your source, either as a C# console app or perhaps some sample PowerShell scripts - there are probably a lot of people who want to do some automation on Windows via CMD shell scripts but don’t know C# or want to get involved with the VS IDE. I haven’t searched extensively but I am not aware of any simple command-line interface on Windows (other than curl with URLs, other scripting langs, etc.)

Hi Ercant,

Great DLL for Vera! I’m getting a parsing error when I call the Poll() method.

“An unhandled exception of type ‘Mios.MiosFormatException’ occurred in Mios.dll
Additional information: Could not parse returned value [1449.0790] to UInt32!”

Looking through my XML, I find:

“”

I believe this is due to the precision level of data type UInt32.

Any advice?

I have not used his interface … but on the face of things:

  UInt32 is an unsigned 32 bit integer ... i.e. NO decimal point.

I have added to the open source veradotnet project a fork that includes an easy to use command line tool. :slight_smile:
https://veradotnet.codeplex.com/SourceControl/network/forks/electricessence/revisions

The app is called MiosConsole and can take commands directly as parameters or it will parse commands in a console mode if run without parameters.

This then allows me to create shortcuts for the desktop (or a toolbar) that send Vera commands to alter device states or launch scenes.
Example usage:

MiosConsole -h [ipaddress]:3480 -d [id] -x /toggle

You can of course type MiosConsole /? to get more information.
If you type MiosConsole it will continue to accept commands until you type exit.

Enjoy. Critiques, opinions, advice, info, bug details, are all welcome. It’s an open source world. :slight_smile:

And… of course a HUGE thanks to Ercant who really did something impressive here. Exposing the API in an auto generated way along with some useful methods that really expose the Luup API as it is.

One thing Ercant. I’ve commented on codeplex in the discussion areas. I’ve run into a few bugs…
Mainly, that SCamera1 is sending a string back as “m” when it’s expecting something else.
Secondly, there’s another case where I’m seeing ‘floats’ or ‘doubles’ but it thinks it should be an UInt32. Please see the details. I’d like to get that fixed so I can use your core DLL instead of my revised version.

Hi Ercan!

Great Lib!!

Is it possible to do the mms authentication against the MCV secure servers so that i can use the library when i’m not in the local LAN?

:: Paul

I try to use this lib.
I decide the problem with float ant int32.
But I have bigger problem.

I try to know status all binarylight switches:

[code]var miosData = new SummaryData(miosEngine);

foreach (MiosDevice element in miosData.Engine.Devices)
{
if (element.DeviceType == “urn:schemas-upnp-org:device:BinaryLight:1”)
{
var a = (BinaryLight1)element;
Console.WriteLine(String.Format(“Switch: {0}, {1}”, a.SSwitchPower1.Status, element.Name));
}
}[/code]

I see that this code:

Console.WriteLine(String.Format("Switch: {0}, {1}", a.SSwitchPower1.Status, element.Name));

every time create http request to the controller or to the mios server, but I had alredy get this data before:

var miosData = new SummaryData(miosEngine);

How can I know all switchces status via only one request to the controller?