static void Main(string[] args) { Console.WriteLine("Begin"); _mre = new ManualResetEvent(false); OpenZWaveDotNet.ZWManager manager = new OpenZWaveDotNet.ZWManager(); var options = new ZWOptions(); options.Create(@"..\..\config", @"", @""); // Add any app specific options here... options.AddOptionInt("SaveLogLevel", (int)ZWLogLevel.None); // ordinarily, just write "Detail" level messages to the log options.AddOptionInt("QueueLogLevel", (int)ZWLogLevel.None); // save recent messages with "Debug" level messages to be dumped if an error occurs options.AddOptionInt("DumpTriggerLevel", (int)ZWLogLevel.None); // only "dump" Debug to the log emessages when an error-level message is logged // Lock the options options.Lock(); _manager = new ZWManager(); _manager.Create(); _manager.OnNotification += new ManagedNotificationsHandler(NotificationHandler); var driverPort = @"\\.\COM3"; _manager.AddDriver(driverPort); _mre.WaitOne(); var sensor = PrintValuesForDevice("Routing Binary Sensor"); _manager.SetNodeProductName(sensor.HomeId, sensor.Id, "Garage Door Sensor"); foreach (var n in _nodeList) { Console.WriteLine("======================================"); Console.WriteLine("Label: " + n.Label); Console.WriteLine("location: " + n.Location); Console.WriteLine("Manufacturer: " + n.ManufacturerName); var name = _manager.GetNodeName(sensor.HomeId, n.Id); n.Name = name; Console.WriteLine("Name: " + n.Name); Console.WriteLine("Product: " + n.Product); Console.WriteLine("Node Id: " + n.Id); Console.WriteLine("======================================"); } // var node = _nodeList.FirstOrDefault(x => x.Product == "45609 On/Off Relay Switch"); // _manager.SetPollInterval(1000, true); var node = PrintValuesForDevice("Binary Power Switch"); Console.WriteLine(""); Console.WriteLine(""); Console.WriteLine("Getting value of basement light switch:"); ZWValueID v = node.ValueIds.First(x => _manager.GetValueLabel(x) == "Switch"); bool ret; bool b; ret = _manager.GetValueAsBool(v, out b); Console.WriteLine("SWITCH: Got bool value of " + b + ", success: " + ret); var v2 = sensor.ValueIds.First(x => _manager.GetValueLabel(x) == "Sensor"); ret = _manager.GetValueAsBool(v2, out b); Console.WriteLine("SENSOR: Got bool value of " + b + ", success: " + ret); //int i; //ret = _manager.GetValueAsInt(v, out i); //Console.WriteLine("got in value of " + i + ", success: " + ret); //string str; //ret = _manager.GetValueAsString(v, out str); //Console.WriteLine("got string value of " + str + ", success: " + ret); // ret = _manager.SetValue(v, true); //Console.WriteLine("Set bool value to false, success: " + ret); Console.WriteLine("Press enter..."); Console.ReadLine(); }