nuasense
NuaSense for Python: what your sensors mean 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 anything you build (a Raspberry Pi with a BME280, soil moisture probes, a water level sensor, a beehive scale, a cold room), 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 a sensor you built
In the console at platform.nuasense.com: External stations → Add a station → I built it myself, 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(
"kw7n-4hpd-x2vt", # your station token
"garden-pi", # any name for this device; binds the token to it
temperature=21.4, # °C
humidity=63, # %
pressure=1013.2, # hPa at the station
rain_mm=0.2, # mm since the previous reading
soil_moisture=34, # % vol
soil_moisture_2=41.5, # a second probe: _2 … _8
soil_temperature=18.2, # °C
)
Send what your sensors measure, every few minutes. The names and units are NuaSense's own, the same as for the Arduino, ESPHome, MicroPython and Tasmota code:
| group | fields (unit) |
|---|---|
| weather | temperature (°C) · humidity (%) · pressure (hPa) · light (lux) · wind_speed, wind_gusts (m/s) · wind_direction (°) · rain_mm (mm since the previous reading) · uv_index · leaf_wetness (%) |
| soil | soil_moisture (% vol) · soil_temperature (°C) · soil_ec (mS/cm) · soil_tension (kPa) · soil_ph · probe_temperature (°C) |
| water | water_level (m) · water_temperature (°C) · water_ec (mS/cm) · water_ph · dissolved_oxygen (mg/L) · turbidity (NTU) · flow_rate (L/min) · water_pressure (bar) |
| greenhouse, plant | greenhouse_temperature (°C) · greenhouse_humidity (%) · co2 (ppm) · par (µmol/m²/s) · leaf_temperature (°C) · stem_diameter (µm) |
| livestock, beehive | ammonia (ppm) · hive_weight (kg) · hive_temperature (°C) · hive_humidity (%) |
| storage, cold chain | storage_temperature (°C) · storage_humidity (%) · ethylene (ppm) · grain_moisture (%) · grain_temperature (°C) · door_open (0/1) |
| air, energy, transport | pm1, pm25, pm10 (µg/m³) · voc_index · battery_voltage (V) · battery_percent (%) · power, pv_power (W) · gps_latitude, gps_longitude (°) · gps_speed (km/h) |
A misspelt name raises at once (NuaSense has no field "soil_moistur". Did you mean soil_moisture?). A value outside its range, usually a sensor fault such as a DS18B20 reading -127, is left out and listed under "skipped" in the answer, so your loop keeps running.
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:
try:
nuasense.send(
TOKEN,
"garden-pi",
temperature=bme.temperature,
humidity=bme.relative_humidity,
pressure=bme.pressure,
)
except nuasense.NuaSenseError as err: # offline, or the token is wrong
print(err)
time.sleep(300)
Bridging a weather console
nuasense.send_reading(token, device_id=..., temperature=..., rain_total=...) sends the form a weather console sends (Ecowitt format, rain as a running total). Use it when you forward a console's values; pick Home Assistant / weewx / Meteobridge / Node-RED in the console. For anything you build, send() is the better fit.
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.
Links
- Docs for developers and agents: https://api.nuasense.com/index.md
- OpenAPI: https://api.nuasense.com/openapi.json
- Console: https://platform.nuasense.com
- Other packages: Home Assistant, Node-RED, weewx, n8n
- Issues: https://github.com/nuasense/nuasense-python/issues · info@nuasense.com
Development
python -m unittest discover -s tests (with PYTHONPATH=src). src/nuasense/reading.schema.json is a copy of station-schema's nuasense-reading.schema.json; update both together. 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.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nuasense-0.2.0.tar.gz | 19.2 kB | With provenance | Details for nuasense-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nuasense-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for nuasense-0.2.0-py3-none-any.whl |
Total release size: 36.8 kB
Release files / nuasense-0.2.0.tar.gz
| Download URL | nuasense-0.2.0.tar.gz |
|---|---|
| Size | 19.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
12074c7fd6c10b4c2311fa9be1269d04c1f8ef1858c59a2368b7d2f24b9cdc26
|
|
BLAKE2b-256 checksum How to use checksums |
00a5f9291d7d2adfcd5e8adc11325478c48ea13c261500ec0a2e4dcc30c23d78
|
| 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 16, 2026.
Transparency logRelease files / nuasense-0.2.0-py3-none-any.whl
| Download URL | nuasense-0.2.0-py3-none-any.whl |
|---|---|
| Size | 17.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d66588fca1edda3a9ab02587e5c0ef15aa5e05e0764caa00d400eea17877700f
|
|
BLAKE2b-256 checksum How to use checksums |
b6b3a9f1e158741af6e1317931ef74e286e5d5380b1db221f39556c94cba3751
|
| 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 16, 2026.
Transparency logSecurity for nuasense 0.2.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.
Attestation for nuasense-0.2.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 16, 2026.
Transparency logA 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.