From 297a9d5cb0afd63ca288725c106e11d32085ca0b Mon Sep 17 00:00:00 2001 From: Marcel Kummer Date: Fri, 20 Oct 2023 15:26:33 +0200 Subject: [PATCH] Add ability to configure SML meter workarounds Make use of libsml's workaround options to apply a workaround for DZG meters. This builds upon the changes from [libsml PR #133](https://github.com/volkszaehler/libsml/pull/133). --- etc/vzlogger_generic.schema.json | 10 ++++++++++ include/protocols/MeterSML.hpp | 1 + src/protocols/MeterSML.cpp | 12 ++++++++++-- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/etc/vzlogger_generic.schema.json b/etc/vzlogger_generic.schema.json index e0bdbabf..86e1bd4a 100644 --- a/etc/vzlogger_generic.schema.json +++ b/etc/vzlogger_generic.schema.json @@ -517,6 +517,11 @@ "type": "boolean", "default": false, "description": "use the local time for reading timestamp?" + }, + "dzg_fix_negative_values": { + "type": "boolean", + "default": false, + "description": "work around wrongly encoded negative values on some DZG meters" } }, "required": ["protocol", "device", "baudrate", "parity"] @@ -559,6 +564,11 @@ "type": "boolean", "default": false, "description": "use the local time for reading timestamp?" + }, + "dzg_fix_negative_values": { + "type": "boolean", + "default": false, + "description": "work around wrongly encoded negative values on some DZG meters" } }, "required": ["protocol", "host", "baudrate", "parity"] diff --git a/include/protocols/MeterSML.hpp b/include/protocols/MeterSML.hpp index fe305652..a5f61236 100644 --- a/include/protocols/MeterSML.hpp +++ b/include/protocols/MeterSML.hpp @@ -65,6 +65,7 @@ class MeterSML : public vz::protocol::Protocol { parity_type_t _parity; std::string _pull; bool _use_local_time; + sml_workarounds _sml_workarounds; int _fd; /* file descriptor of port */ struct termios _old_tio; /* required to reset port */ diff --git a/src/protocols/MeterSML.cpp b/src/protocols/MeterSML.cpp index 5bdaf33e..42aa2bb7 100644 --- a/src/protocols/MeterSML.cpp +++ b/src/protocols/MeterSML.cpp @@ -57,7 +57,7 @@ #define SML_BUFFER_LEN 8096 MeterSML::MeterSML(std::list