Allows for importing data to InfluxDB v2 for Airthings cloud-connected devices.
- An Airthings device that's connected to the cloud, such as the View Plus device.
- A device with either Docker or Python installed.
- InfluxDB v2 installed on this device or another device, and a bucket created in influxDB.
Dependency: Docker installed.
- Download and run the Docker image:
sudo docker run --name airthings-api -v config.yaml:/app/config.yaml vdbg/airthings-api-influx:latest
- Copy the template config file from the image:
sudo docker cp airthings-api:/app/template.config.yaml config.yaml
- Edit
config.yaml
by following the instructions in the file - Start the container again to verify the settings are correct:
sudo docker start airthings-api -i
- Once the settings are finalized,
Ctrl-C
to stop the container,sudo docker container rm airthings-api
to delete it - Start the container with the final settings:
sudo docker run \
-d \
--name airthings-api \
-v /path_to_your/config.yaml:/app/config.yaml \
--memory=100m \
--pull=always \
--restart=always \
vdbg/airthings-api-influx:latest
Dependency: Python 3.9+ and pip3 installed. sudo apt-get install python3-pip
if missing on raspbian.
- Git clone this repository and cd into directory
cp template.config.yaml config.yaml
- Edit file
config.yaml
by following the instructions in the file pip3 install -r requirements.txt
python3 main.py
or./main.py
The barometric (= atmospheric) pressure is affected by the temperature, humidity and altitude (= elevation): while the standard barometric pressure at sea-level is 1013.25 mbar, it's 300 mbar at the top of Mount Everest.
For that reason, weather stations always adjust their recorded surface pressure to the standard mean sea-level pressure and that pressure is the one reported in weather reports on the radio, television, newspapers, official organizations such as NOAA, etc. Otherwise, comparing pressures recorded at two different locations would be akin to comparing apples to oranges.
AirThings asks for the device location but doesn't use this information (nor the recorded temperature) to adjust its recorded surface pressure. Therefore, if you have any other weather station (such as the Davis Vantage) or compare Airthing's values to official ones, you will get different readings, unless you live at sea-level and it's currently 15 degrees Celsius.
If you wish to correct that, find the device's altitude in meters and enter it in the config file under airthings:elevation
, then restart the script. If you have multiple AirThings devices at different elevations, run separate instances of this script and use airthings:devices
to have each instance handle a subset of the devices.
For Airthings devices that provide local querying capabilities, a recommended alternative is to use BLE instead. Some starting code is provided in Airthing's github.
This script is better suited for Airthings devices that do not provide local querying capabilities but do provide cloud APIs, such as Airthings View Plus. Note that there's an inherent risk with having a strong cloud dependency, as exemplified by one of Airthings competitors.