-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathESPHome-HumiTempSensor.yaml
117 lines (101 loc) · 2.59 KB
/
ESPHome-HumiTempSensor.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
substitutions:
device_name: "HumiTempSensor"
warn_threshold: "65.0"
display_rotation: "0°"
esphome:
name: humitempsensor
friendly_name: ${device_name}
esp8266:
board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "GENERATE_NEW_RANDOM_KEY"
ota:
password: "GENERATE_NEW_RANDOM_PASSWORD"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "${device_name} Fallback"
password: "GENERATE_NEW_RANDOM_PASSWORD"
captive_portal:
# everything below this could be outsourced with e.g.
# <<: !include humitemp/common.yaml
time:
- platform: homeassistant
sun:
latitude: 42.0°
longitude: 69.0°
output:
- platform: gpio
pin: 4
id: led4
- platform: gpio
pin: 5
id: led5
i2c:
sda: 2
scl: 0
scan: false
sensor:
- platform: bme280
id: bme
temperature:
name: "${device_name} Temperature"
id: temp
pressure:
name: "${device_name} Pressure"
id: pres
humidity:
name: "${device_name} Humidity"
id: hum
on_value:
then:
- component.update: ssd
on_value_range:
- below: ${warn_threshold}
then:
- output.turn_off: led4
- output.turn_off: led5
- above: ${warn_threshold}
then:
- output.turn_on: led4
- output.turn_on: led5
address: 0x76
update_interval: 10s
- platform: sun
id: sun_elev
type: elevation
font:
- file: "gfonts://Roboto"
size: 10
id: rob10
- file: "gfonts://Roboto"
size: 12
id: rob12
- file: "gfonts://Roboto"
size: 24
id: rob24
display:
- platform: ssd1306_i2c
model: SSD1306_128X32
id: ssd
update_interval: never
rotation: ${display_rotation}
lambda: |-
it.print(4, 0, id(rob10), "°C temp");
it.printf(4, 9, id(rob24), "%4.1f", id(temp).state);
it.print(96, 0, id(rob10), "\% hum");
it.printf(76, 9, id(rob24), "%5.1f", id(hum).state);
// dim display at night
((esphome::ssd1306_base::SSD1306 &) it).set_contrast(id(sun_elev).state / 100.0);
if (id(hum).state >= ${warn_threshold}) {
it.print(48, 0, id(rob12), "!WARN!");
//((esphome::ssd1306_base::SSD1306 &) it).set_invert(true); //waiting for https://github.com/esphome/feature-requests/issues/2341 to be resolved
} else {
//((esphome::ssd1306_base::SSD1306 &) it).set_invert(false); //waiting for https://github.com/esphome/feature-requests/issues/2341 to be resolved
}