diff --git a/CHANGES b/CHANGES index 73e1f6b..305e64e 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,12 @@ + +You can now use "auto" as a meter driver. +Wmbusmeters will then pick the right driver when +the first telegram arrives. A warning will be printed +in the logs if no driver could be found. + +If you do not specify a type= in the meter config file, +then it will default to auto. + Version 1.2.0: 2021-03-07 IMPORTANT CHANGES THAT MIGHT AFFECT YOU!vvvvvvvvvvvvvvvvvvvvvv diff --git a/README.md b/README.md index b1e9605..8d63496 100644 --- a/README.md +++ b/README.md @@ -82,11 +82,14 @@ ignoreduplicates=true Then add a meter file in /etc/wmbusmeters.d/MyTapWater ``` name=MyTapWater -type=multical21:c1 id=12345678 key=00112233445566778899AABBCCDDEEFF ``` +Meter driver detection will be automatic. You can also provide an +explicit driver name with: `type=multical21:c1` or explicitly state +that driver detection is automatic: `type=auto`. + Now plugin your wmbus dongle. Wmbusmeters should start automatically, check with `tail -f /var/log/syslog` and `tail -f /var/log/wmbusmeters/wmbusmeters.log` (If you are using an rtlsdr dongle, then make sure that either the binaries /usr/bin/rtl_sdr and @@ -350,10 +353,10 @@ Received telegram from: 12345678 driver: multical21 ``` -Now listen to this specific meter. +Now listen to this specific meter, since the driver is auto-detected, we can use `auto` for the meter driver. ``` -wmbusmeters auto:c1 MyTapWater multical21:c1 12345678 00112233445566778899AABBCCDDEEFF +wmbusmeters auto:c1 MyTapWater auto 12345678 00112233445566778899AABBCCDDEEFF ``` (The Multical21 and other meters use compressed telegrams, which means diff --git a/src/config.cc b/src/config.cc index e5f2796..83bc40e 100644 --- a/src/config.cc +++ b/src/config.cc @@ -51,9 +51,9 @@ void parseMeterConfig(Configuration *c, vector &buf, string file) auto i = buf.begin(); string bus; string name; - string type; + string type = "auto"; string id; - string key; + string key = ""; string linkmodes; int bps {}; vector telegram_shells; diff --git a/src/meters.cc b/src/meters.cc index 110309f..2b3937e 100644 --- a/src/meters.cc +++ b/src/meters.cc @@ -92,9 +92,9 @@ public: if (t->tpl_id_found) { - mfct = t->dll_mfct; - media = t->dll_type; - version = t->dll_version; + mfct = t->tpl_mfct; + media = t->tpl_type; + version = t->tpl_version; id_b = t->tpl_id_b; } @@ -933,9 +933,9 @@ MeterType pickMeterDriver(Telegram *t) if (t->tpl_id_found) { - manufacturer = t->dll_mfct; - media = t->dll_type; - version = t->dll_version; + manufacturer = t->tpl_mfct; + media = t->tpl_type; + version = t->tpl_version; } #define X(TY,MA,ME,VE) { if (manufacturer == MA && (media == ME || ME == -1) && (version == VE || VE == -1)) { return MeterType::TY; }} diff --git a/tests/config1/etc/wmbusmeters.d/MyWater b/tests/config1/etc/wmbusmeters.d/MyWater index ed43ebb..1bc0248 100644 --- a/tests/config1/etc/wmbusmeters.d/MyWater +++ b/tests/config1/etc/wmbusmeters.d/MyWater @@ -1,4 +1,2 @@ id=52525252 -type=flowiq2200 name=MyWater -key= \ No newline at end of file diff --git a/tests/config1/etc/wmbusmeters.d/Vatten b/tests/config1/etc/wmbusmeters.d/Vatten index 134bc5d..bcf6674 100644 --- a/tests/config1/etc/wmbusmeters.d/Vatten +++ b/tests/config1/etc/wmbusmeters.d/Vatten @@ -1,4 +1,4 @@ id=86868686 -type=weh_07 +type=auto name=Vatten key= \ No newline at end of file