-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtst_disp0.yaml
135 lines (106 loc) · 3.18 KB
/
tst_disp0.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
#zf210208.0945
# source: https://esphome.io/cookbook/display_time_temp_oled.html
esphome:
name: tst_d1_disp0
platform: ESP8266
board: d1_mini
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# power_save_mode: none
# fast_connect: on
# output_power: 20
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "tst_d1_disp0 Fallback Hotspot"
password: !secret ap_wifi_password
captive_portal:
# Enable logging
logger:
# level: VERBOSE
# Enable Home Assistant API
api:
password: !secret api_password
ota:
password: !secret ota_password
# Définitions des actions Switch
switch:
- platform: gpio
name: "tst_d1_disp0 LED"
inverted: True
id: led
pin: D4
- platform: restart
name: "tst_d1_disp0 Restart"
# Définition du bouton physique
binary_sensor:
- platform: gpio
pin:
number: D3
mode: INPUT_PULLUP
inverted: True
name: "tst_d1_disp0 button"
on_press:
- switch.toggle: led
# WEB Server
web_server:
port: 80
# Récupération de l'heure de Home Assistant
time:
- platform: homeassistant
id: esptime
sensor:
- platform: wifi_signal
name: "tst_d1_disp0 Signal Wi-Fi"
update_interval: 60s
- platform: uptime
name: "tst_d1_disp0 uptime"
update_interval: 60s
- platform: homeassistant
name: "Outside Temp"
id: outside_temperature
entity_id: sensor.weather_temp
# internal: true
- platform: homeassistant
name: "Inside Temp"
entity_id: sensor.th8_temperature
id: inside_temperature
- platform: homeassistant
name: "TVOC"
entity_id: sensor.co2_72_tvoc
id: tvoc
font:
#https://github.com/JotJunior/PHP-Boleto-ZF2/blob/master/public/assets/fonts/arial.ttf
- file: 'arial.ttf'
id: font1
size: 9
i2c:
sda: D2
scl: D1
scan: False
display:
# http://www.esp8266learning.com/wemos-oled-shield-example.php
# https://esphome.io/api/namespaceesphome_1_1display.html
- platform: ssd1306_i2c
model: "SSD1306 64x48"
address: 0x3C
lambda: |-
// Print "Hello Zuzu" for fonts tests in top center.
it.printf(32, 0, id(font1), TextAlign::TOP_CENTER, "Hello Zuzu");
// Print inside temperature (from homeassistant sensor)
//it.printf(0, 7, id(font1), TextAlign::BASELINE_LEFT, "In side");
//if (id(inside_temperature).has_state()) {
// it.printf(64, 7, id(font1), TextAlign::BASELINE_RIGHT , "%.1f°C", id(inside_temperature).state);
//}
// Print outside temperature (from homeassistant sensor)
//it.printf(0, 16, id(font1), TextAlign::BASELINE_LEFT, "Out side");
//if (id(outside_temperature).has_state()) {
// it.printf(64, 16, id(font1), TextAlign::BASELINE_RIGHT , "%.1f°C", id(outside_temperature).state);
//}
// Print TVOC (from homeassistant sensor)
//it.printf(0, 25, id(font1), TextAlign::BASELINE_LEFT, "TVOC");
//if (id(outside_temperature).has_state()) {
// it.printf(64, 25, id(font1), TextAlign::BASELINE_RIGHT , "%.0f", id(tvoc).state);
//}
// Print time in HH:MM format
it.strftime(32, 48, id(font1), TextAlign::BOTTOM_CENTER, "%d-%m %H:%M:%S", id(esptime).now());