Air Quality Macro (v9.0.6)

Air Quality Macro (v9.0.6)

Jason Snell wrote some code in How Bad Is the Air Out There? to report a PurpleAir sensor reading of air quality in a BitBar menu item.

I've adapted that in this macro to report an arbitrary number of sensor readings in a Custom HTML Prompt that reports the reading as a button to take you to the PurpleAir map and the sensor widget.

I've noted the old instructions for finding a nearby sensor's ID but it seems PurpleAir is making this difficult at the moment, removing the old link and the list of IDs at the same time. But if it restores one or the other, you'll be able to plug your own location into this macro, so here it is.

Ah-ha Moment: You can mine the sensor ID from the URL when you click on the sensor location on the map. I detail the process in the next message.

As configured, it shows air quality around Mount Davidson in San Francisco. It retrieves the readings when you run it.

Air Quality.kmmacros (9.7 KB)

Revised: 16 September 2020

  • Changed the instructions to reflect the note below that works for any location with any browser

  • Revised the CSS so the button readout is always circular

1 Like

Here's the trick to finding the sensor ID in your neighborhood:

  • Use the Search button to enter your ZIP code (or zoom around on the map to find your location).

  • Click on an outdoor sensor (there are indoor sensors that aren't particularly helpful).

  • Mine the ID from the URL. For example, in the sensor ID for Daly City, Hillside is 53149, right after "select."