Support comments (lines starting with #) in the conf and meter files.

pull/111/head
Fredrik Öhrström 2020-05-06 09:41:29 +02:00
rodzic 3edd661667
commit 36e213e49a
4 zmienionych plików z 13 dodań i 4 usunięć

Wyświetl plik

@ -58,6 +58,9 @@ void parseMeterConfig(Configuration *c, vector<char> &buf, string file)
if (p.first == "") break;
// If the key starts with # then the line is a comment. Ignore it.
if (p.first.length() > 0 && p.first[0] == '#') continue;
if (p.first == "name") name = p.second;
else
if (p.first == "type") type = p.second;
@ -370,6 +373,8 @@ unique_ptr<Configuration> loadConfiguration(string root, string device_override,
auto p = getNextKeyValue(global_conf, i);
if (p.first == "") break;
// If the key starts with # then the line is a comment. Ignore it.
if (p.first.length() > 0 && p.first[0] == '#') continue;
if (p.first == "loglevel") handleLoglevel(c, p.second);
else if (p.first == "device") handleDevice(c, p.second);
else if (p.first == "listento") handleListenTo(c, p.second);

Wyświetl plik

@ -1,4 +1,5 @@
loglevel=normal
device=simulations/simulation_c1.txt
logtelegrams=false
# A comment
format=json

Wyświetl plik

@ -1,4 +1,5 @@
name=MyHeater
type=multical302
id=67676767
#key=testing comment
key=

Wyświetl plik

@ -11,7 +11,7 @@ wmbusmeters \- listen to wireless mbus radio traffic and relay the decoded teleg
Wmbusmeters acquires wmbus telegrams, decodes them and relays them to
some other software for further processing. It can for example listen
to radio traffic using dedicated wmbus dongles like (im871a/amb8465/rfmrx2)
to radio traffic using dedicated wmbus dongles like (im871a amb8465 rfmrx2 cul d1tc)
or a generic software defined radio dongle (rtl_sdr).
After the received telegram has been decrypted and parsed, it can then
@ -47,6 +47,8 @@ mqtt_publish) sent to a REST API (eg curl) or store it in a database
\fB\--meterfilesnaming=\fR(name|id|name-id) the meter file is the meter's: name, id or name-id
\fB\--meterfilestimestamp=\fR(never|day|hour|minute|micros) the meter file is suffixed with a timestamp (localtime) with the given resolution.
\fB\--oneshot\fR wait for an update from each meter, then quit
\fB\--reopenafter=\fR<time> close/reopen dongle connection repeatedly every <time> seconds, eg 60s, 60m, 24h
@ -122,7 +124,7 @@ An example wmbusmeters.conf:
.nf
loglevel=normal
device=auto
device=/dev/ttyUSB0:im871a
logtelegrams=false
meterfiles=/var/log/wmbusmeters/meter_readings
meterfilesaction=overwrite
@ -136,7 +138,7 @@ An example wmbusmeters.d file:
.nf
name=MyTapWater
type=multical21
type=multical21:c1
id=12345678
key=001122334455667788AABBCCDDEEFF
json_floor=4
@ -145,7 +147,7 @@ json_floor=4
Written by Fredrik Öhrström.
.SH COPYRIGHT
Copyright \(co 2017-2019 Fredrik Öhrström.
Copyright \(co 2017-2020 Fredrik Öhrström.
.br
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
.br