-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblumig.yml
76 lines (66 loc) · 1.52 KB
/
blumig.yml
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
esphome:
name: blumenkalender
esp8266:
board: nodemcuv2
# Enable logging
logger:
# Enable Home Assistant API
api:
password: ""
reboot_timeout: 0s
ota:
password: ""
wifi:
ssid: "LesDifferentes"
password: !secret wifi_pw
reboot_timeout: 0s
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Blumenkalender Fallback Hotspot"
password: "P9ZvWeqS43kH"
captive_portal:
globals:
- id: seconds
type: int
restore_value: no
initial_value: '0'
- id: print_str
type: std::string
restore_value: no
initial_value: '"d.00"'
- id: erase_str
type: std::string
restore_value: no
initial_value: '"| "'
display:
platform: tm1637
clk_pin: D6
dio_pin: D5
update_interval: 1000ms
lambda: |-
static int days = 0;
if (id(seconds) <= 0){
ESP_LOGD("seconds", "s: %2.0i", id(seconds));
ESP_LOGD("print_str", "'%s'", id(print_str).c_str());
id(print_str).replace(id(seconds) * -1, 2, id(erase_str));
}
else{
days = static_cast<int>(id(seconds) / (60 * 60 * 24));
ESP_LOGD("days", "d: %2.0f", days);
ESP_LOGD("seconds", "s: %2.0i", id(seconds));
id(print_str) = " d." + std::to_string(days);
}
it.printf(id(print_str).c_str());
id(seconds)++;
binary_sensor:
- platform: gpio
pin:
number: D1
mode:
input: true
pullup: true
name: "Button"
on_press:
then:
lambda: |-
id(seconds) = -4;