readings method

  1. @override
Future<Map<String, dynamic>> readings({
  1. Map<String, dynamic>? extra,
})
override

Obtain the measurements/data specific to this MovementSensor If a sensor is not configured to have a measurement or fails to read a piece of data, it will not appear in the readings dictionary.

var readings = await myMovementSensor.readings();

For more information, see Movement Sensor component.

Implementation

@override
Future<Map<String, dynamic>> readings({Map<String, dynamic>? extra}) async {
  final request = GetReadingsRequest()
    ..name = name
    ..extra = extra?.toStruct() ?? Struct();
  final response = await client.getReadings(request);
  return response.toPrimitive();
}