send_connector_event
async
¶
send_connector_event(
connector_id: ConnectorId,
operation: ConnectorEventOperation,
*,
config_overrides: Optional[AsyncIoTManagedIntegrationsClientConfig] = None,
user_id: Optional[ThirdPartyUserId] = None,
operation_version: Optional[ConnectorEventOperationVersion] = None,
status_code: Optional[ConnectorEventStatusCode] = None,
message: Optional[ConnectorEventMessage] = None,
device_discovery_id: Optional[DeviceDiscoveryId] = None,
connector_device_id: Optional[ConnectorDeviceId] = None,
trace_id: Optional[TraceId] = None,
devices: Optional[Devices] = None,
matter_endpoint: Optional[MatterEndpoint] = None,
) -> SendConnectorEventResponse
Relays third-party device events for a connector such as a new device or a device state change event.
Parameters:
-
connector_id(ConnectorId) –The id of the connector between the third-party cloud provider and IoT managed integrations.
-
user_id(Optional[ThirdPartyUserId], default:None) –The id of the third-party cloud provider.
-
operation(ConnectorEventOperation) –The Open Connectivity Foundation (OCF) operation requested to be performed on the managed thing.
The field op can have a value of "I" or "U". The field "cn" will contain the capability types.
-
operation_version(Optional[ConnectorEventOperationVersion], default:None) –The Open Connectivity Foundation (OCF) security specification version for the operation being requested on the managed thing. For more information, see OCF Security Specification.
-
status_code(Optional[ConnectorEventStatusCode], default:None) –The status code of the Open Connectivity Foundation (OCF) operation being performed on the managed thing.
-
message(Optional[ConnectorEventMessage], default:None) –The device state change event payload.
This parameter will include the following three fields:
-
uri:schema auc://<PARTNER-DEVICE-ID>/ResourcePath(TheResourcepathcorresponds to an OCF resource.) -
op: For device state changes, this field must populate asn+d. -
cn: The content depends on the OCF resource referenced inResourcePath.
-
-
device_discovery_id(Optional[DeviceDiscoveryId], default:None) –The id for the device discovery job.
-
connector_device_id(Optional[ConnectorDeviceId], default:None) –The third-party device id as defined by the connector. This device id must not contain personal identifiable information (PII).
This parameter is used for cloud-to-cloud devices only.
-
trace_id(Optional[TraceId], default:None) –The trace request identifier. This is generated by IoT managed integrations and can be used to trace this command and its related operations in CloudWatch.
-
devices(Optional[Devices], default:None) –The list of devices.
-
matter_endpoint(Optional[MatterEndpoint], default:None) –The device endpoint.
Raises:
-
AccessDeniedException–User is not authorized.
-
InternalServerException–Internal error from the service that indicates an unexpected error or that the service is unavailable.
-
ResourceNotFoundException–The specified resource does not exist.
-
ServiceUnavailableException–The service is temporarily unavailable.
-
ThrottlingException–The rate exceeds the limit.
-
ValidationException–A validation error occurred when performing the API request.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
SendConnectorEvent happy path for device discovery
>>> await client.send_connector_event(connector_id='MockConnectorId', user_id='MockThirdPartyUserId', operation='DEVICE_DISCOVERY', operation_version='1.0', status_code=200, message='Sample ConnectorEventMessage', device_discovery_id='358275hbk3qr', devices=[{'ConnectorDeviceId': 'Mock-Connector-DeviceId-1', 'ConnectorDeviceName': 'Sample-User-device-1', 'CapabilityReport': {'version': '1.0.0', 'nodeId': '1', 'endpoints': [{'id': 'EP1', 'deviceTypes': ['Refrigerator'], 'clusters': [{'id': '0x0201', 'revision': 1, 'attributes': [{'id': '0x0000', 'value': 'exampleString'}, {'id': '0x0001'}, {'id': '0x0002'}], 'commands': ['0x00', '0x01'], 'events': []}]}]}}])
SendConnectorEvent happy path for device command response
>>> await client.send_connector_event(connector_id='MockConnectorId', user_id='MockThirdPartyUserId', operation='DEVICE_COMMAND_RESPONSE', operation_version='1.0', status_code=200, message='Sample ConnectorEventMessage', trace_id='9b75f3839b6140f=_1', matter_endpoint={'id': '1', 'clusters': [{'id': '0x1003', 'attributes': {'0x0000': [73], '0x15570003': 'exampleString'}, 'commands': {'0x03': {}}}]})
SendConnectorEvent happy path for device event
>>> await client.send_connector_event(connector_id='MockConnectorId', user_id='MockThirdPartyUserId', operation='DEVICE_EVENT', operation_version='1.0', status_code=200, message='Sample ConnectorEventMessage', trace_id='TraceId-Sample', matter_endpoint={'id': '1', 'clusters': [{'id': '0x1003', 'attributes': {'0x0000': 73}}]})
Source code in docs_src/capo_iot_managed_integrations/_services/async_io_t_managed_integrations.py
642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 | |