static void Main(string[] args) { /* Plm fluff = new Plm("COM4"); var database = fluff.GetAllLinkDatabase(); foreach (var record in database.Records) { // You can attempt to connect to each device // to figure out what it is: DeviceBase device; if (fluff.Network .TryConnectToDevice(record.DeviceId, out device)) { // It responded. You can get identification info like this: string category = device.DeviceCategory; string subcategory = device.DeviceSubcategory; } else { // couldn't connect - device may have been removed? } } */ FluffInsteon.FluffInsteon insteon = new FluffInsteon.FluffInsteon("COM4", null); insteon.DeviceAdded += insteon_DeviceAdded; insteon.Startup(); while (true) { Thread.Sleep(10000); } System.Console.WriteLine("Frog"); }
static void Main(string[] args) { /* * Plm fluff = new Plm("COM4"); * var database = fluff.GetAllLinkDatabase(); * foreach (var record in database.Records) * { * // You can attempt to connect to each device * // to figure out what it is: * DeviceBase device; * if (fluff.Network * .TryConnectToDevice(record.DeviceId, out device)) * { * // It responded. You can get identification info like this: * string category = device.DeviceCategory; * string subcategory = device.DeviceSubcategory; * } * else * { * // couldn't connect - device may have been removed? * } * } */ FluffInsteon.FluffInsteon insteon = new FluffInsteon.FluffInsteon("COM4", null); insteon.DeviceAdded += insteon_DeviceAdded; insteon.Startup(); while (true) { Thread.Sleep(10000); } System.Console.WriteLine("Frog"); }
static void insteon_DeviceAdded(object sender, FluffInsteon.DeviceChangedEventArgs args) { if (args.Device is OnOffDevice) { OnOffDevice dimmer = (OnOffDevice)args.Device; log.InfoFormat("{0} OnLevel {1}", dimmer.DeviceName, dimmer.OnLevel); } }