-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathsensor-community-example-config.yaml
108 lines (94 loc) · 2.84 KB
/
sensor-community-example-config.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
---
esphome:
name: sound-level-meter
external_components:
- source: github://stas-sl/esphome-sound-level-meter
esp32:
board: esp32dev
framework:
type: arduino
logger:
level: DEBUG
api:
password: !secret api_password
reboot_timeout: 0s
ota:
platform: esphome
password: !secret ota_password
http_request:
verify_ssl: false
timeout: 5s
watchdog_timeout: 10s
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
fast_connect: true
web_server:
port: 80
i2s:
ws_pin: 18
bck_pin: 23
din_pin: 19
sample_rate: 48000
bits_per_sample: 32
dma_buf_count: 8
dma_buf_len: 256
use_apll: true
bits_shift: 8
channel: right
sound_level_meter:
update_interval: 150s # to match original sensor.community firmware settings
warmup_interval: 500ms
mic_sensitivity: -26dB
mic_sensitivity_ref: 94dB
groups:
- filters:
- type: sos
coeffs:
# A-weighting:
# b0 b1 b2 a1 a2
- [0.16999495, 0.741029, 0.52548885, -0.11321865, -0.056549273]
- [1., -2.00027, 1.0002706, -0.03433284, -0.79215795]
- [1., -0.709303, -0.29071867, -1.9822421, 0.9822986]
sensors:
- type: eq
name: LAeq_1min
id: LAeq_1min
unit_of_measurement: dBA
- type: max
name: LAmax_125ms_1min
id: LAmax_125ms_1min
# I believe, previously 35ms was used in DNMS FW,
# but later it was changed to 125ms
window_size: 125ms
unit_of_measurement: dBA
- type: min
name: LAmin_125ms_1min
id: LAmin_125ms_1min
window_size: 125ms
unit_of_measurement: dBA
interval:
- interval: 150s
then:
- if:
condition:
lambda: 'return id(LAeq_1min).has_state();'
then:
- http_request.post:
url: http://api.sensor.community/v1/push-sensor-data/
headers:
X-Pin: 15
X-Sensor: esp32-... # replace with your sensor ID
Content-Type: application/json
json: |-
root["software_version"] = "ESPHome " ESPHOME_VERSION;
auto values = root.createNestedArray("sensordatavalues");
auto LA_eq = values.createNestedObject();
LA_eq["value_type"] = "noise_LAeq";
LA_eq["value"] = id(LAeq_1min).state;
auto LA_min = values.createNestedObject();
LA_min["value_type"] = "noise_LA_min";
LA_min["value"] = id(LAmin_125ms_1min).state;
auto LA_max = values.createNestedObject();
LA_max["value_type"] = "noise_LA_max";
LA_max["value"] = id(LAmax_125ms_1min).state;