wmbusmeters/wmbusmeters.1

279 wiersze
10 KiB
Groff
Czysty Zwykły widok Historia

2019-06-06 21:24:15 +00:00
.TH WMBUSMETERS 1
.SH NAME
2022-02-16 14:40:16 +00:00
wmbusmeters \- Acquire,query and decode wired and wireless mbus telegrams, then relay the telegrams to other software.
.SH SYNOPSIS
2022-09-21 15:14:17 +00:00
.B wmbusmeters {options} [device]+ { [name] [driver] [id] [key] }*
2022-02-16 14:40:16 +00:00
.B wmbusmeters {options} [hex] { [name] [driver] [id] [key] }*
2022-02-16 14:40:16 +00:00
.B wmbusmetersd {options} [pid_file>]
.SH DESCRIPTION
2023-01-14 09:37:46 +00:00
Wmbusmeters acquires wired or wireless mbus telegrams, decodes them and relays them to
2019-02-28 15:53:09 +00:00
some other software for further processing. It can for example listen
2022-09-21 15:14:17 +00:00
to radio traffic using dedicated wmbus dongles (eg im871a,im170a,amb8465,
amb8335,cul,rc1180) or a software defined radio dongle (rtl_sdr) with an
RTL2832U (decoded using rtl_wmbus, rtl_433).
2022-02-16 14:40:16 +00:00
After the acquired telegram has been decrypted and parsed, it can then
2019-02-28 15:53:09 +00:00
be relayed using a shell command, or stored in a log file. The shell
commands can for example relay the telegram using MQTT (eg
mqtt_publish) sent to a REST API (eg curl) or store it in a database
(eg psql).
.SH OPTIONS
2020-09-25 18:01:16 +00:00
\fB\--alarmexpectedactivity=\fRmon-fri(08-17),sat-sun(09-12) Specify when the timeout is tested, default is mon-sun(00-23)
\fB\--alarmshell=\fR<cmdline> invokes cmdline when an alarm triggers
2021-06-26 10:24:30 +00:00
\fB\--alarmtimeout=\fR<time> Expect a telegram to arrive within <time> seconds, eg 60s, 60m, 24h during expected activity
2020-09-25 18:01:16 +00:00
2021-12-25 13:19:27 +00:00
\fB\--analyze\fR Analyze a telegram to find the best driver
2022-02-16 14:40:16 +00:00
\fB\--analyze=\fR<key> Analyze a telegram to find the best driver and use the provided decryption key.
\fB\--analyze=\fR<driver> Analyze a telegram but use only this driver.
\fB\--analyze=\fR<driver>:<key> Analyze a telegram and use only this driver with this key.
Add :verbose to any analyze to get more verbose analyze output.
2022-12-05 19:44:22 +00:00
\fB\--calculate_xxx_yyy=\fR... Add xxx_yyy to the json and calculate it using the formula. E.g.
\fB\--calculate_sumtemp_c=\fR'external_temperature_c+flow_temperature_c'
\fB\--calculate_flow_f\fR=flow_temperature_c Units are automatically translated if possible.
2019-02-27 18:42:21 +00:00
\fB\--debug\fR for a lot of information
2021-06-26 10:24:30 +00:00
\fB\--donotprobe=\fR<tty> do not auto-probe this tty. Use multiple times for several ttys or specify "all" for all ttys
2019-02-27 18:42:21 +00:00
\fB\--exitafter=\fR<time> exit program after time, eg 20h, 10m 5s
2019-02-27 18:42:21 +00:00
\fB\--format=\fR(hr|json|fields) for human readable, json or semicolon separated fields
2021-06-26 10:24:30 +00:00
\fB\--help\fR list all options
2020-10-31 14:16:14 +00:00
2024-03-03 11:57:40 +00:00
\fB\--identitymode\fR=(id,id-mfct,full,none) group meter state based on the identity mode. Default is id.
2021-06-26 10:24:30 +00:00
\fB\--ignoreduplicates\fR=<bool> ignore duplicate telegrams, remember the last 10 telegrams. Default is true.
2019-10-24 19:06:33 +00:00
2021-08-08 15:16:52 +00:00
\fB\--field_xxx=yyy\fR always add "xxx"="yyy" to the json output and add shell env METER_xxx=yyy The field xxx can also be selected or added using selectfields=. Equivalent older command is --json_xxx=yyy.
2019-06-06 21:24:15 +00:00
2021-06-26 10:24:30 +00:00
\fB\--license\fR print GPLv3+ license
2019-06-06 21:24:15 +00:00
2021-06-26 10:24:30 +00:00
\fB\--listento=\fR<mode> listen to one of the c1,t1,s1,s1m,n1a-n1f link modes
2021-03-13 07:54:08 +00:00
2021-06-26 10:24:30 +00:00
\fB\--listento=\fR<mode>,<mode> listen to more than one link mode at the same time, assuming the dongle supports it
2019-06-06 21:24:15 +00:00
2020-09-25 18:01:16 +00:00
\fB\--listenvs=\fR<meter_type> list the env variables available for the given meter type
\fB\--listfields=\fR<meter_type> list the fields selectable for the given meter type
\fB\--listmeters\fR list all meter types
\fB\--listmeters=\fR<search> list all meter types containing the text <search>
2021-08-27 09:04:59 +00:00
\fB\--listunits=\fR list all unit suffixes that can be used for typing values
\fB\--logfile=\fR<dir> use this file for logging or --logfile=syslog
2019-02-27 18:42:21 +00:00
\fB\--logtelegrams\fR log the contents of the telegrams for easy replay
2021-06-26 10:24:30 +00:00
\fB\--logtimestamps=\fR<when> add timestamps to log entries: never/always/important
2019-02-27 18:42:21 +00:00
\fB\--meterfiles=\fR<dir> store meter readings in dir
2019-02-27 18:42:21 +00:00
\fB\--meterfilesaction=\fR(overwrite|append) overwrite or append to the meter readings file
2019-06-20 12:28:52 +00:00
\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.
2020-11-12 00:03:45 +00:00
\fB\--nodeviceexit\fR if no wmbus devices are found, then exit immediately
\fB\--normal\fR for normal logging
2019-02-27 18:42:21 +00:00
\fB\--oneshot\fR wait for an update from each meter, then quit
2022-09-21 15:14:17 +00:00
\fB\--overridedevice=\fR<device> override device in config files. Can only be used in combination with --useconfig= option
\fB\--pollinterval=\fR<interval> poll mbus meters every <interval>, default is 10m.
\fB\--ppjson\fR pretty print the json output
2021-06-26 10:24:30 +00:00
\fB\--resetafter=\fR<time> reset the wmbus dongle regularly, default is 23h
2021-08-01 22:22:13 +00:00
\fB\--selectfields=\fRid,timestamp,total_m3 select only these fields to be printed (--listfields=<meter> to list available fields)
2020-09-25 18:01:16 +00:00
\fB\--separator=\fR<c> change field separator to c
\fB\--shell=\fR<cmdline> invokes cmdline with env variables containing the latest reading
\fB\--silent\fR do not print informational messages nor warnings
2021-06-26 10:24:30 +00:00
\fB\--trace\fR for tons of information
2022-07-05 17:46:22 +00:00
\fB\--useconfig=\fR<dir> load config <dir>/wmbusmeters.conf and meters from <dir>/wmbusmeters.d
2020-09-25 18:01:16 +00:00
\fB\--usestderr\fR write notices/debug/verbose and other logging output to stderr (the default)
\fB\--usestdoutforlogging\fR write debug/verbose and logging output to stdout
2019-02-27 18:42:21 +00:00
\fB\--verbose\fR for more information
2021-06-26 10:24:30 +00:00
\fB\--version\fR print version
.SH DEVICES
.TP
\fBauto:c1\fR detect any serially connected wmbus dongles and rtl_sdr dongles and configure them for c1 mode.
Use auto to detect your dongle when testing, but then in production, state explicitly the dongle you are using.
2022-09-21 15:14:17 +00:00
This will significantly reduce the amount of probing done on the serial ports.
2019-10-24 19:06:33 +00:00
.TP
2020-10-24 19:59:16 +00:00
\fBim871a:t1\fR look for an im871a dongle attached to any of the serial ttys and configure it for t1 mode.
.TP
2020-10-24 19:59:16 +00:00
\fBim871a[12345678]:t1\fR look for the im871a dongle with this particular id.
.TP
\fB/dev/ttyUSB0:amb8465:c1,t1\fR expect an amb8465 on this tty.
.TP
2019-04-15 19:31:27 +00:00
\fBrtlwmbus\fR use software defined radio rtl_sdr|rtl_wmbus to receive wmbus telegrams.This defaults to 868.95MHz, use for example \fBrtlwmbus:868.9M\fR to tune the rtl_sdr dongle to slightly lower frequency.
2020-10-24 19:59:16 +00:00
.TP
\fBrtlwmbus[alfa]:433M:c1,t1 rtlwmbus[beta]:868.9M:c1,t1\fR Use two rtlsdr dongles, one has its id set to alfa (using rtl_eeprom)
and the other set to beta. Alfa has an antenna tuned for 433M, beta has an antenna suitable for 868.9M.
2020-11-11 23:38:27 +00:00
.TP
\fB/dev/ttyUSB0:9600\fR read serial data from tty at 9600 bps, expects raw wmbus frames with the DLL crcs removed.
2022-05-01 15:25:08 +00:00
.TP
\fBMAIN=/dev/ttyUSB0:mbus:2400\fR expect an serial to mbus master converter on ttyUSB0.
2023-01-14 09:37:46 +00:00
.TP
\fBstdin:rawtty\fR read binary telegrams (without dll crc:s) from stdin.
.TP
\fBfilename:rawtty\fR read binary telegrams from the file.
.TP
\fBstdin:hex\fR decode any hex found on stdin, non-hex characters are ignored.
2020-10-24 19:59:16 +00:00
.TP
\fBstdin:rtlwmbus\fR read rtlwmbus formatted data from stdin.
.TP
\fBmyfile.txt:rtlwmbus\fR read rtlwmbus formatted data from this file instead.
.TP
2019-02-27 18:42:21 +00:00
\fBsimulation_xxx.txt\fR read telegrams from file to replay telegram feed (use --logtelegrams to acquire feed for replay)
.TP
2023-01-14 09:37:46 +00:00
\fB2e441122334455667788\fR decode the given hex string the hex string must have only hex digits or underscores.
.SH METER QUADRUPLES
.TP
2019-02-27 18:42:21 +00:00
\fBmeter_name\fR a mnemonic for your utility meter
.TP
2022-09-21 15:14:17 +00:00
\fBmeter_type\fR for example multical21:t1 (suffix means that we expect this meter to transmit t1 telegrams) the driver auto can be used, but is not recommended for production.
.TP
2024-03-03 18:40:06 +00:00
\fBmeter_id\fR one or more addresses separated with commas, a single '*' wildcard, or a prefix '76543*' with wildcard. You can as a suffix fully or partially specify manufacturer, version and type: 12345678.M=KAM.V=1b.T=16 You can use p0 to p250 to specify an mbus primary address. You can filter out telegrams: 76543*,!76543210
.TP
2019-02-27 18:42:21 +00:00
\fBmeter_key\fR a unique key for the meter, if meter telegrams are not encrypted, you must supply an empty key: ""
.SH EXAMPLES
.TP
.TP
2020-09-25 18:01:16 +00:00
Wait for wmbus dongles to be inserted and then listen for c1 telegrams.
Print a summary of the telegram and whether wmbusmeters has a driver for decoding it.
2020-10-24 19:59:16 +00:00
% wmbusmeters auto:c1
Listen to C1 traffic using an im871a dongle attached to some tty.
2020-10-24 19:59:16 +00:00
% wmbusmeters im871a:c1
2020-09-25 18:01:16 +00:00
2020-10-24 19:59:16 +00:00
The im871a dongles have an id number that is printed when the dongle is started.
You can use this to specify which dongle to use for which linkmode.
% wmbusmeters im871a[12345678]:c1 im871a[22334455]:t1
2020-09-25 18:01:16 +00:00
.TP
Listen to both T1 and C1 traffic using rtl_sdr|rtl_wmbus and the standard frequency 868.95M, which
might need tweaking depending on the rtl_sdr dongle you are using.
% wmbusmeters rtlwmbus:868.95M
2020-10-24 19:59:16 +00:00
You can identify rtlsdr dongles this way as well. The id of the rtlsdr dongle is
set using rtl_eeprom. Assuming you want to listen to multiple frequencies, one dongle
has one type of antenna attached.
% wmbusmeters rtlwmbus[alfa]:433M:t1 rtlwmbus[beta]:868.9M:c1
2022-05-01 15:25:08 +00:00
You can query an mbus meter:
% wmbusmeters MAIN=/dev/ttyUSB0:mbus:2400 MyTempMeter piigth:MAIN:mbus 12001932 NOKEY
.TP
Execute using config file /home/me/etc/wmbusmeters.conf and meter config files in /home/me/etc/wmbusmeters.d
% wmbusmeters --useconfig=/home/me
.TP
Start a daemon using config file /etc/wmbusmeters.conf and meter config files in /etc/wmbusmeters.d
2019-02-27 18:42:21 +00:00
% wmbusmetersd --useconfig=/ /var/run/wmbusmeters/wmbusmeters.pid
.TP
An example wmbusmeters.conf:
.nf
loglevel=normal
2020-10-24 19:59:16 +00:00
device=im871a[12345678]:c1
device=rtlwmbus:433M:c1,t1
logtelegrams=false
2020-10-31 14:16:14 +00:00
format=json
# Remember to remove meterfiles to spare precious flash memory when only
# relaying data using for example mqtt.
meterfiles=/var/lib/wmbusmeters/meter_readings
2019-04-15 19:31:27 +00:00
meterfilesaction=overwrite
2020-10-31 14:16:14 +00:00
meterfilesnaming=name
meterfilestimestamp=day
logfile=/var/log/wmbusmeters/wmbusmeters.log
2019-04-15 19:31:27 +00:00
shell=/usr/bin/mosquitto_pub -h localhost -t "wmbusmeters/$METER_ID" -m "$METER_JSON"
alarmshell=/usr/bin/mosquitto_pub -h localhost -t wmbusmeters_alarm -m "$ALARM_TYPE $ALARM_MESSAGE"
alarmtimeout=1h
alarmexpectedactivity=mon-sun(00-23)
2020-10-31 14:16:14 +00:00
ignoreduplicates=false
field_address=MyStreet 5
.fi
.TP
An example wmbusmeters.d file:
.nf
name=MyTapWater
2022-09-21 15:14:17 +00:00
driver=multical21:c1
id=12345678
key=001122334455667788AABBCCDDEEFF
field_floor=4
2022-09-21 15:14:17 +00:00
.TP
You can use the driver auto, but it is not recommended for production.
The auto driver might change over time to better versions of the driver with new names,
whereas a fixed driver name should generate backwards compatible json.
.SH AUTHOR
Written by Fredrik Öhrström.
.SH COPYRIGHT
Copyright \(co 2017-2022 Fredrik Öhrström.
.br
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
.br
This is free software: you are free to change and redistribute it.
.br
There is NO WARRANTY, to the extent permitted by law.