Skip to content
Morten Nielsen edited this page Jun 5, 2017 · 9 revisions

Welcome to the openzwave-dotnet-uwp wiki!

For more full examples, check out the sample apps.

Compiling from scratch? See Compiling-OpenZWave

Getting Started

The API reference can be found here: (


Package can be referenced via NuGet:

PM> Install-Package OpenZWave -Pre

Note that .NET applications must be set to compile for x86 and not AnyCPU or x64 (this does not apply to UWP apps which also supports x64 and ARM).

Deploying configuration files

If using NuGet, ignore this.

It's important that you deploy all the XML configuration files from \open-zwave\config**. into the /config/ folder of your app. The sample apps uses a DeployConfigFiles.targets file to do this (via msbuild) by including this in your project:

  <Import Project="DeployConfigFiles.targets" />

Note, that if you use the nuget package this will automatically happen, as this .targets file is automatically included.

Initializing the OpenZWave Library

ZWMOptions.Instance.Initialize(); //Configure default options
ZWMOptions.Instance.Lock();       //Options must be locked before using
ZWManager.Instance.Initialize();  //Start up the manager

Opening a serial port


var availablePorts = System.IO.Ports.SerialPort.GetPortNames();
var serialPort = availablePorts.First().Id; //Adjust to pick the right port for your usb stick
ZWManager.Instance.AddDriver(serialPort); //Add the serial port (you can have multiple!)


In UWP apps you must first enable the Serial Port capability. To do this, you must add the following section to the Capabilities part of the Package.appxmanifest:

    <DeviceCapability Name="serialcommunication">
      <Device Id="any">
        <Function Type="name:serialPort" />

Next is finding the serial port using the DeviceInformation APIs, and then add the driver

//Hook up the serial port
var serialPortSelector = Windows.Devices.SerialCommunication.SerialDevice.GetDeviceSelector();
var devices = await DeviceInformation.FindAllAsync(serialPortSelector);
var serialPort = devices.First().Id; //Adjust to pick the right port for your usb stick
ZWManager.Instance.AddDriver(serialPort); //Add the serial port (you can have multiple!)

Note: If you are running on IoT Core, an OpenZWave-to-AllJoyn bridge is installed by default, and might already be using the serial port. If that is the case, stop the OpenZWave-AllJoyn Bridge service first.

Listening for devices

ZWManager.Instance.NotificationReceived += OnNodeNotification; //Start listening for node events

The rest is in the Notification handler. Every time a node is found, changed, removed etc. an event is reported here, including responses to commands you send. Nodes are identified by the HomeID (one per usb controller connected), and by the NodeID. You use these two values to uniquely identify a node on your network, and can then perform operations like changing properties via the ZWManager instance.

private void OnNodeNotification(ZWManager manager, NotificationReceivedEventArgs e)
    var notification = e.Notification;
    var homeID = notification.HomeId;
    var nodeId = notification.NodeId;
    var type = notification.Type;

Sending commands


Clone this wiki locally
You can’t perform that action at this time.