-
Notifications
You must be signed in to change notification settings - Fork 0
/
livingroom-air-quality-monitor.yaml
164 lines (158 loc) · 4.16 KB
/
livingroom-air-quality-monitor.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
158
159
160
161
162
163
164
substitutions:
device_friendly_name: "Livingroom Air Quality Monitor"
device_name: "Livingroom AQM"
location: "Livingroom"
espname: livingroom-air-quality-monitor
packages:
aqm: !include templates/AQM.yaml
script:
- id: min_max_zero_script
then:
- globals.set:
id: pm_max
value: '0.0'
- globals.set:
id: pm_min
value: '300.0'
- globals.set:
id: co_max
value: '0.0'
- globals.set:
id: co_min
value: '5000.0'
- globals.set:
id: temp_min
value: '50.0'
- globals.set:
id: temp_max
value: '0.0'
globals:
- id: button_mode
type: int
initial_value: '1'
- id: brightness_correction
type: float
restore_value: yes
initial_value: '0.15'
- id: ver_sion
type: bool
initial_value: 'false'
- id: led_status
type: bool
initial_value: 'true'
restore_value: yes
- id: display_on
type: bool
initial_value: 'true'
- id: led_status_display
type: bool
initial_value: 'false'
- id: night_mode
type: bool
restore_value: yes
- id: night_mode_display
type: bool
- id: pm_min
type: float
initial_value: '300.0'
- id: pm_max
type: float
initial_value: '0.0'
- id: co_min
type: float
initial_value: '5000.0'
- id: co_max
type: float
initial_value: '0.0'
- id: temp_min
type: float
initial_value: '50.0'
- id: temp_max
type: float
initial_value: '0.0'
- id: min_max_zero
type: bool
initial_value: 'false'
switch:
# - platform: gpio
# name: "PMS7003_SET"
# pin:
# number: GPIO18
# mode: output
# restore_mode: ALWAYS_ON
# id: pms_set
light:
- platform: partition
name: led1
id: led1
default_transition_length: 0s
segments:
- id: rgb_led
from: 0
to: 0
- platform: partition
name: led2
id: led2
default_transition_length: 0s
segments:
- id: rgb_led
from: 1
to: 1
- platform: partition
name: led3
id: led3
default_transition_length: 0s
segments:
- id: rgb_led
from: 2
to: 2
- platform: neopixelbus
num_leds: 3
pin: GPIO16
name: "RGB strip"
id: rgb_led
default_transition_length: 0s
variant: 800KBPS
display:
- platform: ssd1306_i2c
model: "SSD1306 128x64"
address: 0x3C
brightness: 100%
rotation: 180
id: display1
pages:
- id: page1
lambda: |-
// PM2.5 and CO2 data
it.print(0, 10, id(arial), "PM2.5: ");
it.printf(50, 0, id(arial30), "%.0f", id(pm2_5).state);
it.print(0, 37, id(arial), "CO2: ");
it.printf(50, 30, id(arial30), "%.0f", id(co2).state);
- id: page3
lambda: |-
// Temperature, Humidity, and Pressure
it.printf(0, 0, id(arial), "Temp: %.1f °C", id(temp).state);
it.printf(0, 20, id(arial), "Humidity: %.0f %%", id(hum).state);
it.printf(0, 40, id(arial), "Pressure: %.0f hPa", id(press).state);
- id: page4
lambda: |-
// PM1, PM2.5, and PM10 data
it.printf(0, 0, id(arial), "PM1: %.0f ugm3", id(pm1).state);
it.printf(0, 20, id(arial), "P2.5: %.0f ugm3", id(pm2_5).state);
it.printf(0, 40, id(arial), "PM10: %.0f ugm3", id(pm10).state);
- id: page5
lambda: |-
// Additional data or placeholders for commented out sensors like Light, TVOC, eCO2
it.print(0, 0, id(arial), "Additional Sensors");
// Uncomment and populate with real sensor data if available
- id: page7
lambda: |-
// Version Information Display
it.print(0, 0, id(arial10), "YAML ver: $yaml_version");
it.line(0, 12, 128, 12);
it.printf(0, 15, id(arial10), "ESPHome ver: %s", ESPHOME_VERSION);
std::string ip_ = id(ip).state;
it.printf(0, 25, id(arial10), "IP: %s", ip_.c_str());
std::string ssid_ = id(ssid).state;
it.printf(0, 35, id(arial10), "Connected to: %s", ssid_.c_str());
it.printf(0, 45, id(arial10), "LED brightness: +%.0f %%", id(brightness_correction)*100);