Core Python library for the Grootfarm platform.
Project description
grootfarm-lib
Core Python library for the Grootfarm platform.
grootfarm-lib provides helper modules to work with brokers, sensors,
wellbeing rules, and database operations in Grootfarm services.
Install
pip install grootfarm
Quick Start
import grootfarm
from grootfarm.broker import Broker
print(grootfarm.__version__)
Main Components
Sensor
from grootfarm.sensor import Sensor
sensor = Sensor("temperature", "celsius", -60, 60)
sensor.set_type("temperature")
print(sensor.get_range()) # (-60, 60)
Wellbeing Rules
from grootfarm.sense import PlantFacts
facts = PlantFacts(
"temperature",
sensor_range=(-60, 60),
plant_range=(20, 25),
tolerance=5,
)
print(facts.get_wellbeing(24))
# {'status': 'good', 'comparison': 'good'}
Message Processing
from grootfarm.utils import Utils
raw = '{"timestamp":"2026-07-07T10:00:00Z","type":"temperature","value":23,"name":"sensor-a"}'
msg = Utils.process_message(raw)
print(msg)
SQLite Configuration Database
from grootfarm.db import SQLite3
db = SQLite3(":memory:")
db.connect()
db.add_metric("2026-07-07T10:00:00Z", "temperature", 23)
print(db.get_metric("temperature"))
db.close()
Development
Run tests:
PYTHONPATH=src python -m pytest -q
Modules
grootfarm.brokergrootfarm.dbgrootfarm.sensegrootfarm.sensorgrootfarm.utils
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
grootfarm-0.1.0.tar.gz
(14.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
grootfarm-0.1.0-py3-none-any.whl
(14.0 kB
view details)
File details
Details for the file grootfarm-0.1.0.tar.gz.
File metadata
- Download URL: grootfarm-0.1.0.tar.gz
- Upload date:
- Size: 14.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc6dbdf2d9cb0800aa5c704f4b79b99b105ed918c7d9badaaec3479ad683b451
|
|
| MD5 |
3affaf43be575336dbc22f2fbacd8ec0
|
|
| BLAKE2b-256 |
0e829406e2294231e6e2cf7da1a0a72a5c277f55611a29e1520a54371da7f834
|
File details
Details for the file grootfarm-0.1.0-py3-none-any.whl.
File metadata
- Download URL: grootfarm-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4575e25852e7f65a730cbfdeb8363e8a11f35f5ff0f936cf688980297564f2bb
|
|
| MD5 |
144f9ea7a0cce37f756e1439b6b3e370
|
|
| BLAKE2b-256 |
807f4c9bc8a23c9ad53d214c87eae60b8af5ffd192ca2959cb80d169b0dead69
|