-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwaterlock.yaml
124 lines (101 loc) · 2.65 KB
/
waterlock.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# Управление шаровым краном с электроприводом
# Используется модуль с реле
# ___
# | |Реле1 Реле2
# Кран |_Открыть (красный)___________| \|
# |_Закрыть (синий)_______________ \_____________/____> L
# |_Общий________> N
#
# В течение 30 секунд подает на нужный провод крана фазу.
esphome:
name: waterlock
esp32:
board: esp32dev
framework:
type: arduino
substitutions:
device_name: "waterlock"
# включаем отладку для поиска причины перезагрузки через лог
#debug:
# Enable logging
logger:
# level: VERY_VERBOSE
# baud_rate: 0
# Enable Home Assistant API
api:
ota:
# Set statul led for Wemos D1 mini
#status_led:
# pin:
# number: GPIO2
# inverted: true
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "${device_name} Hotspot"
password: !secret ota_pass
captive_portal:
# Enable web server (can be disabled)
web_server:
port: 80
time:
- platform: sntp
id: sntp_time
timezone: "Europe/Moscow"
on_time: # ночью
- seconds: 0
minutes: 30
hours: 2
days_of_week: WED # по средам
then:
- if:
condition:
switch.is_on: water_switch # Если кран открыт
then:
- switch.turn_off: water_switch # закрываем на минуту
- delay: 60s
- switch.turn_on: water_switch
#------------
switch:
- platform: gpio
internal: true
name: "Relay 1"
id: switch1
pin: GPIO16
- platform: gpio
internal: true
name: "Relay 2"
id: switch2
pin: GPIO17
# - platform: gpio
# name: "Relay 3"
# internal: true
# pin: GPIO18
# - platform: gpio
# name: "Relay 4"
# internal: true
# pin: GPIO19
- platform: template
name: "Подача Воды"
id: water_switch
optimistic: true
restore_state: true
# lambda: |-
# if (id(water_status).state) {
# return true;
# } else {
# return false;
# }
turn_on_action:
- switch.turn_off: switch1
- switch.turn_on: switch2
- delay: 30s
- switch.turn_off: switch2
turn_off_action:
- switch.turn_on: switch1
- switch.turn_on: switch2
- delay: 30s
- switch.turn_off: switch1
- switch.turn_off: switch2