Skip to main content

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.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyrainbird-iq4 0.1.0
File Size Uploaded Provenance Actions
pyrainbird_iq4-0.1.0.tar.gz 39.0 kB With provenance Details for pyrainbird_iq4-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyrainbird-iq4 0.1.0
File Interpreter ABI Platform Actions
pyrainbird_iq4-0.1.0-py3-none-any.whl Python 3 none any Details for pyrainbird_iq4-0.1.0-py3-none-any.whl

Total release size: 65.5 kB

Release files / pyrainbird_iq4-0.1.0.tar.gz

Download URL pyrainbird_iq4-0.1.0.tar.gz
Size 39.0 kB
Tags Source
SHA-256 checksum
How to use checksums
59750542d55788aaf8bae5bbaa00c609ef3222e7e2c949c52220716c8f47f26f
BLAKE2b-256 checksum
How to use checksums
44562c1b90f7d44be957e8884c2f3caa00d50bb28ec0cf033d6c664606865dc1
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 12, 2026.

Transparency log

Release files / pyrainbird_iq4-0.1.0-py3-none-any.whl

Download URL pyrainbird_iq4-0.1.0-py3-none-any.whl
Size 26.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
521072bd3c1789fd334b42e14882309de73ab20b317219c01130efbc42156394
BLAKE2b-256 checksum
How to use checksums
39e77787489f29f7db26cdf05744b420ac1194dcd072a722238f12a439e8346b
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 12, 2026.

Transparency log

Security for pyrainbird-iq4 0.1.0

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.

Select from 2 files

Attestation for pyrainbird_iq4-0.1.0.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 12, 2026.

Transparency log

A 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page