-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathventilation.yaml
133 lines (123 loc) · 2.89 KB
/
ventilation.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
125
126
127
128
129
130
131
132
133
---
substitutions:
device: ventilation
name: Ventilatie
reboot_timeout: 14d
threshold: '15'
update_interval: 10min
esphome:
name: ${device}
platform: ESP8266
board: esp01_1m
on_boot:
- script.execute: shutdown
<<: !include common/common.yaml
logger:
level: INFO
baud_rate: 0
uart:
rx_pin: RX
baud_rate: 4800
status_led:
pin:
number: GPIO13
inverted: true
globals:
- id: activated
type: bool
restore_value: true
initial_value: 'false'
script:
- id: shutdown
then:
- if:
condition:
lambda: return id(activated) && id(fan).state;
then:
- wait_until:
sensor.in_range:
id: power
below: ${threshold}
- delay: 30min
- switch.turn_off: fan
- lambda: id(activated) = false;
else:
- lambda: id(activated) = false;
remote_receiver:
<<: !include common/rf_receiver.yaml
pin: GPIO4
sensor:
- !include common/sensor/wifi-signal.yaml
- !include common/sensor/uptime.yaml
- platform: cse7766
current:
name: ${name} Current
icon: mdi:current-ac
voltage:
name: ${name} Voltage
icon: mdi:flash
power:
id: power
name: ${name} Power
icon: mdi:power-plug
on_value_range:
- above: ${threshold}
then:
- script.stop: shutdown
- lambda: id(activated) = true;
- script.execute: shutdown
binary_sensor:
- !include common/binary_sensor/status.yaml
- platform: gpio
id: button_1
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: true
on_press:
then:
- switch.toggle: fan
- platform: template
name: ${name} Activated
lambda: return id(activated);
- platform: remote_receiver
<<: !include common/rf_receiver_sensor.yaml
id: rf_button_ventilation
rc_switch_raw:
protocol: 1
code: !secret rf_code_ventilation
on_press:
then:
- switch.turn_on: fan
- platform: remote_receiver
<<: !include common/rf_receiver_sensor.yaml
name: RF Button Kantoor Lights
rc_switch_raw:
protocol: 1
code: !secret rf_code_kantoor_lights
- platform: remote_receiver
<<: !include common/rf_receiver_sensor.yaml
name: RF Button Kantoor Power
rc_switch_raw:
protocol: 1
code: !secret rf_code_kantoor_power
switch:
- !include common/switch/restart.yaml
- platform: gpio
pin: GPIO12
name: ${name}
icon: mdi:fan
id: fan
on_turn_off:
- script.stop: shutdown
- lambda: id(activated) = false;
- platform: template
name: ${name} Auto Poweroff
icon: mdi:timer-off
lambda: return id(activated);
turn_on_action:
- lambda: id(activated) = true;
- script.execute: shutdown
turn_off_action:
- script.stop: shutdown
- lambda: id(activated) = false;