startDeviceDiscovery method

Future<StartDeviceDiscoveryResponse> startDeviceDiscovery({
  1. required DiscoveryType discoveryType,
  2. String? accountAssociationId,
  3. String? authenticationMaterial,
  4. DiscoveryAuthMaterialType? authenticationMaterialType,
  5. String? clientToken,
  6. String? connectorAssociationIdentifier,
  7. List<String>? connectorDeviceIdList,
  8. String? controllerIdentifier,
  9. Map<String, String>? customProtocolDetail,
  10. String? endDeviceIdentifier,
  11. ProtocolType? protocol,
  12. Map<String, String>? tags,
})

This API is used to start device discovery for hub-connected and third-party-connected devices. The authentication material (install code) is delivered as a message to the controller instructing it to start the discovery.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceUnavailableException. May throw ThrottlingException. May throw UnauthorizedException. May throw ValidationException.

Parameter discoveryType : The discovery type supporting the type of device to be discovered in the device discovery task request.

Parameter accountAssociationId : The identifier of the cloud-to-cloud account association to use for discovery of third-party devices.

Parameter authenticationMaterial : The authentication material required to start the local device discovery job request.

Parameter authenticationMaterialType : The type of authentication material used for device discovery jobs.

Parameter clientToken : An idempotency token. If you retry a request that completed successfully initially using the same client token and parameters, then the retry attempt will succeed without performing any further actions.

Parameter connectorAssociationIdentifier : The id of the connector association.

Parameter connectorDeviceIdList : Used as a filter for PLA discoveries.

Parameter controllerIdentifier : The id of the end-user's IoT hub.

Parameter customProtocolDetail : Additional protocol-specific details required for device discovery, which vary based on the discovery type.

Parameter endDeviceIdentifier : The unique id of the end device for capability rediscovery.

Parameter protocol : The protocol type for capability rediscovery (ZWAVE, ZIGBEE, or CUSTOM).

Parameter tags : A set of key/value pairs that are used to manage the device discovery request.

Implementation

Future<StartDeviceDiscoveryResponse> startDeviceDiscovery({
  required DiscoveryType discoveryType,
  String? accountAssociationId,
  String? authenticationMaterial,
  DiscoveryAuthMaterialType? authenticationMaterialType,
  String? clientToken,
  String? connectorAssociationIdentifier,
  List<String>? connectorDeviceIdList,
  String? controllerIdentifier,
  Map<String, String>? customProtocolDetail,
  String? endDeviceIdentifier,
  ProtocolType? protocol,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'DiscoveryType': discoveryType.value,
    if (accountAssociationId != null)
      'AccountAssociationId': accountAssociationId,
    if (authenticationMaterial != null)
      'AuthenticationMaterial': authenticationMaterial,
    if (authenticationMaterialType != null)
      'AuthenticationMaterialType': authenticationMaterialType.value,
    if (clientToken != null) 'ClientToken': clientToken,
    if (connectorAssociationIdentifier != null)
      'ConnectorAssociationIdentifier': connectorAssociationIdentifier,
    if (connectorDeviceIdList != null)
      'ConnectorDeviceIdList': connectorDeviceIdList,
    if (controllerIdentifier != null)
      'ControllerIdentifier': controllerIdentifier,
    if (customProtocolDetail != null)
      'CustomProtocolDetail': customProtocolDetail,
    if (endDeviceIdentifier != null)
      'EndDeviceIdentifier': endDeviceIdentifier,
    if (protocol != null) 'Protocol': protocol.value,
    if (tags != null) 'Tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/device-discoveries',
    exceptionFnMap: _exceptionFns,
  );
  return StartDeviceDiscoveryResponse.fromJson(response);
}