public async Task UpdateHeatingSwitch(string id, DeviceHeatingModel model) { Twin twin = new Twin(); twin.Properties.Desired[HEATING_KEY] = model.HeatingSwitch; await this.registry.UpdateTwinAsync(id, twin, "*"); }
public async Task <DeviceHeatingModel> GetHeatingSwitch(string id) { var twin = await this.registry.GetTwinAsync(id); DeviceHeatingModel model = new DeviceHeatingModel(); if (twin.Properties.Reported.Contains(HEATING_KEY)) { bool heating; if (bool.TryParse(twin.Properties.Reported[HEATING_KEY].ToString(), out heating)) { model.HeatingSwitch = heating; } } return(model); }
public async Task UpdateDeviceHeatingSwitch(string id, [FromBody] DeviceHeatingModel model) { await this.devices.UpdateHeatingSwitch(id, model); }