- Newest
- Most votes
- Most comments
Hi. You can use the WirelessDeviceId
that comes in the Lamba event, and call the GetWirelessDevice API. Python/boto3 snippet:
iotwireless = boto3.client('iotwireless')
response = iotwireless.get_wireless_device(
Identifier=event['WirelessDeviceId'],
IdentifierType='WirelessDeviceId'
)
thing_name = response['ThingName']
You need to be careful about the API TPS limits though: https://docs.aws.amazon.com/general/latest/gr/iot-core.html#wireless-limits
This will get us the device name, but after getting into it there are a few issues. The lambda function will have to be given permission to use getWirelessDevice (we're using javascript), which is ok, but this function returns a large amount of information that would not be needed. Also, I can see us eventually running into the TPS limit. If we did go this route, once the thing name is acquired from the data returned, we would then still need additional steps to get at the thing attributes (if that is possible from lambda).
If the WirelessDeviceID is included in the topic data output by the lambda function, could this be used down the chain from the lambda function to get at the thing name and attributes? If the goal is to get some of the thing attributes returned in a database query result along with the sensor data from the LoRaWAN device to fully identify the source of the sensor readings, how best to either retrieve the attributes and write them to the table along with the data, or retrieve them as part of the database query?
I can paste the previous paragraph into a new question post if that would be more appropriate.
The TPS limit is adjustable, so you can request a quota increase. Alternatively, you might, for example, have a DynamoDB table to look up the thing name for the Wireless Device ID. Once you have the thing name, you can use DescribeThing to get the attributes. It has a soft limit of 350 TPS in most regions. Will you use fleet indexing? If not, the data you wish to store in Thing attributes, might perhaps also go well in a DynamoDB table.
Previous question on this point: https://repost.aws/questions/QUHQC_cN58QJeRPcKAbKR_Yw
And please be aware there is an SQL function to help with accessing DynamoDB tables in IoT Core rules: https://docs.aws.amazon.com/iot/latest/developerguide/iot-sql-functions.html#iot-sql-function-get-dynamodb
We are planning to use fleet indexing as it's my understanding this is required in order to use Fleet Hub. This being the case, we have a choice between using AWS.Iot.getStatitistics() to query the fleet index based on WirelessDeviceId, or populating a DynamoDB table as each new device is added and using get_dynamodb() to query the table for the attributes we would need. Is that correct?
Relevant content
- asked 2 years ago
- asked 3 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 3 months ago
- AWS OFFICIALUpdated 9 months ago
The idea with Fleet Hub is to, as you say, use it for alarms and general observability of device data. For demo purposes, we have been showing alarms by setting up a query for SNS in a rule action, but if the customer eventually wants to modify or add alarms, the thinking is that Fleet Hub would provide a way for them to manage this without having to bring up the rule and edit the query for SNS. There are two types of devices in the system, and an alert condition on one of the device types depends on the state of another, so the query might get complicated.
The devices will be reporting sensor data once per hour, and we're looking at using either DynamoDB or Timestream to store the data for reports and graphs that go back up to some number years, so for that part of the system we have to get at the thing attributes using the wireless ID as the link to the Thing.