-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathepaper213.yaml
157 lines (144 loc) · 4.49 KB
/
epaper213.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
# Waveshare TTGO 2.13 inch epaper display: Clock, calendar and current weather
# Weather icon help from https://community.home-assistant.io/t/display-materialdesign-icons-on-esphome-attached-to-screen/199790/16
esphome:
name: epaper213
platform: ESP32
board: esp32dev
includes:
- weather_icon_map.h
wifi:
networks:
- ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
static_ip: 10.0.0.133
gateway: 10.0.0.1
subnet: 255.255.255.0
dns1: 10.0.0.1
- ssid: !secret work_wifi_ssid
password: !secret work_wifi_password
ap:
ssid: "Fallback Hotspot"
password: !secret fallback_password
captive_portal:
mqtt:
broker: !secret mqtt_broker
port: !secret mqtt_port
username: !secret mqtt_username
password: !secret mqtt_password
discovery: false
logger:
ota:
spi:
clk_pin: GPIO18
mosi_pin: GPIO23
time:
- platform: sntp
id: tm
timezone: "Europe/Stockholm"
on_time:
- seconds: 0
minutes: /1
then:
- component.update: epaper
on_time_sync:
- then:
#- component.update: epaper
font:
- file: "gfonts://Roboto"
id: roboto20
size: 20
- file: "gfonts://Roboto"
id: roboto100
size: 100
glyphs: "0123456789:"
- file: fonts/materialdesignicons-webfont.ttf
id: mdi
size: 20
glyphs:
- "\U000F00ED" # calendar
- "\U000F0590" # weather-cloudy
- "\U000F0F2F" # weather-cloudy-alert
- "\U000F0E6E" # weather-cloudy-arrow-right
- "\U000F0591" # weather-fog
- "\U000F0592" # weather-hail
- "\U000F0F30" # weather-hazy
- "\U000F0898" # weather-hurricane
- "\U000F0593" # weather-lightning
- "\U000F067E" # weather-lightning-rainy
- "\U000F0594" # weather-night
- "\U000F0F31" # weather-night-partly-cloudy
- "\U000F0595" # weather-partly-cloudy
- "\U000F0F32" # weather-partly-lightning
- "\U000F0F33" # weather-partly-rainy
- "\U000F0F34" # weather-partly-snowy
- "\U000F0F35" # weather-partly-snowy-rainy
- "\U000F0596" # weather-pouring
- "\U000F0597" # weather-rainy
- "\U000F0598" # weather-snowy
- "\U000F0F36" # weather-snowy-heavy
- "\U000F067F" # weather-snowy-rainy
- "\U000F0599" # weather-sunny
- "\U000F0F37" # weather-sunny-alert
- "\U000F14E4" # weather-sunny-off
- "\U000F059A" # weather-sunset
- "\U000F059B" # weather-sunset-down
- "\U000F059C" # weather-sunset-up
- "\U000F0F38" # weather-tornado
- "\U000F059D" # weather-windy
- "\U000F059E" # weather-windy-variant
display:
- platform: waveshare_epaper
dc_pin: GPIO17
cs_pin: GPIO5
busy_pin: GPIO4
reset_pin: GPIO16
rotation: 90°
model: 2.13in-ttgo-dke # -b74 also worked fine, but without partial update (-dke)
update_interval: never
full_update_every: 10
id: epaper
lambda: |-
it.strftime(0, 2, id(roboto20), TextAlign::TOP_LEFT, "%a, %e %b", id(tm).now());
if (id(weather).has_state()) {
it.print(it.get_width(), 4, id(mdi), TextAlign::TOP_RIGHT, weather_icon_map[id(weather).state.c_str()].c_str());
}
if (id(temperature).has_state()) {
it.printf(it.get_width()-25, 2, id(roboto20), TextAlign::TOP_RIGHT, "%.0f°C", id(temperature).state);
}
if (id(rainfall).has_state() && id(rainfall).state > 0) {
it.printf(it.get_width()-70, 2, id(roboto20), TextAlign::TOP_RIGHT, "%.1fmm", id(rainfall).state);
} else {
it.print(it.get_width()-70, 2, id(roboto20), TextAlign::TOP_RIGHT, " ");
}
//it.line(0, 25, it.get_width(), 25);
it.strftime(it.get_width()/2, it.get_height(), id(roboto100), TextAlign::BOTTOM_CENTER, "%H:%M", id(tm).now());
if (id(next_event).has_state()) {
it.print(0, it.get_height()+2, id(mdi), TextAlign::BOTTOM_LEFT, "\U000F00ED");
it.printf(20, it.get_height()+3, id(roboto20), TextAlign::BOTTOM_LEFT, "%s", id(next_event).state.c_str());
}
sensor:
- platform: mqtt_subscribe
topic: epaper/wx/temp
id: temperature
- platform: mqtt_subscribe
topic: epaper/wx/rain
id: rainfall
text_sensor:
- platform: mqtt_subscribe
topic: epaper/wx/icon
id: weather
- platform: mqtt_subscribe
id: next_event
topic: epaper/nextevent
binary_sensor:
- platform: gpio
id: push_button
pin:
number: GPIO39
inverted: true
filters:
- delayed_off: 50ms
on_press:
then:
- component.update: epaper