出现此问题的原因可能是您在创建设备组时未正确地指定查询条件。请参考以下示例代码,确保您的查询合法且设备组创建成功:
// 设置查询条件
string query = "SELECT * FROM devices WHERE properties.reported.firmwareVersion = '1.0'";
try
{
// 创建设备组
DeviceGroup deviceGroup = await client.DeviceGroups.CreateAsync(new DeviceGroupCreate { DisplayName = "MyNewDeviceGroup", Query = query });
Console.WriteLine("Device group created successfully.");
}
catch (Exception ex)
{
Console.WriteLine($"Failed to create device group due to {ex.Message}");
}