示例#1
0
        public AddDeviceToPageMessage AddDeviceToPage(string pageId, string deviceId)
        {
            _checkPage(pageId);
            var response = PimaticRestClient.PerformHttpPost("/api/pages/" + pageId + "/devices/" + deviceId);

            return(JsonConvert.DeserializeObject <AddDeviceToPageMessage>(GetResultMessage(response)));
        }
示例#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)));
        }