wmbusmeters/README.md

97 wiersze
3.0 KiB
Markdown
Czysty Zwykły widok Historia

2017-08-06 17:20:59 +00:00
# wmbusmeters
2017-08-09 10:00:11 +00:00
The program receives and decodes C1 telegrams
(using the wireless mbus protocol) to acquire
utility meter readings.
2017-08-30 12:14:18 +00:00
2017-08-31 09:15:12 +00:00
```
wmbusmeters version: 0.2
Usage: wmbusmeters [--verbose] [--robot] [usbdevice] { [meter_name] [meter_id] [meter_key] }*
2017-08-30 12:14:18 +00:00
2017-08-31 09:15:12 +00:00
Add more meter triplets to listen to more meters.
Add --verbose for detailed debug information.
2017-09-02 21:26:57 +00:00
--robot for json output.
--meterfiles to create status files below tmp,
2017-09-02 10:33:05 +00:00
named /tmp/meter_name, containing the latest reading.
2017-09-02 21:26:57 +00:00
--oneshot wait for an update from each meter, then quit.
2017-08-31 09:15:12 +00:00
```
2017-08-09 10:00:11 +00:00
2017-08-31 09:15:12 +00:00
No meter triplets means listen for telegram traffic and print any id heard.
2017-08-09 10:02:42 +00:00
2017-09-02 21:26:57 +00:00
# Builds and runs on GNU/Linux:
2017-08-31 09:15:12 +00:00
```
2017-08-09 10:00:11 +00:00
make
2017-08-30 12:14:18 +00:00
./build/wmbusmeters /dev/ttyUSB0 MyTapWater 12345678 00112233445566778899AABBCCDDEEFF
2017-08-31 09:15:12 +00:00
```
Example output:
`MyTapWater 12345678 6.375 m3 2017-08-31 09:09.08 3.040 m3 DRY(dry 22-31 days)`
`./build/wmbusmeters --verbose /dev/ttyUSB0 MyTapWater 12345678 00112233445566778899AABBCCDDEEFF`
2017-08-09 10:02:42 +00:00
2017-08-31 09:15:12 +00:00
`./build/wmbusmeters --robot /dev/ttyUSB0 MyTapWater 12345678 00112233445566778899AABBCCDDEEFF`
2017-08-09 10:00:11 +00:00
2017-08-31 09:15:12 +00:00
Robot output:
`{"name":"MyTapWater","id":"12345678","total_m3":6.375,"target_m3":3.040,"current_status":"","time_dry":"22-31 days","time_reversed":"","time_leaking":"","time_bursting":"","timestamp":"2017-08-31T09:07:18Z"}`
2017-08-31 09:15:12 +00:00
`make HOST=arm`
2017-08-09 10:02:42 +00:00
2017-08-31 09:15:12 +00:00
Binary generated: `./build_arm/wmbusmeters`
2017-08-09 10:00:11 +00:00
2017-08-31 09:15:12 +00:00
`make DEBUG=true`
2017-08-09 10:02:42 +00:00
2017-08-31 09:15:12 +00:00
Binary generated: `./build_debug/wmbusmeters`
2017-08-09 10:00:11 +00:00
2017-08-31 09:15:12 +00:00
`make DEBUG=true HOST=arm`
2017-08-09 10:02:42 +00:00
2017-08-31 09:15:12 +00:00
Binary generated: `./build_arm_debug/wmbusmeters`
2017-08-09 10:02:42 +00:00
2017-09-02 21:26:57 +00:00
If the meter does not use encryption of its meter data, then enter an empty key on the command line.
(you must enter "")
`./build/wmbusmeters --robot --meterfiles /dev/ttyUSB0 MyTapWater 12345678 ""`
# System configuration
2017-08-31 09:15:12 +00:00
Add yourself to the dialout group to get access to the newly plugged in im871A USB stick.
Or even better, add this udev rule:
2017-09-02 21:26:57 +00:00
Create the file: `/etc/udev/rules.d/99-usb-serial.rules` with the content
```
SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", SYMLINK+="im871a",MODE="0660", GROUP="yourowngroup"
```
This will create a symlink named `/dev/im871a` to the particular USB port that the dongle got assigned.
2017-08-09 10:00:11 +00:00
2017-09-02 21:26:57 +00:00
# Limitations
2017-08-09 10:00:11 +00:00
Currently only supports the USB stick receiver im871A
and the water meter Multical21. The source code is modular
and it should be relatively straightforward to add
2017-08-31 09:15:12 +00:00
more receivers and meters.
2017-08-09 10:00:11 +00:00
2017-09-02 21:26:57 +00:00
# Good documents on the wireless mbus protocol:
http://www.m-bus.com/files/w4b21021.pdf
2017-08-09 10:02:42 +00:00
2017-08-09 10:00:11 +00:00
https://www.infineon.com/dgdl/TDA5340_AN_WMBus_v1.0.pdf
2017-08-09 10:02:42 +00:00
2017-08-09 10:00:11 +00:00
http://fastforward.ag/downloads/docu/FAST_EnergyCam-Protocol-wirelessMBUS.pdf
http://www.multical.hu/WiredMBus-water.pdf
2017-09-02 21:26:57 +00:00
http://uu.diva-portal.org/smash/get/diva2:847898/FULLTEXT02.pdf
2017-08-09 10:00:11 +00:00
The AES source code is copied from:
2017-08-09 10:02:42 +00:00
2017-08-09 10:00:11 +00:00
https://github.com/kokke/tiny-AES128-C
The following two other github projects were of great help:
2017-08-09 10:02:42 +00:00
2017-08-09 10:00:11 +00:00
https://github.com/ffcrg/ecpiww
2017-08-09 10:02:42 +00:00
2017-08-09 10:00:11 +00:00
https://github.com/tobiasrask/wmbus-client
TODO: CRC checks are still missing. If the wrong AES key
is supplied you probably get zero readings and
sometimes warnings about wrong type of frames.