Tested against OpenSprinkler version 2.1.9.
pip install pyopensprinkler
from pyopensprinkler import Controller as OpenSprinklerController
controller = OpenSprinklerController("http[s]://hostname[:port]", "password")
await controller.refresh()
version = controller.firmware_version
All commands are async.
controller.refresh()
Refreshes state, programs and stations
controller.enable()
Enabled controller operation
controller.disable()
Disables controller operation
controller.programs
controller.stations
is_enabled = controller.programs[0].enabled
program = controller.programs[0]
await program.run()
program.enabled
program.enable()
program.disable()
program.run()
is_enabled = controller.stations[0].enabled
status = controller.stations[0].status
station = controller.station[0]
await station.run(120)
station.is_running
station.running_program_id
station.status
station.run(seconds)
Acceptable range for seconds is 0 to 64800 (18 hours)
station.stop()
station.toggle()
OpenSprinkler API documentation available here.
virtualenv .
source bin/activate
# install requirements
pip install -r requirements.txt
# install dev requirements
pip install -r requirements-dev.txt
# one-time install commit hooks
pre-commit install
deactivate