getSmartElectricEnergySubMeter method
Implementation
Future<SmartElectricEnergySubMeter?> getSmartElectricEnergySubMeter(
String deviceId) async {
dynamic device;
final request = Uri.parse(
'$_baseUrl${CommonUri.devices}/$deviceId/${CommonUri.properties}');
try {
final response = await _httpClient.get(request, headers: _header);
if (response.statusCode != 200) {
device = null;
throw WebAPIServerRequestFail();
}
final responseData = jsonDecode(response.body);
responseData[Keywords.deviceId] = deviceId;
device = SmartElectricEnergySubMeter.fromJson(
responseData as Map<String, dynamic>);
} on Exception catch (e) {
print(e.toString());
device = null;
}
return device;
}