1 Goal is to receive push notifications when the rolling average for ten minutes of PM2.5 density measured by one PurpleAir device crosses a threshold. After that you may want to switch on the air purifier.
3 The Ruby script is intended to run through:
5 - a scheduler (cron, Heroku Scheduler, ...)
9 Set IRON_CACHE_PROJECT_ID and IRON_CACHE_TOKEN env variables.
10 Discord Webhook URL ('WEBHOOK_URL') and one PurpleAir JSON interface ('uri') variables must be set as well.
12 Discord iOS app is not required to run in background. Push notifications work well, if Discord server doesn't miss to receive the message for some reasons. Sometimes it does.
14 Each value, excluding Temperature, is presented in a range derived from the sensor accuracy as published.