Skip to main content

Barebones Bleak-based client for the Aranet4 sensor

Project description

Tests PyPI version

ClAranet4

Ultra-minimal (i.e. incomplete) Python & CLI client for collecting current readings from Aranet4 Bluetooth sensors. This client uses Bleak and should work across platforms, and has been tested on Intel and ARM64 Macs. An xbar plugin for displaying measurements in the MacOS menu bar is included.

screenshot

Install

# Python >= 3.10, setuptools >= 64
pip install claranet4

# Development
git clone https://github.com/bede/claranet4.git
pip install --editable ./claranet4
pip install pytest build black pre-commit

Alternatively, use the static binary built from the latest release

CLI usage

% claranet4 --help
usage: claranet4 [-h] [--version] {scan,discover,read} ...

positional arguments:
  {scan,discover,read}
    scan                Show nearby Bluetooth devices
    discover            Discover nearby Aranet4 devices
    read                Request latest measurements from a nearby Aranet4 device

options:
  -h, --help            show this help message and exit
  --version             show program's version number and exit

Enumerate nearby Aranet4 devices

% claranet4 discover
INFO: Found 9 device(s)
INFO: Found 1 Aranet4 device(s)
[
    {
        "address": "390F544C-F0FF-F8BE-3A3A-BB1219AA2145",
        "name": "Aranet4 1D6BA",
        "rssi": -71
    }
]

Request measurements from an Aranet4 by address. If the device is unpaired, a prompt should appear for the pairing code.

% claranet4 read 390F544C-F0FF-F8BE-3A3A-BB1219AA2145
INFO: Selected Aranet4 1D6BA (-74dBm)
{
    "name": "Aranet4 1D6BA",
    "address": "390F544C-F0FF-F8BE-3A3A-BB1219AA2145",
    "rssi": -74,
    "co2": 946,
    "temperature": 17.6,
    "pressure": 1002.1,
    "humidity": 73.4
}

Executing claranet4 read without specifying an address will request measurements from the Aranet4 with the highest received signal strength (RSSI)

% claranet4 read
INFO: Found 9 device(s)
INFO: Found 1 Aranet4 device(s)
INFO: Selected Aranet4 1D6BA (-74dBm)
{
    "name": "Aranet4 1D6BA",
    "address": "390F544C-F0FF-F8BE-3A3A-BB1219AA2145",
    "rssi": -74,
    "co2": 946,
    "temperature": 17.6,
    "pressure": 1002.1,
    "humidity": 73.4
}

API usage

>>> from claranet4.lib import discover_ara4s, read
>>> discover_ara4s()
INFO: Found 28 device(s)
INFO: Found 1 Aranet4 device(s)
[Device(address='390F544C-F0FF-F8BE-3A3A-BB1219AA2145', name='Aranet4 1D6BA', rssi=-70)]
>>> read("390F544C-F0FF-F8BE-3A3A-BB1219AA2145").__dict__
INFO: Selected Aranet4 1D6BA (-74dBm)
{'name': 'Aranet4 1D6BA', 'address': '390F544C-F0FF-F8BE-3A3A-BB1219AA2145', 'rssi': -74, 'co2': 715, 'temperature': 20.4, 'pressure': 991.4, 'humidity': 63.4}

MacOS menu bar usage

  1. Install xbar (https://github.com/matryer/xbar).
  2. Download the MacOS executable for the latest release of Claranet4 https://github.com/bede/claranet4/releases).
  3. Download the xbar plugin claranet4.2m.sh from the xbar directory of this repository. Change the path at the bottom of this file to point to wherever your executable is stored.
  4. Open xbar, and open your plugins folder. Put claranet4.2m.sh inside it.
  5. Open System Preferences -> Security and Privacy and grant xbar permissions for Bluetooth, Automation and Developer Tools.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

claranet4-0.2.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

claranet4-0.2.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file claranet4-0.2.0.tar.gz.

File metadata

  • Download URL: claranet4-0.2.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.0

File hashes

Hashes for claranet4-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c25c5b56910e6ef903b42b2ee1e1f06d15619fe960b43c661403d41e344fcf50
MD5 b661b1b33d86689fb7a23afbf9cccdf4
BLAKE2b-256 41c4a084fa1bcbd939e2b6d8ca0a811f16fd8a09e96b4713e3b7022274d1ba05

See more details on using hashes here.

File details

Details for the file claranet4-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: claranet4-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.0

File hashes

Hashes for claranet4-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3adf2773ac87aeddc930746b8f5874287d52a5197837fcd2102838a2e58adc08
MD5 5f9806863dd2a44dc417ae1bf616083f
BLAKE2b-256 80122fa5689ad51b29b2cb12c404d3fe33fc48e22e0d2115e6c9e0b646d69d0f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page