How to integrate with AWS IOT Core Device Location
AWS IoT Core Device Location is a service from AWS that allows you to estimate the location of your device using third-party solvers, eliminating the need for a GPS device. You can find more information in the
documentation.
This guide will walk you through the process of integrating any device with the AWS IOT Core Device Location and TagoIO. By following the steps outlined below, you will be able to set up your device to get an estimated location.
1) AWS Setup
- Go to Identity and Access Management (IAM) on AWS.
- Create a policy with the access "Allow" to the service "iotwireless:GetPositionEstimate".
- Create a user for this policy.
- When a user is created, generate an access key for that user and copy the Access Key ID and Secret Access Key. For more information, refer to the AWS documentation: IAM users - AWS Identity and Access Management
2) TAGOIO Setup
- Configure 2 Secrets for AWS access
- AWS_ACCESSKEYID - with the value of the Access Key ID.
- AWS_SECRETACCESSKEY - with value of the Secret Access key.
- Import the Analysis template for integration with AWS IOT Core Device Location from this link or get the analysis code from our GitHub.
- Create the following environment variables for the analysis:
- AWS_REGION - insert the valor of the region of AWS for user created on step 1
- DESIREABLE_ACCURACY_PERCENT - insert the numeric valor of the desirable percentage of accuracy of the location divided by 100, default value is 0 (67% = 0.67).
- GNSS_SOLVER_VARIABLE - name of the variable of GNSS Solver that will come on device data, default value is "gnss_solver".
- IP_ADDRESS_VARIABLE - name of the variable of IP addresses that will come on device data, default value is "ip_addresses".
- WIFI_ADDRESSES_VARIABLE - name of the variable of Wifi Mac and their RSS value that will come on device data, default value is "wifi_addresses".
- Create an Action to trigger the Analysis based on variable of the device that will receive the data from estimated location
- Create a Policy for your analysis using the information provided below.
- Policy name: it could be any name
- Targets: Select Analysis with the field ID equal to the analysis you created. Simply choose it from the dropdown options.
- Permissions: Add the following permissions: - Allow Secrets with the rule Access with field ID equal to AWS_ACCESSKEYID secret.
- Allow Secrets with the rules Access with field ID equal to AWS_SECRETACCESSKEY secret.
- Allow Device with the rule Send Data with field ID equal to device that you want to get an estimated location. Simply choose it from the dropdown options.
3) Result
When the analysis is triggered, that analysis will write the following data on the device:
- {
- variable: "estimated_location",
- value: "lat;lng”,
- location: {
- lat,
- lng,
- },
- metadata: {
- horizontalAccuracy: horizontalAccuracy,
- verticalAccuracy: verticalAccuracy,
- color: "green" or "red", - based on DESIREABLE_ACCURACY_PERCENT
- },
- group: same of the device data received on analysis trigger
- time: same of the device data received on analysis trigger
- }