Allows for importing MyAir data to InfluxDB.
- The MyAir credentials associated with the ResMed CPAP that's uploading MyAir data to the cloud
- A device, capable of running either Docker containers or Python e.g., Raspbian or Windows
- InfluxDB v2 installed and accessible from the device running the import
- Bucket created on the influxDB and token available
The app reads the settings from template.config.toml
, then config.toml
(if it exists), then environment variables.
See template.config.toml
for details.
Choose one of these methods.
touch config.toml
- This will fail due to malformed config.toml. That's intentional :)
sudo docker run --name myAir -v "`pwd`/config.toml:/app/config.toml" vdbg/resmed-influx
sudo docker cp myAir:/app/template.config.toml config.toml
- Edit
config.toml
by following the instructions in the file sudo docker start myAir -i -e MYAIR_INFLUX_MAIN_LOG_VERBOSITY=DEBUG
This will display logging on the command window allowing for rapid troubleshooting.Ctrl-C
to stop the container.- When done testing the config:
sudo docker container rm myAir
sudo docker run -d --name myAir -v "`pwd`/config.toml:/app/config.toml" --restart=always --memory=100m vdbg/resmed-influx
- To see logs:
sudo docker container logs -f myAir
git clone https://github.com/vdbg/resmed-influx.git
sudo docker build -t resmed-influx-image resmed-influx/
cd resmed-influx
cp template.config.toml config.toml
- Edit
config.toml
by following the instructions in the file - Test run:
sudo docker run --name myAir -v "`pwd`/config.toml:/app/config.toml" resmed-influx-image
This will display logging on the command window allowing for rapid troubleshooting.Ctrl-C
to stop the container. - If container needs to be restarted for testing:
sudo docker start myAir -i
- When done testing the config:
sudo docker container rm myAir
sudo docker run -d --name myAir -v "`pwd`/config.toml:/app/config.toml" --restart=always --memory=100m resmed-influx-image
- To see logs:
sudo docker container logs -f myAir
Dependency: Docker installed.
Inspect template.config.toml
file for all the settings that need to be overriden. Command will look something like:
sudo docker run \
-d \
--name myAir \
--memory=100m \
--pull=always \
--restart=always \
-e MYAIR_INFLUX_RESMED_LOGIN=user \
-e MYAIR_INFLUX_RESMED_PASSWORD=password \
-e MYAIR_INFLUX_INFLUX_TOKEN=token \
vdbg/resmed-influx
Python 3.11+ with pip3 required. sudo apt-get install python3-pip
will install pip3 on ubuntu/raspbian systems if missing.
git clone https://github.com/vdbg/resmed-influx.git
cd resmed-influx
cp template.config.toml config.toml
- Edit
config.toml
by following the instructions in the file pip3 install -r requirements.txt
- Run the program:
- Interactive mode:
python3 main.py
- Shorter:
.\main.py
(Windows) or./main.py
(any other OS). - As a background process (on non-Windows OS):
python3 main.py > log.txt 2>&1 &
- To exit:
Ctrl-C
if running in interactive mode,kill
the process otherwise.
The app may fail on first run, or may start failing after a long period of successful runs with a "policyNotAccepted" error. If this happens, navigate to the myAir web - ResMed site, enter your credentials, and accept myAir's policy.
This template is what produced the following Grafana dashboard:
Note: the dashboard uses influxdb v1 compatibility mode. This page explains how to enable it.
All the myAir adapter code was copied from here.