Skip to content

jahjedtieson/PurpleAirLambda

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

Purple Air Lambda

Amazon AWS Lambda function for accessing Purple Air API and rendering the result as a web page

Setup Instructions

  1. Obtain a Purple Air API key. Email [email protected]; be sure to provide your first and last name.

AWS Deployment Instructions

  1. Create an AWS Lambda Node.js function, running on Node.js 18.x
  2. Add the environment variable API_KEY to the Lambda configuration; set the value to your Purple Air API read key.
  3. Create an AWS API Gateway:
  • Select "HTTP API".
  • Add an integration to your Lambda function
  • Configure the route with the GET HTTP method
  1. Configure the AWS API Gateway:
  • Select the gateway
  • Select Integration
  • Create a new Parameter mapping:
    • Response (based on a status code)
    • Response status code of 200
    • Add new mapping for header.Content-Type, Overwrite with value text/html.

Usage Instructions

Access the created Amazon API Gateway, with the specified route, passing in a comma-delimited list of Purple API Sensor IDs for the sensors parameter. You can look up sensor IDs via the Purple Air Map. Click on a particular sensor, and extract the value of the select URL parameter.

e.g. Sample Implementation

Implementation Notes

  • Purple Air sensors do not return AQIs. Instead, they return particle counts, which need to be transformed to AQIs.
  • The temperature reading is not an environmental value; instead, it is the internal temperature of the sensor itself. Testing has shown this to be 8° above the environmental temperature. Read more here.

About

AWS Lambda Function for Purple Air API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published