static public IEnOceanDevice CreateDeviceInstance(IHSApplication HS, EnOceanController Controller, String deviceId, String deviceType, JObject config)
        {
            EDeviceTypes DeviceType;

            if (Enum.TryParse <EDeviceTypes>(deviceType, out DeviceType))
            {
                config["device_type"] = (int)DeviceType;
                switch (DeviceType)
                {
                case EDeviceTypes.PUSHBUTTON_4x:
                {
                    Console.WriteLine("BUTTON THING");
                    var newDev = new EnOceanButtonDevice(HS, Controller, deviceId, config);
                    Controller.RegisterDevice(newDev);
                }
                break;

                case EDeviceTypes.DOORCONTACT:
                {
                    Console.WriteLine("DOOR THING");
                    var newDev = new EnOceanDoorContactDevice(HS, Controller, deviceId, config);
                    Controller.RegisterDevice(newDev);
                }
                break;

                case EDeviceTypes.TEMPERATURE_SENSOR:
                {
                    Console.WriteLine("TEMPERATURE THING");
                    var newDev = new EnOceanTempSensorDevice(HS, Controller, deviceId, config);
                    Controller.RegisterDevice(newDev);
                }
                break;
                }
            }
            else
            {
                Console.WriteLine("Error getting type: {0}", deviceType);
            }
            return(null);
        }
 public static IEnOceanDevice CreateDeviceInstance(IHSApplication HS, EnOceanController Controller, String deviceId, String deviceType, JObject config)
 {
     EDeviceTypes DeviceType;
     if (Enum.TryParse<EDeviceTypes>(deviceType, out DeviceType))
     {
         config["device_type"] = (int)DeviceType;
         switch (DeviceType)
         {
             case EDeviceTypes.PUSHBUTTON_4x:
                 {
                     Console.WriteLine("BUTTON THING");
                     var newDev = new EnOceanButtonDevice(HS, Controller, deviceId, config);
                     Controller.RegisterDevice(newDev);
                 }
                 break;
             case EDeviceTypes.DOORCONTACT:
                 {
                     Console.WriteLine("DOOR THING");
                     var newDev = new EnOceanDoorContactDevice(HS, Controller, deviceId, config);
                     Controller.RegisterDevice(newDev);
                 }
                 break;
             case EDeviceTypes.TEMPERATURE_SENSOR:
                 {
                     Console.WriteLine("TEMPERATURE THING");
                     var newDev = new EnOceanTempSensorDevice(HS, Controller, deviceId, config);
                     Controller.RegisterDevice(newDev);
                 }
                 break;
         }
     }
     else
     {
         Console.WriteLine("Error getting type: {0}", deviceType);
     }
     return null;
 }