I’m new here and this is my first post to the forum.
I just published a python library I’ve been working on for interacting with the OSPi and OSBo. You can find the source code on github and it’s in pypi so you can just “pip install opensprinklerlib” to install it. I also have a repo for some demo apps using the opensprinklerlib that currently has a port of the gcalendar.py script if someone wants a more complete example of using the library.
I’m hoping that others will find this useful and would love any feedback that anyone can provide. One immediate need that I have is some testing on the OSBo as I only have an OSPi.
Current Features
- It auto-detects the hardware platform and falls back to a mock controller class so that you can easily develop and test code on any system.
- Supports loading and retrieving the running configuration
- master stations on a per station basis
Using it looks something like this.
config.json
{
"stations": [
{
"id": 1,
"name": "Front Center",
"description": "Front Yard around flower garden. 2 Sprinkler heads.",
"type": "zone"
},
{
"id": 2,
"name": "Front Perimeter",
"description": "Front Yard along road. 3 Sprinkler heads",
"type": "zone"
}
]
}
#!/usr/bin/env python
from opensprinklerlib import OpenSprinkler
import time
controller = OpenSprinkler()
controller.load_config(open("config.json").read())
controller.enable_station(1)
time.sleep(60)
controller.disable_station(1)
Thanks,
David