Air quality monitoring script for Argos (Linux) and BitBar (macOS)
~/.config/argos/ and in case of BitBar, we define it during the installation or first run) and then app displays our data automatically. We can also set refresh rate. E.g. if we want our script to be executed every 60 seconds, we can name it
script.60s.sh. We can also create more advanced scripts and more details can be found in BitBar and Argos documentation. In my case, I wanted to create a script, which reads
CAQI (Common Air Quality Index) in my current location based on Airly sensors. Airly provides nice API, which we can use in our projects. Please remember that most of the sensors are located in Poland. On my Ubuntu Linux with Gnome 3, I created a new script in the following path:
For a BitBar script location could be different. Both for BitBar and Argos follow the same naming convention. My script looks as follows:
It works fine on Linux. The only requirement is to install jq. For macOS, I needed to change
/usr/local/bin/jq to make it work. I gathered information about air quality level from this website: https://www.airqualitynow.eu/pl/about_indices_definition.php [PL]. Of course, we need to replace
API_KEY with our api key, which we can get from https://developer.airly.eu/ website as well as
YOUR_LONGITUDE with coordinates of our location. It can be static location in our city. We can get them e.g. from Google Maps.
As a result, we have beautiful text in our top panel:
This screenshot was taken on Ubuntu Linux with Gnome 3. On macOS it works the same (I checked it).