Manage Aranet4 CO2 Sensor Data
MCP server for Aranet4 CO2 sensors - scan and pair over Bluetooth, fetch readings into a local SQLite database, query history, and plot trends.
Why it matters
Connect to your Aranet4 CO2 sensor via Bluetooth, retrieve data, and store it in a local SQLite database for historical tracking and analysis.
Outcomes
What it gets done
Scan for nearby Aranet4 devices.
Fetch new CO2 measurements and save them to a local database.
Query historical data by date range or recency.
Assist with device setup and configuration.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/vb-aranet4 | bash Capabilities
Tools your agent gets
Assistance with Aranet4 device setup and configuration
Scan for nearby Aranet4 Bluetooth devices
Retrieve current config and overall statistics from local SQLite database
Set values in config.yaml configuration file
Retrieve new data from configured Aranet4 device and save to local database
Get recent measurements from local database with configurable count
Get data for a specific time period from local database
Overview
Aranet4 MCP Server
An MCP server, built on Aranet4-Python, that lets an AI assistant scan for a paired Aranet4 CO2 sensor over Bluetooth, fetch its readings into a local SQLite database, and query or plot historical measurements conversationally. Use it to track and review CO2 levels from an Aranet4 device through an AI assistant instead of the manufacturer's app, especially once assisted setup and an automatic fetch job are configured.
What it does
An MCP server, built on the Aranet4-Python library, that manages an Aranet4 CO2 sensor through an AI assistant instead of the manufacturer's own app. It scans for nearby paired Aranet4 devices over Bluetooth Low Energy, fetches new readings from the device's embedded memory into a local SQLite database for tracking and later review, and answers questions about recent measurements or a specific past date, including, in MCP clients that support images, generating a plot to visualize trends rather than just returning numbers.
When to use - and when NOT to
Use it once an Aranet4 device is already paired and the goal is to check current or historical CO2 readings conversationally, log data over time without a phone app, or visualize trends across a date range. Setup is meant to be assisted rather than manual: after installing the server, asking the client to init aranet4 walks through configuration instead of hand-editing config.yaml. It is not useful without a physical Aranet4 device already paired - BLE devices like this do not show up in a regular Bluetooth search, so pairing has to happen through a BLE-capable tool such as LightBlue on macOS first. Querying a wide date range with a low result limit will skip datapoints rather than return everything, so the limit should be sized to the range being queried.
Capabilities
Configuration and utilities: init_aranet4_config (assisted setup), scan_devices (find nearby Aranet4 devices over BLE), get_configuration_and_db_stats (current config and local database stats), set_configuration (edit config.yaml values). Updating historical data: fetch_new_data pulls new readings from the configured device into the local database. Querying historical data: get_recent_data, a specified number of recent measurements, and get_data_by_timerange, measurements within a date range with a configurable result limit; either can be requested as a plot.
How to install
Requires an already-paired Aranet4 device and, recommended, the uv package manager.
git clone git@github.com:diegobit/aranet4-mcp-server.git
cd aranet4-mcp-server
Add to the MCP client config, for example Claude Desktop's claude_desktop_config.json:
"aranet4": {
"command": "{{PATH_TO_UV}}",
"args": [
"--directory",
"{{PATH_TO_SRC}}/aranet4-mcp-server/",
"run",
"src/server.py"
]
}
Then ask the client to init aranet4 for guided configuration. A Dockerfile is also provided for containerized use, passing the same configuration through environment variables or an updated config.yaml. To keep the local database current without asking manually, a periodic fetch job can be scheduled: on macOS via a LaunchAgent built from the included plist file, or on other platforms by running fetch-job.py on a cron schedule.
Who it's for
Aranet4 owners who want CO2 readings logged, queried, and visualized through an AI assistant, with an optional scheduled job keeping the local database continuously updated.
Source README
aranet4-mcp-server
MCP server to manage your Aranet4 CO2 sensor. Built upon Aranet4-Python.
Features:
- Scan for nearby devices.
- Fetch new data from embedded device memory and save to a local sqlite db for tracking and later viewing. For automatic updates, see at the bottom.
- Ask questions about recent measurements or about a specific past date.
- [For MCP clients that support images] Ask data to be plotted to also have a nice visualization!
- Assisted configuration! 💫 After installation, just ask
init aranet4in your client to set up everything for the mcp server to work with your device.
Requirements
An Aranet4 device already paired. The device uses BLE, so it won't be shown in regular bluetooth search. On MacOS, one way is to install LightBlue from the App Store.
Installation
Clone repo:
git clone git@github.com:diegobit/aranet4-mcp-server.git` cd aranet4-mcp-serverPrepare environment:
- Recommended (with uv): Nothing to do. The provided
pyproject.tomlhandles dependencied and virtual environments. - Alternative (with pip): install with
pip install .
- Recommended (with uv): Nothing to do. The provided
Add to MCP client configuration:
"aranet4": { "command": "{{PATH_TO_UV}}", // run `which uv` "args": [ "--directory", "{{PATH_TO_SRC}}/aranet4-mcp-server/", "run", "src/server.py" ] }- Claude Desktop MacOS config file path:
~/Library/Application Support/Claude/claude_desktop_config.json - Cursor MacOS config file path:
~/.cursor/mcp.json
- Claude Desktop MacOS config file path:
Configure:
- Recommended (AI assisted config!): start your client and ask
init aranet4to get a guided configuration. - Alternative (manual): edit file
config.yaml. You need to provide the mac address and the device name. You can get the mac address witharanetctl --scanfrom Aranet4-Python (installed with this repo dependencies).
- Recommended (AI assisted config!): start your client and ask
Dockerfile
Dockerfile is available. Remember to pass env variables or update config.yaml.
List of tools
Configuration and utils:
init_aranet4_config: assisted configuration of device.scan_devices: scan nearby bluetooth aranet4 devices.get_configuration_and_db_stats: get current config.yaml and general stats from the local sqlite3 db.set_configuration: set values in config.yaml.
To update historical data:
fetch_new_data: fetch new data from configured nearby aranet4 device and save to local db.
To query historical data:
get_recent_data: get recent data from local db. Can specify how many measurements.get_data_by_timerange: get data in specific timerange from local db. Can specify how many measurements (careful, if the range is big and the limit is low, datapoints will be skipped).For both, ask to receive a plot to have it generated and displayed.
Automatic data fetch job
If you want your local db to always be updated, you can setup a cronjob or a launch agent that fetches data automatically every few hours. In MacOS, do as follows:
- Configure absolute paths in
com.diegobit.aranet4-fetch.plist. - Install LaunchAgent:
cp com.diegobit.aranet4-fetch.plist ~/Library/LaunchAgents/ launchctl load ~/Library/LaunchAgents/com.diegobit.aranet4-fetch.plist
For other platforms, just run fetch-job.py periodically however you prefer.
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.