pyrainbird-iq4
Asynchronous Python library for Rain Bird IQ4 irrigation controllers. It reads controller, station and program configuration from the IQ4 cloud, and reads live state from — and starts or stops watering on — the controller over its local network interface.
It is the protocol layer behind the rainbird_iq4 Home Assistant custom integration, and
can be used on its own.
Not affiliated with Rain Bird. The IQ4 cloud endpoints and the local protocol behaviour described here are observed, not vendor-documented, and may change. Start and stop commands physically control irrigation.
Installation
pip install pyrainbird-iq4
Requires Python 3.13 or newer.
Cloud: controllers, stations and programs
import aiohttp
from pyrainbird_iq4.cloud.auth import authenticate
from pyrainbird_iq4.cloud.client import RainBirdIQ4CloudClient
async def main() -> None:
token = await authenticate("you@example.com", "iq4-password")
async with aiohttp.ClientSession() as session:
client = RainBirdIQ4CloudClient(token, session=session)
for controller in await client.get_controllers():
for station in await client.get_stations(controller.id):
print(controller.name, station.terminal, station.name, station.is_enabled)
Other calls include get_programs, get_scheduled_start_times, get_station_runtimes
and get_connection_statuses. Sign-in can be blocked by the IQ4 web application
firewall; this raises RainBirdIQ4WAFChallengeError, while rejected credentials raise
RainBirdIQ4CredentialsError.
Station.is_enabled is True, False or None (unknown). It is derived from IQ4's
isLocked flag, which — counterintuitively — is true for enabled stations.
Local: live state and control
import aiohttp
from pyrainbird_iq4 import RainBirdIQ4LocalClient
async def main() -> None:
async with aiohttp.ClientSession() as session:
client = await RainBirdIQ4LocalClient.connect(session, "192.0.2.10", "123456")
state = await client.get_realtime_state() # active terminals and current queue
print(state.state, state.active_terminals, state.remaining_runtime_seconds)
# Irrigation enabled, terminal capacity, rain sensor and rain delay.
slow = await client.get_slow_state()
print(slow.rain_sensor_active, slow.rain_delay_days)
The password is the controller-local password set during provisioning (the six-digit PIN on Rain Bird 2.0 setups), not the IQ4 cloud password. The controller uses a self-signed certificate; each request uses a fresh HTTPS connection.
available_terminals is the controller's physical terminal capacity, not a list of
enabled stations — use the cloud Station.is_enabled for that.
Starting and stopping
await client.start_station(terminal=1, duration_minutes=5) # 1-30 minutes
started = await client.wait_for_station_active(1) # up to 5 read-only checks
await client.stop_irrigation()
stopped = await client.wait_for_idle()
Each call sends exactly one command and never retries. A successful return means the
controller acknowledged the command, not that water is flowing; the wait_for_*
helpers confirm it with read-only polls. If a command raises a timeout or connection
error, the controller may or may not have acted — check its state before sending
anything again. The library validates argument types and ranges only; deciding whether
a station may be started (enabled, idle, rain) is up to the caller.
Command-line diagnostics
rainbird-iq4-diagnostic # cloud: sites, controllers, stations, programs
rainbird-iq4-local-diagnostic 192.0.2.10 # local: read-only live state
rainbird-iq4-local-diagnostic 192.0.2.10 --check-control-support
Both prompt for credentials and print no secrets. The local diagnostic's write test
requires an explicit confirmation flag and physically waters a station; see --help.
Compatibility
Tested with an IQ4-connected controller on firmware 3.11.0. Other controllers and
firmware versions may respond differently, particularly to the reverse-engineered
CurrentQueueRequest used for queue and remaining-runtime data.
Development
pip install -e ".[dev]"
pytest && ruff check . && ruff format --check . && mypy src
License
MIT
Metadata
Release files for pyrainbird-iq4 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyrainbird_iq4-0.1.1.tar.gz | 40.6 kB | With provenance | Details for pyrainbird_iq4-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyrainbird_iq4-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for pyrainbird_iq4-0.1.1-py3-none-any.whl |
Total release size: 67.6 kB
Release files / pyrainbird_iq4-0.1.1.tar.gz
| Download URL | pyrainbird_iq4-0.1.1.tar.gz |
|---|---|
| Size | 40.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9258aae0594053fce23dc046c7d7f08af93fd0424209afc319b87de3f67ea172
|
|
BLAKE2b-256 checksum How to use checksums |
f1d0ec2f698ae1717158d74f8e34cfc0fe7e2b6913aacc3ff7420754bc9402ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.
Transparency logRelease files / pyrainbird_iq4-0.1.1-py3-none-any.whl
| Download URL | pyrainbird_iq4-0.1.1-py3-none-any.whl |
|---|---|
| Size | 27.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
15bbd3248d81c78caa3ace53d8104d0ed09ea0d29c6705c1e004111beaa979b3
|
|
BLAKE2b-256 checksum How to use checksums |
01df586b325f6ddc8f56a38c255f992331f07e28f6f6c7e8a4f2827f33d50c89
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.
Transparency logSecurity for pyrainbird-iq4 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for pyrainbird_iq4-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.