Enable notifications for LoRaWAN join events - AWS IoT Wireless

Enable notifications for LoRaWAN join events

AWS IoT Core for LoRaWAN can publish messages to notify you of join events for LoRaWAN devices that you onboard to AWS IoT. Join events notify you when a join or rejoin request of type 0 or type 2 is received, and the device has joined with AWS IoT Core for LoRaWAN.

How join events work

When you onboard your LoRaWAN devices with AWS IoT Core for LoRaWAN, AWS IoT Core for LoRaWAN performs a join procedure for your device with AWS IoT Core for LoRaWAN. Your device then becomes activated for use and can send an uplink message to indicate that it's available. After the device has joined, uplink and downlink messages can be exchanged between your device and AWS IoT Core for LoRaWAN. For more information about onboarding your device, see Onboard your devices to AWS IoT Core for LoRaWAN.

You can enable events to notify you when your device has joined with AWS IoT Core for LoRaWAN. You'll also be notified if the join event fails and when a rejoin request of type 0 or type 2 is received, and when it's accepted.

Enable LoRaWAN join events

Before subscribers to the LoRaWAN join reserved topics can receive messages, you must enable event notifications for them from the AWS Management Console, or by using the API or CLI. You can enable these events for all LoRaWAN resources in your AWS account or for select resources. For information about how to enable these events, see Enable events for wireless resources.

Format of MQTT topics for LoRaWAN events

Reserved MQTT topics for LoRaWAN devices use the following format. If you've subscribed to these topics, then all LoRaWAN devices that are registered to your AWS account can receive the notification:

  • Resource-level topics

    $aws/iotwireless/events/{eventName}/{eventType}/lorawan/wireless_devices

  • Identifier topics

    $aws/iotwireless/events/{eventName}/{eventType}/lorawan/wireless_devices/{resourceID}/{id}

Where:

{eventName}

{eventName} must be join.

{eventType}

{eventType} can be:

  • join_req_received

  • rejoin_req_0_received

  • rejoin_req_2_received

  • join_accepted

{resourceID}

{resourceID} can be dev_eui or wireless_device_id.

For example, you can subscribe to the following topics to receive an event notification when AWS IoT Core for LoRaWAN has accepted a join request from your devices.

$aws/iotwireless/events/join/join_accepted/lorawan/wireless_devices/wireless_device_id/{id}

You can also use the + wildcard character to subscribe to multiple topics at the same time. The + wildcard character matches any string in the level that contains the character, such as the following topic:

$aws/iotwireless/events/join/join_req_received/lorawan/wireless_devices/wireless_device_id/+

Note

You can't use the wildcard character # to subscribe to the reserved topics.

For more information about using the + wildcard when subscribing to topics, see MQTT topic filters in the AWS IoT developer guide.

Message payload for LoRaWAN join event

The following shows the message payload for the LoRaWAN join event.

{ // General fields "eventId": "string", "eventType": "join_req_received|rejoin_req_0_received|rejoin_req_2_received|join_accepted", "WirelessDeviceId": "string", "timestamp": "timestamp", // Event-specific fields "LoRaWAN": { "DevEui": "string", // The fields below are optional indicating that it can be a null value. "DevAddr": "string", "JoinEui": "string", "AppEui": "string", } }

The payload contains the following attributes:

eventId

A unique event ID that's generated by AWS IoT Core for LoRaWAN (string).

eventType

The type of event that occurred. Can be one of the following values:

  • join_req_received: This field will show the EUI parameters JoinEui or AppEui

  • rejoin_req_0_received

  • rejoin_req_2_received

  • join_accepted: This field will show the NetId and DevAddr.

wirelessDeviceId

The ID of the LoRaWAN device.

timestamp

The Unix timestamp of when the event occurred.

DevEui

The unique identifier of the device found on the device label or device documentation.

DevAddr and EUIs (optional)

These fields are the optional device address and the EUI parameters JoinEUI or AppEUI.