OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) New OpenSprinkler Library Python Package

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #23119

    3dinfluence
    Member

    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

    #27881

    scottsh
    Participant

    That’s really interesting David – I look forward to seeing what comes from having a library like this to build on top of.

    #27882

    Lamby
    Participant

    Sounds good. Let me try tonight

    #27883

    3dinfluence
    Member

    @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

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) New OpenSprinkler Library Python Package