# Irrigation with an ESP8266 Tested with D1 mini. Connect a pump with a relais. Relais activation on D4. ## Home Assistant Integration ### Custom Integration (recommended) A full custom integration with config flow, device registry, and a `water_for` service is included in the [`homeassistant/`](homeassistant/) directory. See [homeassistant/README.md](homeassistant/README.md) for installation and usage. ### YAML-only (built-in MQTT platform) `payload_on` can also contain the duration of the pump in ms. ```yaml switch: - platform: mqtt name: "Irrigation Pump" command_topic: greenhousino/pump state_topic: greenhousino/pumpstate payload_on: "on" payload_off: "off" state_on: "on" state_off: "off" availability_topic: greenhousino/pump/status payload_available: "online" payload_not_available: "offline" qos: 1 ``` For duration-based watering via YAML, use an automation: ```yaml automation: - alias: "Water for 5 minutes" action: - service: mqtt.publish data: topic: greenhousino/pump payload: "300000" # 300000 ms = 5 minutes ```