-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathd1_mini_bme280.yaml
196 lines (183 loc) · 6.71 KB
/
d1_mini_bme280.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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
esphome:
name: sensor
platform: ESP8266
board: d1_mini
name_add_mac_suffix: true
http_request:
useragent: esphome/device
timeout: 10s
wifi:
# Enable fallback hotspot (captive portal) in case wifi connection fails
ssid: WiFi_AP
password: WIFI_PWD
fast_connect: true
reboot_timeout: 0s
ap:
ssid: "Sensor Fallback Hotspot"
password: "bd6c0LQv9ZVL"
ap_timeout: 60min
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
web_server:
port: 5063
time:
- platform: sntp
id: sntp_time
ota:
i2c:
sda: D3
scl: D4
scan: True
id: bus_a
sensor:
- platform: bme280
i2c_id: bus_a
temperature:
name: "BME280 Temperature"
id: bme280_temperature
oversampling: 16x
on_value:
then:
- http_request.send:
method: POST
url: https://ingestion.junipertechnology.co/sensor-ingest
verify_ssl: false
headers:
Content-Type: application/json
json: |-
root["id"] = "c2604063-dbf2-447a-9477-9e4116c73ed3";
root["timestamp"] = id(sntp_time).utcnow().timestamp;
JsonArray &readings = root.createNestedArray("readings");
JsonObject &reading = readings.createNestedObject();
reading["name"] = "temperature";
reading["unit"] = "C";
reading["value"] = id(bme280_temperature).state;
readings.add(reading);
pressure:
name: "BME280 Pressure"
id: bme280_pressure
on_value:
then:
- http_request.send:
method: POST
url: https://ingestion.junipertechnology.co/sensor-ingest
verify_ssl: false
headers:
Content-Type: application/json
json: |-
root["id"] = "c2604063-dbf2-447a-9477-9e4116c73ed3";
root["timestamp"] = id(sntp_time).utcnow().timestamp;
JsonArray &readings = root.createNestedArray("readings");
JsonObject &reading = readings.createNestedObject();
reading["name"] = "pressure";
reading["unit"] = "hPa";
reading["value"] = id(bme280_pressure).state;
readings.add(reading);
humidity:
name: "BME280 Relative Humidity"
id: bme280_humidity
on_value:
then:
- http_request.send:
method: POST
url: https://ingestion.junipertechnology.co/sensor-ingest
verify_ssl: false
headers:
Content-Type: application/json
json: |-
root["id"] = "c2604063-dbf2-447a-9477-9e4116c73ed3";
root["timestamp"] = id(sntp_time).utcnow().timestamp ;
JsonArray &readings = root.createNestedArray("readings");
JsonObject &reading = readings.createNestedObject();
reading["name"] = "humidity";
reading["unit"] = "%";
reading["value"] = id(bme280_humidity).state;
readings.add(reading);
address: 0x76
update_interval: 10s
- platform: template
name: "Altitude"
id: altitude
lambda: |-
const float STANDARD_SEA_LEVEL_PRESSURE = 1013.25; //in hPa, see note
return ((id(bme280_temperature).state + 273.15) / 0.0065) *
(powf((STANDARD_SEA_LEVEL_PRESSURE / id(bme280_pressure).state), 0.190234) - 1); // in meter
update_interval: 10s
icon: 'mdi:signal'
unit_of_measurement: 'm'
on_value:
then:
- http_request.send:
method: POST
url: https://ingestion.junipertechnology.co/sensor-ingest
verify_ssl: false
headers:
Content-Type: application/json
json: |-
root["id"] = "c2604063-dbf2-447a-9477-9e4116c73ed3";
root["timestamp"] = id(sntp_time).utcnow().timestamp ;
JsonArray &readings = root.createNestedArray("readings");
JsonObject &reading = readings.createNestedObject();
reading["name"] = "altitude";
reading["unit"] = "m";
reading["value"] = id(altitude).state;
readings.add(reading);
- platform: template
name: "Absolute Humidity"
id: absolute_humidity
lambda: |-
const float mw = 18.01534; // molar mass of water g/mol
const float r = 8.31447215; // Universal gas constant J/mol/K
return (6.112 * powf(2.718281828, (17.67 * id(bme280_temperature).state) /
(id(bme280_temperature).state + 243.5)) * id(bme280_humidity).state * mw) /
((273.15 + id(bme280_temperature).state) * r); // in grams/m^3
accuracy_decimals: 2
update_interval: 10s
icon: 'mdi:water'
unit_of_measurement: 'g/m^3'
on_value:
then:
- http_request.send:
method: POST
url: https://ingestion.junipertechnology.co/sensor-ingest
verify_ssl: false
headers:
Content-Type: application/json
json: |-
root["id"] = "c2604063-dbf2-447a-9477-9e4116c73ed3";
root["timestamp"] = id(sntp_time).utcnow().timestamp ;
JsonArray &readings = root.createNestedArray("readings");
JsonObject &reading = readings.createNestedObject();
reading["name"] = "absolute_humidity";
reading["unit"] = "g/m^3";
reading["value"] = id(absolute_humidity).state;
readings.add(reading);
- platform: template
name: "Dew Point"
id: dew_point
lambda: |-
return (243.5*(log(id(bme280_humidity).state/100)+((17.67*id(bme280_temperature).state)/
(243.5+id(bme280_temperature).state)))/(17.67-log(id(bme280_humidity).state/100)-((17.67*id(bme280_temperature).state)/(243.5+id(bme280_temperature).state))));
unit_of_measurement: degC
icon: 'mdi:thermometer-alert'
update_interval: 10s
on_value:
then:
- http_request.send:
method: POST
url: https://ingestion.junipertechnology.co/sensor-ingest
verify_ssl: false
headers:
Content-Type: application/json
json: |-
root["id"] = "c2604063-dbf2-447a-9477-9e4116c73ed3";
root["timestamp"] = id(sntp_time).utcnow().timestamp ;
JsonArray &readings = root.createNestedArray("readings");
JsonObject &reading = readings.createNestedObject();
reading["name"] = "dew_point";
reading["unit"] = "C";
reading["value"] = id(dew_point).state;
readings.add(reading);