Add Home Assistant custom integration and ESP availability tracking
- Add custom HA integration (config flow, switch, water_for service) - Add MQTT Last Will & Testament for offline detection - Publish 'online' on successful MQTT connect - Update README with integration docs
This commit is contained in:
@@ -1,15 +1,41 @@
|
||||
# Irrigation with an ESP8266
|
||||
Tested with D1 mini. Connect a pump with a relais. Relais activation on D4.
|
||||
|
||||
## Homeassistant integration
|
||||
payload_on can also contain the duration of the pump in ms.
|
||||
Example:
|
||||
`
|
||||
switch 5:
|
||||
- platform: mqtt
|
||||
command_topic: greenhousino/pump
|
||||
state_topic: greenhousino/pumpstate
|
||||
payload_on: "on"
|
||||
payload_off: "off"
|
||||
name: "Pumpe"
|
||||
`
|
||||
## 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
|
||||
```
|
||||
Reference in New Issue
Block a user