Giter Club home page Giter Club logo

veranet's Introduction

Vera/Z-Wave API for .NET

This is a .NET library for Vera device (*Mi Casa Verde Z-Wave box).

http://getvera.com/

Example :

using (VeraController vera = new VeraController(new VeraConnectionInfo("192.168.0.222"))) 
{
    vera.WaitForFullRequest();
    foreach (var device in vera.Devices)
    {
        Console.WriteLine("{0}: {1} ({2})", device.GetType().Name, device.Name, device.Room?.Name ?? "No room");
    }
}

You can connect to local or remote device :

// Local access
var vera = new VeraController(new VeraConnectionInfo("192.168.0.222"));

// Remote access
var vera = new VeraController(new VeraConnectionInfo("username", "password", "S/N");

Start the listener when connected for receiving in real time all changes on your Vera (Scene or devices updates) :

var vera = new VeraController(new VeraConnectionInfo("192.168.0.222"));
vera.StartListener();

The Vera controller has the following properties :

  • Sections
  • Rooms
  • Categories
  • Scenes
  • Devices
  • Others informations about the current data version, model, state, last update, etc...

Each sections, rooms, categories, scenes and devices are VeraBaseObject witch implement the INotifyPropertyChanged to raise event when data changes.

ClassDiagram

For example to enumerate all your Vera devices :

foreach (var item in controller.Devices)
{
    Console.WriteLine("{0} is {1}", item.Name, item.GetType().Name);
}

To enumerate all "Switch" devices (switch, dimmable light or windows covering by inheritance) and show state :

foreach (var item in controller.Devices.Where(d => d is Switch))
{
    Console.WriteLine("{0} is {1}", item.Name, ((Switch)item).Status ? "ON" : "OFF");
}

To show the temperature of a sensor :

var bedroomSensor = controller.Devices.First(d => d.Name == "Bedroom Temperature Sensor");
Console.WriteLine("{0} = {1} = {2}", bedroomSensor.Name, bedroomSensor.Temperature, controller.TemperatureUnit);

To run a scene :

var myScene = controller.Scenes.First(d => d.Name == "My Demo Scene");
myScene.RunScene();

To close all shutters in a specific room :

var bedroomShutters = controller.Devices.Where(d => d is WindowCovering && d.Room.Name == "Bedroom").ToList();
bedroomShutters.ForEach(d => d.SwitchOff());

To monitor the device's changes :

controller.DeviceUpdated += (s, e) =>
{
    Console.WriteLine("The device '{0}' is updated", e.Device.Name);
};

To monitor a specific property changes of a device :

var bedroomSensor = controller.Devices.First(d => d.Name == "Bedroom Temperature Sensor");
bedroomSensor.PropertyChanged += (s, e) =>
{
    Console.WriteLine("The property '{0}' on the device {0} changed", e.PropertyName, bedroomSensor.Name);
};

The solution contains a WPF sample application to view and control in real time all devices, scenes and rooms connected to your Vera :

WpfConsoleTest

License

Apache License

veranet's People

Contributors

sebastienwarin avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.