/** * Shared types and the transport abstraction for the Oto plugin. * * IMPORTANT CONTEXT (read docs/OTO_API.md for the full story): * * OtO does NOT publish a public API. Their own support article confirms the * product "does not interface with any other smart home devices", and years of * user requests for an API / HomeKit / MQTT have gone unanswered. * * The official OtO app talks to a Firebase / Google Cloud backend: * - Firebase Authentication (email/password) for login * - Cloud Firestore for device + zone state * - Cloud Functions (HTTPS callable) for commands (start/stop watering) * * Because there is no documented contract, this plugin supports two * interchangeable "transports": * * 1. CloudTransport - speaks to OtO's Firebase backend. Endpoints are the * standard Google ones; the project-specific values (Web API key, * project id, Firestore paths, callable names) must be captured from your * own app traffic. See docs/OTO_API.md. * * 2. LocalTransport - speaks to a device running the community `irrigoto` * ESPHome firmware (https://github.com/rob-farrellrobotics/irrigoto), * which exposes a local HTTP API and removes the cloud dependency. * * Both transports satisfy the same OtoTransport interface, so the rest of the * plugin (platform / accessories) does not care which one is in use. */ export interface OtoController { /** Stable identifier for the device/controller. */ id: string; /** Human-friendly name as shown in the OtO app. */ name: string; /** Hardware serial number, when available. */ serialNumber?: string; /** Online/offline or similar status string, when available. */ status?: string; /** Firmware version string, when available. */ firmwareVersion?: string; } export interface OtoZone { /** Stable identifier for the zone. */ id: string; /** Id of the controller this zone belongs to. */ controllerId: string; /** Human-friendly name as shown in the OtO app. */ name: string; /** Whether the zone is currently watering. */ watering: boolean; /** Free-form status string, when available. */ status?: string; } /** * The contract every transport must implement. Methods are intentionally * narrow: discover controllers, discover their zones, read a single zone's * state, and start/stop watering a zone. */ export interface OtoTransport { /** Establish (or refresh) any session/credentials this transport needs. */ authenticate(): Promise; /** List all controllers (devices) the account/host can see. */ getControllers(): Promise; /** List the zones configured on a given controller. */ getZones(controllerId: string): Promise; /** Read the current state of a single zone. */ getZoneStatus(controllerId: string, zoneId: string): Promise; /** * Start watering a zone for `durationSeconds`. * * Returns the server's estimated runtime for this run, in SECONDS, when the * backend reports one (OTO derives it from watering depth + precipitation * rate). Returns `undefined` when the runtime is unknown or firmware-managed * (e.g. local irrigoto), in which case callers fall back to `durationSeconds`. */ startZone(controllerId: string, zoneId: string, durationSeconds: number): Promise; /** Stop watering a zone. */ stopZone(controllerId: string, zoneId: string): Promise; } /** Which backend the plugin should talk to. */ export type OtoTransportKind = 'cloud' | 'local'; /** * Plugin configuration shared across transports. Only the fields relevant to * the selected transport need to be filled in. */ export interface OtoClientConfig { /** Which transport to use. Defaults to 'cloud'. */ transport?: OtoTransportKind; email?: string; password?: string; /** * Default watering DEPTH in millimetres sent with "Water Now" * (POST /manual-start). OTO's backend converts this to a runtime using the * zone's own precipitation rate — it is a depth, not a duration. The OTO app * uses ~31.75 mm (1.25") for a deep soak. Defaults to 12.7 mm (~0.5"). */ wateringQuantity?: number; /** * Optional per-zone override of `wateringQuantity`, keyed by zoneId. * e.g. { "FhFU1lfRN3IhyxPX": 25.4 } */ wateringQuantities?: Record; /** * @deprecated Hardcoded in the plugin from traffic analysis. Leave unset. */ firebaseApiKey?: string; /** @deprecated Hardcoded in the plugin from traffic analysis. Leave unset. */ firebaseProjectId?: string; /** @deprecated Hardcoded in the plugin from traffic analysis. Leave unset. */ cloudFunctionsRegion?: string; /** * One or more irrigoto device hostnames/IPs (e.g. 'irrigoto-ab12cd.local' * or '192.168.1.50'). Each becomes a controller. */ localDevices?: string[]; /** How often (seconds) to poll device status. */ updateInterval?: number; } //# sourceMappingURL=transport.d.ts.map