1 Goal is to receive push notifications when the running average over ten minutes of PM2.5 density as measured by one PurpleAir crosses a threshold. After that you may want to switch on the air purifier.
3 The Ruby script is intended to run with:
5 - a scheduler (cron, Heroku Scheduler, ...)
9 Set IRON_CACHE_PROJECT_ID and IRON_CACHE_TOKEN env variables. Discord Webhook URL ('WEBHOOK_URL') and one PurpleAir JSON interface ('uri') must be set as well.
11 Discord iOS app doesn't require to run in background. Push notifications work well if Discord server doesn't miss to receive the message for some reasons. Sometimes does.