-
Notifications
You must be signed in to change notification settings - Fork 0
/
luftpost.example.conf
106 lines (97 loc) · 4.71 KB
/
luftpost.example.conf
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
# Luftpost Configuration
[general]
# Directory where to store state files; optional -- if set, sensor states will be saved
state_dir = '/var/lib/luftpost'
# Defaults for thresholds and notification condition; applies to all sensors if not explicitly set. See below.
[defaults]
# Threshold for PM 10; optional -- defaults to 50.0
threshold_pm10 = 50.0
# Threshold for PM 2.5; optional -- defaults to 50.0
threshold_pm2 = 50.0
# Notification option [Always|OnChange|ThresholdExceeded]; optional -- defaults to 'ThresholdExceeded', OnChange requires 'state_dir' in order to properly work.
[defaults.notification_condition]
condition = 'ThresholdExceeded'
# SMTP Configuration -- may be omitted if notification e-mails are not desired
[smtp]
# From addr; required
sender = "sender@example.com"
# To addr; required
receiver = "receiver@example.com"
# Subject; required -- may contain handlebar template
subject = "Luftpost: Threshold {{#if has_violations }}exceeded{{else}}is back to normal{{/if}} for sensor {{ measurement.sensor.name }} ({{ measurement.sensor.id }})"
# SMTP server; required
server = "smtp.gmail.com"
# Server port; optional -- defaults to 25
port = 25
# Username if SMTP server uses authentification: optional
username = "user@googlemail.com"
# Password if SMTP server uses authentification: optional
password = "this is super secret"
# Authentification mechanism [Plain|CramMD5] if SMTP server uses authentification: optional
auth_mechanism = "Plain"
# Plain text email template; optional -- may contain handlebar template
text_template = """Hello,
a measurement from your sensor "{{ measurement.sensor.name }}" {{#if has_violations }}exceeded a threshold{{else}}is back to normal{{/if}}.
{{#with measurement}}
Particulate Measurements
{{#each data_values as |value|}}
{{#if value.SDS_P1 ~}}* PM 10 = {{number value.SDS_P1}} µg/m³ {{exceeds value.SDS_P1 ../sensor.threshold_pm10}} {{number ../sensor.threshold_pm10}} µg/m³{{/if ~}}
{{#if value.SDS_P2 ~}}* PM 2.5 = {{number value.SDS_P2}} µg/m³ {{exceeds value.SDS_P2 ../sensor.threshold_pm2}} {{number ../sensor.threshold_pm2}} µg/m³{{/if ~}}
{{/each ~}}
Additional Measurements
{{#each data_values as |value|}}
{{#if value.TEMPERATURE ~}}* Temperature = {{number value.TEMPERATURE}} ℃{{/if ~}}
{{#if value.HUMIDITY ~}}* Humidity = {{number value.HUMIDITY}}%{{/if ~}}
{{#if value.SIGNAL ~}}* Wifi Signal Strengh = {{number value.SIGNAL}} dBm{{/if ~}}
{{/each}}
{{/with}}
"""
# HTML text email template; optional -- may contain handlebar template
html_template = """Hello,
<p>
a measurement from your sensor <a href="{{ measurement.sensor.ui_uri }}">{{ measurement.sensor.name }}</a> {{#if has_violations }}exceeded a threshold{{else}}is back to normal{{/if}}.
{{#with measurement}}
</p>
<p>
<b>Particulate Measurements</b>
<ul>
{{#each data_values as |value|}}
{{#if value.SDS_P1 ~}}<li>PM 10 = {{number value.SDS_P1}} µg/m³ {{exceeds value.SDS_P1 ../sensor.threshold_pm10}} {{number ../sensor.threshold_pm10}} µg/m³</li>{{/if ~}}
{{#if value.SDS_P2 ~}}<li>PM 2.5 = {{number value.SDS_P2}} µg/m³ {{exceeds value.SDS_P2 ../sensor.threshold_pm2}} {{number ../sensor.threshold_pm2}} µg/m³</li>{{/if ~}}
{{/each}}
</ul>
</p>
<p>
<b>Additional Measurements</b>
<ul>
{{#each data_values as |value|}}
{{#if value.TEMPERATURE ~}}<li>Temperature = {{number value.TEMPERATURE}} ℃</li>{{/if ~}}
{{#if value.HUMIDITY ~}}<li>Humidity = {{number value.HUMIDITY}}%</li>{{/if ~}}
{{#if value.SIGNAL ~}}<li>Wifi Signal Strengh = {{number value.SIGNAL}} dBm</li>{{/if ~}}
{{/each}}
</ul>
</p>
<img src="https://www.madavi.de/sensor/images/sensor-esp8266-{{ sensor.id }}-sds011-1-day.png" alt="PM 10 graph over 24 hours"/>
<img src="https://www.madavi.de/sensor/images/sensor-esp8266-{{ sensor.id }}-sds011-25-day.png" alt="PM 2.5 graph over 24 hours""/>
<img src="https://www.madavi.de/sensor/images/sensor-esp8266-{{ sensor.id }}-dht-1-day.png" alt="Temperature graph over 24 hours"/>
<img src="https://www.madavi.de/sensor/images/sensor-esp8266-{{ sensor.id }}-dht-25-day.png" alt="Humidity graph over 24 hours""/>
{{/with}}
"""
# Table of multuple sensors to query
[[sensors]]
# Human friendly name of sensor; required
name = "Particulate Sensor 1"
# Sensor ID as displayed in Sensor HTML UI; required
id = "1234567"
# URI to senor UI used in e-mail templates; required
ui_uri = "http://192.168.0.1"
# URI to fetch data from: required
data_uri = "http://192.168.0.1/data.json"
# Threshold for PM 10; optional -- overwrites default threshold
threshold_pm10 = 10.0
# Threshold for PM 2.5; optional -- overwrites default threshold
threshold_pm2 = 10.0
# Notification option [Always|OnChange|ThresholdExceeded]; optional -- overwrites default notification option
[sensors.notification_condition]
condition = 'Always'
# vim: set ft=toml: