forked from dashdrum/esphome
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlight_meter_display.yaml
91 lines (73 loc) · 1.72 KB
/
light_meter_display.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
substitutions:
device_name: light_meter_display
upper_device_name: Light Meter Display
esphome:
name: $device_name
platform: ESP8266
board: d1_mini
wifi: !include include/wifi_iot.yaml
captive_portal:
web_server:
port: 80
# Enable logging
logger:
level: INFO
# Enable Home Assistant API
# api:
ota:
mqtt: !include include/mqtt.yaml
i2c:
button:
- platform: restart
name: $upper_device_name Restart
sensor:
- platform: wifi_signal
name: $upper_device_name WiFi Signal
update_interval: 30min
icon: mdi:wifi
- platform: max44009
name: $upper_device_name Light Sensor
id: als
address: 0x4A
update_interval: 2s
accuracy_decimals: 2
filters:
- filter_out: -30.0
- lambda: |-
float pr_delta;
if(x < 3) {
pr_delta = .4;
} else if ( x < 10) {
pr_delta = .6;
} else if (x < 20) {
pr_delta = 1.0;
} else if (x < 80) {
pr_delta = 1.5;
} else if (x < 200) {
pr_delta = 2.0;
} else {
pr_delta = 3.0;
}
if (isnan(x))
return {};
if (isnan(id(als).state))
return x;
if (fabsf(x - id(als).state) >= pr_delta)
return x;
return {};
font:
- file: 'fonts/arial.ttf'
id: font2
size: 36
- file: 'fonts/arial.ttf'
id: font3
size: 14
display:
- platform: ssd1306_i2c
model: "SH1106 128x64"
rotation: 180°
reset_pin: D0
address: 0x3C
lambda: |-
it.printf(40, 2, id(font3), TextAlign::TOP_CENTER, "Luxmeter");
it.printf(10, 55, id(font2), TextAlign::BASELINE_LEFT, "%.2f", id(als).state);