-
Notifications
You must be signed in to change notification settings - Fork 1
/
regs2.yaml
executable file
·197 lines (172 loc) · 3.97 KB
/
regs2.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
esphome:
name: regulator-s2
platformio_options:
board_build.f_cpu: 80000000L
on_boot:
then:
- output.turn_on: rotary_encoder_power_pin
esp32:
board: lolin_s2_mini
# Enable logging
logger:
#level: VERY_VERBOSE
level: DEBUG
# Enable Home Assistant API
api:
password: ""
ota:
password: ""
wifi:
ssid: "Nadtocheeva 5"
password: "123123123"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Regulator Fallback Hotspot"
password: "123123123"
web_server:
port: 80
include_internal: true
ota: true
local: true
captive_portal:
i2c:
id: i2c_component
sda: 38
scl: 16
frequency: 400kHz
font:
- file: "fonts/tahoma.ttf"
id: font16
size: 16
- file: "fonts/tahoma.ttf"
id: font12
size: 12
- file: "fonts/tahoma.ttf"
id: font28
size: 30
display:
- platform: ssd1306_i2c
id: ssd
model: "SSD1306 128x32"
address: 0x3c
lambda: |-
it.printf( 0, 0, id(font28), "%3.0f°C", id(climate1).current_temperature);
it.printf(80,14, id(font16), "%3.0f°C", id(climate1).target_temperature);
switch(id(climate1).action)
{
case climate::CLIMATE_ACTION_OFF:
it.print(76, 0, id(font12), "OFF ");
break;
case climate::CLIMATE_ACTION_HEATING:
it.print(76, 0, id(font12), "HEATING");
break;
case climate::CLIMATE_ACTION_IDLE:
it.print(76, 0, id(font12), "IDLE ");
break;
default:
it.print(76, 0, id(font12), "??? ");
break;
}
spi:
miso_pin: 35
clk_pin: 18
light:
- platform: status_led
name: "Switch state"
pin: 15
sensor:
- platform: max6675
id: temperature_sensor
name: "Temperature"
cs_pin: 33
update_interval: 5s
- platform: rotary_encoder
id: encoder1
name: "Rotary Encoder"
pin_a: 21
pin_b: 17
on_clockwise:
then:
- climate.control:
id: climate1
target_temperature: !lambda "return id(climate1).target_temperature + 1;"
- component.update: ssd
on_anticlockwise:
then:
- climate.control:
id: climate1
target_temperature: !lambda "return id(climate1).target_temperature - 1;"
- component.update: ssd
- platform: pid
name: "PID Climate Result"
type: RESULT
binary_sensor: # exposes online status
- platform: status
name: "Sensor Status"
- platform: gpio
pin:
number: 34
inverted: true
name: "Rotary encoder btn"
filters:
- delayed_on: 10ms
on_click:
min_length: 50ms
max_length: 350ms
then:
- lambda: |-
if (id(climate1).mode == climate::CLIMATE_MODE_OFF) {
auto call = id(climate1).make_call();
call.set_mode("HEAT");
call.perform();
} else {
auto call = id(climate1).make_call();
call.set_mode("OFF");
call.perform();
}
- platform: gpio
pin:
number: 0
inverted: true
mode:
input: true
pullup: true
name: "Onboard btn"
filters:
- delayed_on: 10ms
text_sensor:
- platform: wifi_info
ip_address: # exposes the IP Address when connected
internal: true
id: wifi_ip_addr
name: "IP Address"
ssid: # exposes the SSID when connected
internal: true
id: wifi_ssid
output:
- platform: ledc
pin: 12
id: pwm_output
frequency: 100Hz
- platform: gpio
pin:
number: 36
id: rotary_encoder_power_pin
climate:
- platform: pid
id: climate1
name: "PID Climate Controller"
sensor: temperature_sensor
visual:
min_temperature: 20
max_temperature: 200
temperature_step: 1
default_target_temperature: 30°C
heat_output: pwm_output
control_parameters:
kp: 0.49460
ki: 0.00487
kd: 12.56301
# on_state:
# then:
# - component.update: ssd