1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI?v=3";
/*
# Email alerts when air is unhealthy near you */
export async function aqi() {
const location = "alamo square, sf"; // **<-- change to place, city, or zip code**
const data = await easyAQI({ location });
if (data.severity.includes("Unhealthy")) {
console.email(
"Air Quality: " + data.severity,
`AQI in ${location} is ${data.aqi}`
);
}
}
/* This val uses nominatim's geocoder to get your lat, lon,
and air quality data from OpenAQ. It uses EPA's NowCast
AQI Index calculation and severity levels. This val was
created with much help from @russbiggs (Director of
Technology at OpenAQ) */