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))); }
public GetDeviceClassesMessage GetDeviceClasses() { var response = PimaticRestClient.PerformHttpGet("/api/device-class"); return(JsonConvert.DeserializeObject <GetDeviceClassesMessage>(GetResultMessage(response))); }
public GetDeviceByIdMessage GetDeviceById(string deviceId) { var response = PimaticRestClient.PerformHttpGet("/api/devices/" + deviceId); return(JsonConvert.DeserializeObject <GetDeviceByIdMessage>(GetResultMessage(response))); }
public void Restart() { var content = new StringContent(string.Empty, Encoding.UTF8, "application/json"); PimaticRestClient.Login().PostAsync("http://" + PimaticSettings.Server + ":" + PimaticSettings.Port + "/api/restart", content); }
public Device RemoveDevice(string deviceId) { var response = PimaticRestClient.PerformHttpDelete("/api/device-config/" + deviceId); return(JsonConvert.DeserializeObject <Device>(GetResultMessage(response))); }
//TODO NICOLAS Create Object for GetConfig public GetConfigMessage GetConfig() { var response = PimaticRestClient.PerformHttpGet("/api/config?password=" + PimaticSettings.Password); return(JsonConvert.DeserializeObject <GetConfigMessage>(GetResultMessage(response))); }