Skip to content

Commit af8fdfa

Browse files
committedFeb 18, 2021
irrigation: part 3
1 parent f853159 commit af8fdfa

File tree

2 files changed

+146
-0
lines changed

2 files changed

+146
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
---
2+
title: "DIY Irrigation Controller: Home Assistant Integration"
3+
date: 2021-02-18 9:00:00 -0700
4+
categories: [Project]
5+
tags: [Lovelace, Home Assistant, ESPHome]
6+
seo:
7+
date_modified: 2021-02-18 9:00:00 -0700
8+
image: /assets/img/2021-02-18-irrigation-controller/ui.png
9+
---
10+
11+
## Home Assistant Entities & Simplified User Interface
12+
13+
*Previous articles in this series:*
14+
1. *[DIY Irrigation Controller: Hardware, Electronics, and ESPHome code](../diy-irrigation-controller-esphome-home-assistant/)*
15+
2. *[Lovelace User Interface](../diy-irrigation-controller-lovelace-user-interface-home-assistant/) <- skip this and read the article below instead ;)*
16+
17+
Your many questions helped me realize that I totally dropped the ball when I attempted to share how I
18+
created the Lovelace User Interface (UI) for my DIY Irrigation Project. Not only did I overly complicate
19+
the Lovelace code with custom components, but I also omitted how I created the necessary entities in
20+
Home Assistant.
21+
22+
I now present you with the **simplified and complete** code to properly integrate Home Assistant with
23+
my ESPHome DIY Irritation Controller project.
24+
25+
### Add Supporting Entities
26+
27+
#### Using Helpers Configuration UI
28+
29+
Home Assistant's **Helpers Configuration UI** [introduced in 2020](https://www.home-assistant.io/blog/2020/03/18/release-107/#helpers-configuration-panel)
30+
is the easiest way to add these `input_text` and `input_number` entities. If you choose to go this route the YAML code
31+
below will be a useful reference.
32+
33+
#### Using a "Package" File
34+
35+
I have chosen instead to split my Irrigation Controller entities and automation into a "package file".
36+
37+
1. First we need to create new file named `irrigation.yaml` in your Home Assistant `/config` folder.
38+
2. Copy and paste the following code into this file to get started.
39+
40+
<blockquote>
41+
<i>Note:</i> In this example you will see that I have two irrigation zones configured. If you have more than two zones
42+
you will need to add enough `input_text` and `input_number` entities to accommodate your additional zones.
43+
</blockquote>
44+
45+
```yaml
46+
---
47+
# Lovelace UI to set a list of irrigation cycle times.
48+
input_text:
49+
irrigation_zone1_times:
50+
name: List of Times (eg. 08:00,12:00,15:00)
51+
icon: mdi:clock-outline
52+
irrigation_zone2_times:
53+
name: List of Times (eg. 11:00,15:30)
54+
icon: mdi:clock-outline
55+
56+
# Lovelace UI to set the duration of each irrigation cycle.
57+
input_number:
58+
irrigation_zone1_duration:
59+
name: Duration in Minutes
60+
icon: mdi:timer-sand
61+
min: 0
62+
max: 60
63+
step: 1
64+
unit_of_measurement: "minutes"
65+
66+
irrigation_zone2_duration:
67+
name: Duration in Minutes
68+
icon: mdi:timer-sand
69+
min: 0
70+
max: 60
71+
step: 1
72+
unit_of_measurement: "minutes"
73+
74+
### Optional offline notifications. Uncomment this automation if you'd like an notification
75+
### should the device be disconnected from the network for two hours!
76+
# automation:
77+
# # Warn me if the system ever goes offline for more than two hours!
78+
# - alias: irrigation_system_offline
79+
# initial_state: true
80+
# trigger:
81+
# - platform: state
82+
# entity_id: binary_sensor.irrigation_controller_status
83+
# to: 'off'
84+
# for: '02:00:00'
85+
# action:
86+
# - service: persistent_notification.create
87+
# data:
88+
# title: "Irrigation System Offline"
89+
# message: "The Irrigation System has been offline for 2 hours!"
90+
# notification_id: "offline"
91+
# - service: notify.mobile_app_iphone_brian
92+
# data:
93+
# title: "Irrigation System Offline"
94+
# message: "The Irrigation System has been offline for 2 hours"
95+
```
96+
97+
#### Include the "Package" file in configuration.yaml
98+
99+
<blockquote>
100+
<i>Note:</i> You can skip this section if you are adding the above entities to Home Assistant another way.
101+
</blockquote>
102+
103+
See the [Home Assistant Packages Documentation](https://www.home-assistant.io/docs/configuration/packages/)
104+
for a deeper explanation.
105+
106+
```yaml
107+
homeassistant:
108+
packages:
109+
irrigation: !include irrigation.yaml
110+
```
111+
112+
### Simplified Lovelace User Interface
113+
114+
This version of the interface simply uses the built in Entities Card and optionally a Glance Card.
115+
116+
#### Create Irrigation Zone User Interfaces
117+
118+
You will need to add an Entities Card for each Irrigation Zone.
119+
120+
```yaml
121+
type: entities
122+
entities:
123+
- entity: switch.irrigation_zone1
124+
- entity: sensor.irrigation_zone1_next
125+
name: Next 🕑
126+
- entity: sensor.irrigation_zone1_remaining
127+
name: Remaining ⏳
128+
- entity: input_text.irrigation_zone1_times
129+
- entity: input_number.irrigation_zone1_duration
130+
title: Zone 1
131+
show_header_toggle: false
132+
```
133+
134+
#### Optional: Create Irrigation Controller Status Card
135+
136+
```yaml
137+
type: glance
138+
entities:
139+
- entity: binary_sensor.irrigation_controller_status
140+
name: Status
141+
- entity: sensor.irrigation_controller_uptime
142+
name: Uptime
143+
- entity: sensor.irrigation_controller_wifi_signal
144+
name: WiFi Signal
145+
title: Controller Status
146+
```
Loading

0 commit comments

Comments
 (0)
Please sign in to comment.