OpenSprinkler › Forums › Hardware Questions › OpenSprinkler Pi (OSPi) › New OpenSprinkler Library Python Package
- This topic is empty.
-
AuthorPosts
-
August 20, 2014 at 1:59 am #23119
3dinfluenceMemberI’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,
DavidAugust 20, 2014 at 2:20 pm #27881
scottshParticipantThat’s really interesting David – I look forward to seeing what comes from having a library like this to build on top of.
August 21, 2014 at 5:28 am #27882
LambyParticipantSounds good. Let me try tonight
August 22, 2014 at 3:20 am #27883
3dinfluenceMember@scottsh wrote:
That’s really interesting David – I look forward to seeing what comes from having a library like this to build on top of.
I have my own plans on building stuff on top of this but this was the first step. Hopefully it will lower the barrier of entry for others as well.
—
David -
AuthorPosts
- You must be logged in to reply to this topic.
OpenSprinkler › Forums › Hardware Questions › OpenSprinkler Pi (OSPi) › New OpenSprinkler Library Python Package