Skip to main content

nuasense

NuaSense for Python: what your weather station means for house, garden and farm. Frost tonight, how much to water today, the next calm and dry spray window, and a plausibility check of your sensor. Send readings from any station you build (a Raspberry Pi with a BME280, an ESP32, a rain gauge on a GPIO pin), and read East African farm and market data.

pip install nuasense

Standard library only, Python 3.9 or newer, so it runs on any Raspberry Pi.

Send readings from your own station

In the console at platform.nuasense.com: External stations → Add a station, pick Home Assistant / weewx / Meteobridge / Node-RED, and copy the token after /station/ on the last screen. Sending needs no API key. The first three stations on an account are free.

import nuasense

nuasense.send_reading(
    "kw7n-4hpd-x2vt",        # your station token
    device_id="garden-pi",   # any stable name for this device
    temperature=21.4,        # °C
    humidity=63,             # %
    pressure=1013.2,         # hPa
    wind_speed=2.1,          # m/s (wind_unit="kmh" for km/h)
    wind_direction=270,      # degrees
    rain_total=12.2,         # mm, a counter that only grows
    solar=412,               # W/m² (or lux=...)
)

Every value is optional; send what your station measures.

Raspberry Pi with a BME280

import time

import board
from adafruit_bme280 import basic as adafruit_bme280  # pip install adafruit-circuitpython-bme280

import nuasense

TOKEN = "kw7n-4hpd-x2vt"
bme = adafruit_bme280.Adafruit_BME280_I2C(board.I2C())

while True:
    nuasense.send_reading(
        TOKEN,
        device_id="garden-pi",
        temperature=bme.temperature,
        humidity=bme.relative_humidity,
        pressure=bme.pressure,
    )
    time.sleep(300)

What your station means: frost, watering, spray window

Reading needs an API key: in the console under API Keys, verify your phone (a code by SMS or WhatsApp), then create a key. It is shown once. Keep it in an environment variable, not in your code.

import nuasense

ns = nuasense.Client()   # reads NUASENSE_API_KEY

for station in ns.stations()["stations"]:
    print(station["station_id"], station["name"], station["last_seen_at"])

look = ns.first_look("garden-west")      # a station_id from stations() or the console
print(look["tonight"]["frost"], look["tonight"]["low_c"])   # e.g. "none", 7.8
print(look["garden"]["watering"]["need_mm"]["lawn"])        # mm to water today

The watering need already subtracts the rain of the last 24 hours and the rain forecast for the next 24 hours, so on a day with rain coming it is 0.

Farm and market data

ns = nuasense.Client()

ns.catalog()   # every dataset, its fields and filters your key reaches

prices = ns.rows("/market/prices", start="-14d", county="nakuru", commodity="maize")

import pandas as pd       # optional
df = pd.DataFrame(prices)

ns.analysis("/fertilizer/rank", county="nakuru")   # where fertilizer is cheapest

dataset() returns the whole answer (rows plus what the call cost); rows() returns only the rows. Options: start, end, limit, every with agg, fields, oldest_first; filters as keyword arguments.

Market data needs no station. The datasets cover Kenya, Tanzania, Uganda and Rwanda: county crop and input prices, satellite demand, food security, rainfall against normal.

Errors

Every refusal raises nuasense.NuaSenseError with .status, .body and, on 429, .retry_after. The message says what to do: 401 a key, 402 credit, 403 scope or a station that is not yours, 429 wait.

Your data

When you connect a station, NuaSense stores its readings and computes your forecast, spray windows and risks from them. The readings are used aggregated and anonymised to improve forecasts and models for everyone; they are never passed on individually without your opt-in. You can disconnect the station in the console at any time and have all its data deleted.

Development

python -m unittest discover -s tests (with PYTHONPATH=src). Releases: bump src/nuasense/_version.py and CHANGELOG.md, push a tag vX.Y.Z; GitHub Actions tests, builds and publishes to PyPI by Trusted Publishing.

License

MIT

Metadata

Release files for nuasense 0.1.0

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

Source distribution (sdist)

Source distribution for nuasense 0.1.0
File Size Uploaded Provenance Actions
nuasense-0.1.0.tar.gz 12.9 kB With provenance Details for nuasense-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 24.7 kB

Release files / nuasense-0.1.0.tar.gz

Download URL nuasense-0.1.0.tar.gz
Size 12.9 kB
Tags Source
SHA-256 checksum
How to use checksums
5c3dab4ca594d0fddc304c7a04ee9ecbdf318cb61a3633c5467dcdf03e556456
BLAKE2b-256 checksum
How to use checksums
a9fb43e3054d017452628b4c5bdbfe5ce70a6a99e786e76fcf9bf9aaddc3c659
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 15, 2026.

Transparency log

Release files / nuasense-0.1.0-py3-none-any.whl

Download URL nuasense-0.1.0-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d1b10de9d11fb9e286294186dfb77959d7b255747c9ab265f0edbb2f271a5b28
BLAKE2b-256 checksum
How to use checksums
381f99cc82aec731700f1afcedc1c5bee1823f9f78c9a5208c7804c2e3bdc4ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 15, 2026.

Transparency log

Security for nuasense 0.1.0

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for nuasense-0.1.0.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 Nov 15, 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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