-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
.env.example
165 lines (161 loc) · 6.02 KB
/
.env.example
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
##### MQTT Broker credentials
MQTT_HOST=my-mqtt-broker.local
MQTT_PORT=1883
MQTT_SSL=false
MQTT_USERNAME=my-mqtt-username
MQTT_PASSWORD=my-mqtt-password
##### Mappings
# You can define multiple mappings. Each mapping is defined by multiple environment variables.
# Each variables starts with the MAPPING_X_ prefix, where X is a number starting from 0.
#
# A mapping defines how to get data from an MQTT message and where to write it to in InfluxDB.
# At least if requires the topic name, the measurement name, the field name and the data type.
# It allows to handle positive and negative values differently, and allows to handle JSON payloads.
#
# Allowed environment variables for each mapping are:
#
# - MAPPING_X_TOPIC: the MQTT topic to subscribe to
# - MAPPING_X_MEASUREMENT: the name of the InfluxDB measurement to write to
# - MAPPING_X_MEASUREMENT_POSITIVE: the name of the InfluxDB measurement to write to for positive values (optional)
# - MAPPING_X_MEASUREMENT_NEGATIVE: the name of the InfluxDB measurement to write to for negative values (optional)
# - MAPPING_X_FIELD: the name of the InfluxDB field to write to
# - MAPPING_X_FIELD_POSITIVE: the name of the InfluxDB field to write to for positive values (optional)
# - MAPPING_X_FIELD_NEGATIVE: the name of the InfluxDB field to write to for negative values (optional)
# - MAPPING_X_TYPE: the data type of the field. It can be one of integer, float, string or boolean
# - MAPPING_X_JSON_KEY: the key in the JSON payload to extract the value from (optional, only for JSON payloads)
# - MAPPING_X_JSON_PATH: the JSONPath in the JSON payload to extract the value from (optional, only for JSON payloads)
# - MAPPING_X_JSON_FORMULA: a formula to calculate the value from the JSON payload (optional, only for JSON payloads)
#
#
# Here are some examples of mappings:
#
# Basic mapping:
# MAPPING_0_TOPIC=senec/0/ENERGY/GUI_INVERTER_POWER
# MAPPING_0_MEASUREMENT=PV
# MAPPING_0_FIELD=inverter_power
# MAPPING_0_TYPE=float
#
# Mapping with positive and negative values:
# MAPPING_1_TOPIC=senec/0/ENERGY/GUI_GRID_POW
# MAPPING_1_MEASUREMENT_POSITIVE=PV
# MAPPING_1_MEASUREMENT_NEGATIVE=PV
# MAPPING_1_FIELD_POSITIVE=grid_import_power
# MAPPING_1_FIELD_NEGATIVE=grid_export_power
# MAPPING_1_TYPE=float
#
# Mapping with simple JSON payload (using JSON_KEY):
# MAPPING_2_TOPIC=my/little/nuclear/plant
# MAPPING_2_JSON_KEY=radiation_level
# MAPPING_2_MEASUREMENT=nuclear_power_plant
# MAPPING_2_FIELD=radiation_level
# MAPPING_2_TYPE=float
#
# This extracts a value from a payload like `{"radiation_level": 90.5, "reactivity": 0.7}`. In this example, it returns the value of the key `radiation_level`, which is 90.5.
#
# Mapping with complex JSON payload (using JSON_PATH):
# MAPPING_3_TOPIC=go-e/ATTR
# MAPPING_3_JSON_PATH=$.ccp[2]
# MAPPING_3_MEASUREMENT=WALLBOX
# MAPPING_3_FIELD=power
# MAPPING_3_TYPE=float
#
# This extracts value from a payload like `{"ccp": [1,2,42,3]}`. In this example, it returns the value at the index 2 (third element) of the array `ccp`, which is 42.
#
# For JSONPath specification (the `$.` notation) see here:
# https://goessner.net/articles/JsonPath/
#
# Mapping with JSON payload and formula:
# MAPPING_4_TOPIC=my/little/nuclear/plant
# MAPPING_4_JSON_KEY=radiation_level
# MAPPING_4_MEASUREMENT=nuclear_power_plant
# MAPPING_4_FIELD=radiation_level
# MAPPING_4_TYPE=float
#
# MAPPING_5_TOPIC=my/little/nuclear/plant
# MAPPING_5_JSON_KEY=reactivity
# MAPPING_5_MEASUREMENT=nuclear_power_plant
# MAPPING_5_FIELD=reactivity
# MAPPING_5_TYPE=float
#
# MAPPING_6_TOPIC=my/little/nuclear/plant
# MAPPING_6_JSON_FORMULA="round({reactivity} * {radiation_level}) + 42"
# MAPPING_6_MEASUREMENT=nuclear_power_plant
# MAPPING_6_FIELD=danger_level
# MAPPING_6_TYPE=float
#
# For a payload like `{"radiation_level": 90.5, "reactivity": 0.7}` it calculates a `danger_level` as `round(0.7 * 90.5) + 42`, which is 105.
#
# Please note:
# - The curly braces are used to reference specific values in the JSON payload. You can use a simple key or a JSONPath
# to reference the value to use
# - The same topic is used for multiple mappings, but different json_keys (or json_formula) are used.
#
# For operators allowed in formulas see here:
# https://github.com/rubysolo/dentaku?tab=readme-ov-file#built-in-operators-and-functions
MAPPING_0_TOPIC=senec/0/ENERGY/GUI_INVERTER_POWER
MAPPING_0_MEASUREMENT=PV
MAPPING_0_FIELD=inverter_power
MAPPING_0_TYPE=integer
MAPPING_0_MIN=5
MAPPING_0_MAX=15000
#
MAPPING_1_TOPIC=senec/0/ENERGY/GUI_HOUSE_POW
MAPPING_1_MEASUREMENT=PV
MAPPING_1_FIELD=house_power
MAPPING_2_TYPE=integer
#
MAPPING_2_TOPIC=senec/0/ENERGY/GUI_GRID_POW
MAPPING_2_MEASUREMENT_POSITIVE=PV
MAPPING_2_MEASUREMENT_NEGATIVE=PV
MAPPING_2_FIELD_POSITIVE=grid_import_power
MAPPING_2_FIELD_NEGATIVE=grid_export_power
MAPPING_2_TYPE=integer
#
MAPPING_3_TOPIC=senec/0/PV1/POWER_RATIO
MAPPING_3_MEASUREMENT=PV
MAPPING_3_FIELD=grid_export_limit
MAPPING_3_TYPE=float
#
MAPPING_4_TOPIC=senec/0/ENERGY/GUI_BAT_DATA_POWER
MAPPING_4_MEASUREMENT_POSITIVE=PV
MAPPING_4_MEASUREMENT_NEGATIVE=PV
MAPPING_4_FIELD_POSITIVE=battery_charging_power
MAPPING_4_FIELD_NEGATIVE=battery_discharging_power
MAPPING_4_TYPE=integer
#
MAPPING_5_TOPIC=senec/0/ENERGY/GUI_BAT_DATA_FUEL_CHARGE
MAPPING_5_MEASUREMENT=PV
MAPPING_5_FIELD=battery_soc
MAPPING_5_TYPE=float
#
MAPPING_6_TOPIC=senec/0/WALLBOX/APPARENT_CHARGING_POWER/0
MAPPING_6_MEASUREMENT=PV
MAPPING_6_FIELD=wallbox_power
MAPPING_6_TYPE=integer
#
MAPPING_7_TOPIC=somewhere/HEATPUMP/POWER
MAPPING_7_MEASUREMENT=HEATPUMP
MAPPING_7_FIELD=power
MAPPING_7_TYPE=integer
#
MAPPING_8_TOPIC=senec/0/TEMPMEASURE/CASE_TEMP
MAPPING_8_MEASUREMENT=PV
MAPPING_8_FIELD=case_temp
MAPPING_8_TYPE=float
#
MAPPING_9_TOPIC=senec/0/ENERGY/STAT_STATE_Text
MAPPING_9_MEASUREMENT=PV
MAPPING_9_FIELD=system_status
MAPPING_9_TYPE=string
#
MAPPING_10_TOPIC=senec/0/ENERGY/STAT_STATE_Ok
MAPPING_10_MEASUREMENT=PV
MAPPING_10_FIELD=system_status_ok
MAPPING_10_TYPE=boolean
##### InfluxDB credentials
INFLUX_HOST=localhost
INFLUX_SCHEMA=http
INFLUX_PORT=8086
INFLUX_TOKEN=my-token
INFLUX_ORG=my-org
INFLUX_BUCKET=my-bucket