static void hbHttpClient_OnMessage(string data) { var o = JObject.Parse(data); //CrestronConsole.PrintLine("DataReceived - {0}", data); if (o["accessories"] != null) { foreach (var accessory in o["accessories"]) { string name = (string)accessory["services"][0]["characteristics"][3]["value"]; //determine who the device belongs to.... if (HBLightbulb.CheckIfDeviceExists(name) > 0) { HBLightbulb.ProcessHttpClientResponse(accessory); } else if (HBSwitch.CheckIfDeviceExists(name) > 0) { HBSwitch.ProcessHttpClientResponse(accessory); } else if (HBFan.CheckIfDeviceExists(name) > 0) { HBFan.ProcessHttpClientResponse(accessory); } else if (HBOutlet.CheckIfDeviceExists(name) > 0) { HBOutlet.ProcessHttpClientResponse(accessory); } else if (HBDoor.CheckIfDeviceExists(name) > 0) { HBDoor.ProcessHttpClientResponse(accessory); } else if (HBGarageDoor.CheckIfDeviceExists(name) > 0) { HBGarageDoor.ProcessHttpClientResponse(accessory); } else if (HBWindow.CheckIfDeviceExists(name) > 0) { HBWindow.ProcessHttpClientResponse(accessory); } else if (HBOccupancySensor.CheckIfDeviceExists(name) > 0) { HBOccupancySensor.ProcessHttpClientResponse(accessory); } else if (HBThermostat.CheckIfDeviceExists(name) > 0) { HBThermostat.ProcessHttpClientResponse(accessory); } else if (HBSecuritySystem.CheckIfDeviceExists(name) > 0) { HBSecuritySystem.ProcessHttpClientResponse(accessory); } } } }