Disclosure: This article may contain affiliate links. If you decide to make a purchase, I'll make a small commission at no extra cost to you.
Articles in this series:
- Hardware, Electronics, and ESPHome code
- Lovelace User Interface
- Entities & Simplified User Interface
Home Assistant Entities & Simplified User Interface
Your many questions helped me realize that I totally dropped the ball when I attempted to share how I created the Lovelace User Interface (UI) for my DIY Irrigation Project. Not only did I overly complicate the Lovelace code with custom components, but I also omitted how I created the necessary entities in Home Assistant.
I now present you with the simplified and complete code to properly integrate Home Assistant with my ESPHome DIY Irritation Controller project.
Add Supporting Entities
Using Helpers Configuration UI
Home Assistant’s Helpers Configuration UI introduced in 2020 is the easiest way to add these
input_number entities. If you choose to go this route the YAML code below will be a useful reference.
Using a “Package” File
I have chosen instead to split my Irrigation Controller entities and automation into a “package file”.
- First we need to create new file named
irrigation.yamlin your Home Assistant
- Copy and paste the following code into this file to get started.
Note: In this example you will see that I have two irrigation zones configured. If you have more than two zones you will need to add enough `input_text` and `input_number` entities to accommodate your additional zones.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 --- # Lovelace UI to set a list of irrigation cycle times. input_text: irrigation_zone1_times: name: List of Times (eg. 08:00,12:00,15:00) icon: mdi:clock-outline irrigation_zone2_times: name: List of Times (eg. 11:00,15:30) icon: mdi:clock-outline # Lovelace UI to set the duration of each irrigation cycle. input_number: irrigation_zone1_duration: name: Duration in Minutes icon: mdi:timer-sand min: 0 max: 60 step: 1 unit_of_measurement: "minutes" irrigation_zone2_duration: name: Duration in Minutes icon: mdi:timer-sand min: 0 max: 60 step: 1 unit_of_measurement: "minutes" ### Optional offline notifications. Uncomment this automation if you'd like an notification ### should the device be disconnected from the network for two hours! # automation: # # Warn me if the system ever goes offline for more than two hours! # - alias: irrigation_system_offline # initial_state: true # trigger: # - platform: state # entity_id: binary_sensor.irrigation_controller_status # to: 'off' # for: '02:00:00' # action: # - service: persistent_notification.create # data: # title: "Irrigation System Offline" # message: "The Irrigation System has been offline for 2 hours!" # notification_id: "offline" # - service: notify.mobile_app_iphone_brian # data: # title: "Irrigation System Offline" # message: "The Irrigation System has been offline for 2 hours"
Include the “Package” file in configuration.yaml
Note: You can skip this section if you are adding the above entities to Home Assistant another way.
See the Home Assistant Packages Documentation for a deeper explanation.
1 2 3 homeassistant: packages: irrigation: !include irrigation.yaml
Simplified Lovelace User Interface
This version of the interface simply uses the built in Entities Card and optionally a Glance Card.
Create Irrigation Zone User Interfaces
You will need to add an Entities Card for each Irrigation Zone.
1 2 3 4 5 6 7 8 9 10 11 type: entities entities: - entity: switch.irrigation_zone1 - entity: sensor.irrigation_zone1_next name: Next 🕑 - entity: sensor.irrigation_zone1_remaining name: Remaining ⏳ - entity: input_text.irrigation_zone1_times - entity: input_number.irrigation_zone1_duration title: Zone 1 show_header_toggle: false
Optional: Create Irrigation Controller Status Card
1 2 3 4 5 6 7 8 9 type: glance entities: - entity: binary_sensor.irrigation_controller_status name: Status - entity: sensor.irrigation_controller_uptime name: Uptime - entity: sensor.irrigation_controller_wifi_signal name: WiFi Signal title: Controller Status