Enable rule on all of the "built-in" simulated devices

One more minor change: set the threshold of temperature to 60

It is desired for the scenario driven out-of-box experience
This commit is contained in:
Xiangzhi Sheng 2017-02-22 11:43:34 +08:00
Родитель 8c9caf515a
Коммит 84a8f731ca
1 изменённых файлов: 13 добавлений и 10 удалений

Просмотреть файл

@ -155,17 +155,20 @@ namespace Microsoft.Azure.Devices.Applications.RemoteMonitoring.DeviceAdmin.Infr
public async Task BootstrapDefaultRulesAsync(List<string> existingDeviceIds)
{
DeviceRule temperatureRule = await GetNewRuleAsync(existingDeviceIds[0]);
temperatureRule.DataField = DeviceRuleDataFields.Temperature;
temperatureRule.RuleOutput = "AlarmTemp";
temperatureRule.Threshold = 38.0d;
await SaveDeviceRuleAsync(temperatureRule);
foreach (var deviceId in existingDeviceIds)
{
DeviceRule temperatureRule = await GetNewRuleAsync(deviceId);
temperatureRule.DataField = DeviceRuleDataFields.Temperature;
temperatureRule.RuleOutput = "AlarmTemp";
temperatureRule.Threshold = 60.0d;
await SaveDeviceRuleAsync(temperatureRule);
DeviceRule humidityRule = await GetNewRuleAsync(existingDeviceIds[0]);
humidityRule.DataField = DeviceRuleDataFields.Humidity;
humidityRule.RuleOutput = "AlarmHumidity";
humidityRule.Threshold = 48.0d;
await SaveDeviceRuleAsync(humidityRule);
DeviceRule humidityRule = await GetNewRuleAsync(deviceId);
humidityRule.DataField = DeviceRuleDataFields.Humidity;
humidityRule.RuleOutput = "AlarmHumidity";
humidityRule.Threshold = 48.0d;
await SaveDeviceRuleAsync(humidityRule);
}
}
public async Task<TableStorageResponse<DeviceRule>> DeleteDeviceRuleAsync(string deviceId, string ruleId)