Documentation for JSON data obtained from a sensor is found in our Sensor JSON Documentation
Finding Your Sensor’s IP Address
You can get the same data from your PurpleAir device that it sends to the map. To do this, you will need to first connect your device to wifi so it can be assigned an IP address on your network. This IP address can then be used within the same network to access the sensor. Details on how to find the assigned IP address differ depending on the exact router or network setup you have.
Accessing JSON Data
Sending the HTTP Request
Once you have your sensor’s IP address, you can obtain data by sending it an HTTP request. For a quick test, you can use a URL in your web browser. Below, the curl utility is shown using an example sensor IP address of 192.168.1.43.
curl '192.168.1.43/json?live=true'
ip-address/json
If you send an HTTP web request to your sensor’s IP address with “/json” added to the end, you will see the data it’s most recently reported in JSON format. This data is the same that’s sent to the PurpleAir map.
Example: http://192.168.1.43/json
Note that this will show raw JSON data, not a user-friendly web page. The image below is what it might look like if you view the JSON in your web browser. Some information has been redacted.
ip-address/json?live=true
You can also use “/json?live=true” to see the latest air quality readings collected by the sensor. “/json” (without live=true) shows data averaged over two minutes.
Please note that certain fields, such as temperature, may not update more frequently than every two minutes. Additionally, the fields that update more frequently won’t all do so at the same time. When frequently querying data from a sensor, we recommend doing so at least 10 seconds apart.
Example Address: http://192.168.1.43/json?live=true
Using “/json?live=true” will not change how often your device reports on the map. It will only show data directly from your device. This data also does not update automatically in your web browser, and you’ll need to send another HTTP request (or refresh the web page) to see updated readings.
Learn More
How to Obtain Sensor Data
SD Card File Headers
Understanding PurpleAir Serial Output
Sensor JSON Documentation
