-
Notifications
You must be signed in to change notification settings - Fork 2
/
script_refill_tank.yaml
37 lines (37 loc) · 1.19 KB
/
script_refill_tank.yaml
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
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2023 Ilia Sotnikov
---
if:
condition:
lambda: |-
#include "esphome/core/component.h"
return
(${condition})
// Ignore the fragment being triggered during 'sprinkler' component
// setup when its switches are turned off initially (would be redundant)
&& (id(${sprinkler}).get_component_state() & COMPONENT_STATE_LOOP)
// Ignore attempt to refill the tank when it has already been reported
// as empty (would be redundant)
&& !id(${water_tank_empty_id}).state
// Ignore attempt to refill the tank if controller is in standby
&& !id(${sprinkler}).standby();
then:
- logger.log:
format: Triggering water tank refill
tag: ${sprinkler}
level: INFO
- switch.turn_on: ${relay}
- lambda: |-
#ifdef HAS_DISPLAY
if (${display_id}->is_ready()) {
${display_id}->update();
}
#endif
- delay: ${peripherals_power_refill_pulse_duration}
- switch.turn_off: ${relay}
- lambda: |-
#ifdef HAS_DISPLAY
if (${display_id}->is_ready()) {
${display_id}->update();
}
#endif