Ejemplo n.º 1
0
        public Device AddDeviceByConfig(Config config)
        {
            if (GetDevices().devices.Any(s => s.id == config.id))
                throw new PimaticException("E_PIM_SVC.001", "Device with id {0} already exists in config file",
                    config.id);

            var addDeviceByConfigMessage = new AddDeviceByConfigMessage { deviceConfig = config };
            var response = PimaticRestClient.PerformHttpPost(addDeviceByConfigMessage, "/api/device-config");
            return JsonConvert.DeserializeObject<Device>(GetResultMessage(response));
        }
Ejemplo n.º 2
0
        public Device AddDeviceByConfig(Config config)
        {
            if (GetDevices().devices.Any(s => s.id == config.id))
            {
                throw new PimaticException("E_PIM_SVC.001", "Device with id {0} already exists in config file",
                                           config.id);
            }

            var addDeviceByConfigMessage = new AddDeviceByConfigMessage {
                deviceConfig = config
            };
            var response = PimaticRestClient.PerformHttpPost(addDeviceByConfigMessage, "/api/device-config");

            return(JsonConvert.DeserializeObject <Device>(GetResultMessage(response)));
        }
 private void _addDeviceToConfig(Config config)
 {
     config.id = _testDeviceId;
     _clientFactory.AddDeviceByConfig(config);
 }