Skip to main content

aiogeodrops

Async Python client for GeoDrops soil-probe readings.

GeoDrops publishes every probe's readings to a public Google BigQuery table. This library queries it over BigQuery's REST API with a Google service account. It is built on aiohttp and PyJWT only (no Google Cloud SDK, no gRPC), takes your aiohttp.ClientSession, and is fully typed.

It is the library behind the GeoDrops Home Assistant integration.

Install

pip install aiogeodrops

Prerequisites

A Google Cloud project of your own (queries run and are billed there, well within BigQuery's free tier for a handful of probes), with the BigQuery API enabled, and a service account that has BigQuery Job User on that project. Download a JSON key for the service account.

Usage

import asyncio
from pathlib import Path

import aiohttp

from aiogeodrops import GeoDropsClient


async def main() -> None:
    key = Path("service-account.json").read_text()
    async with aiohttp.ClientSession() as session:
        client = GeoDropsClient(session, "my-gcp-project", key)

        await client.validate_access()

        # Find a probe's device id from the serial shown in the GeoDrops app.
        reading = await client.lookup_serial("AAA111", lookback_hours=12)
        if reading is None:
            print("No reading in the last 12 hours")
            return

        latest = await client.fetch_latest([reading.device_id], lookback_hours=12)
        probe = latest[reading.device_id]
        print(probe.moisture_pct, probe.temp_surface, probe.read_at)


asyncio.run(main())

fetch_latest makes one query for all the device ids you pass. Each query gives up after 60 seconds (query_timeout= to change).

fetch_battery_history(device_ids, days) returns each probe's battery voltage readings over the last days days, oldest first, as BatteryPoint(read_at, battery_mv): about 48 a day per probe, in one query. Use it to judge how fast a battery is draining.

When GeoDrops changes its table

GeoDrops' table is theirs to change, and columns have been renamed or dropped before. Before querying, the client reads which columns exist (a free metadata call, repeated at most every 6 hours) and selects only those:

  • A missing column leaves the reading fields it fed as None (or UNCLASSIFIED). client.missing_columns lists them, and one warning is logged.
  • If a query still names an unknown column, the columns are re-read and the query retried once.
  • GeoDropsSchemaError is raised only when a column the query can't run without is gone: deviceId, date, createdAtOrigin, mfgSn for lookup_serial, and deviceBattMV for fetch_battery_history.

await client.table_columns() lists every column GeoDrops publishes.

Errors

All errors derive from GeoDropsError:

Exception Meaning What to do
GeoDropsCredentialsError The key isn't a usable service-account key Fix the key; raised by the constructor
GeoDropsAuthError Google rejected the key (deleted, revoked, account disabled) Create a new key
GeoDropsAccessDeniedError 403: missing BigQuery Job User role, or BigQuery API not enabled Fix it in Google Cloud; then retry
GeoDropsSchemaError GeoDrops' table lost a column the query can't run without Update aiogeodrops
GeoDropsQueryError BigQuery rejected the query (parent of GeoDropsAccessDeniedError and GeoDropsSchemaError) Check the project id
GeoDropsConnectionError Network error, timeout, Google outage, rate or quota limit Retry later

Development

pip install -e ".[dev]"
ruff check . && ruff format --check .
mypy
pytest --cov=aiogeodrops

Releases are published to PyPI by GitHub Actions when a GitHub release is published, using PyPI trusted publishing (no stored token) with attestations.

License

MIT

Metadata

Release files for aiogeodrops 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiogeodrops 0.4.1
File Size Uploaded Provenance
aiogeodrops-0.4.1.tar.gz 28.6 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for aiogeodrops 0.4.1
File Interpreter ABI Platform
aiogeodrops-0.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 46.5 kB

Release files / aiogeodrops-0.4.1.tar.gz

Download URL aiogeodrops-0.4.1.tar.gz
Size 28.6 kB
Tags Source
SHA-256 checksum
How to use checksums
91ef19ce823b91e7af32a0a224430e613a93e9fbf07a9d5dfe58ca0dc61bb544
BLAKE2b-256 checksum
How to use checksums
d38a111a06adb4afd96feee5d0ad3ec53d4d04212f6e897eceff377ad22b38fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Release files / aiogeodrops-0.4.1-py3-none-any.whl

Download URL aiogeodrops-0.4.1-py3-none-any.whl
Size 18.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e0dd66465c99e6940d4f10600c16eda4d030926ade0ab430ba332b51f5529071
BLAKE2b-256 checksum
How to use checksums
1e435178634d3de7b786b9920f651eb6a4b5573c7d614bccf007de3641314572
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Security for aiogeodrops 0.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for aiogeodrops-0.4.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page