From 33069090b005b0f4e9400750ee12659f2ae908cd Mon Sep 17 00:00:00 2001 From: Alexander Dick Date: Sun, 28 Nov 2021 16:29:04 +0100 Subject: [PATCH] added SALZBURGNETZ supplier --- README.md | 5 +++-- dpkg/build_pkg.sh | 2 +- kaifareader.py | 17 ++++++++++++----- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 7058b96..8c1e139 100644 --- a/README.md +++ b/README.md @@ -56,9 +56,10 @@ A template file `meter_template.json` can be recycled for this. The AES key format is "hex string", e.g. `a4f2d...` -Please provide your electricity supplier by the field "supplier". Because each supplier uses its own security standard, -the telegrams differ. This script was tested with suppliers: +Please provide your electricity supplier by the field "supplier". Because each supplier may use its own security standard, +the telegrams may differ. This script was tested with suppliers: - TINETZ +- SALZBURGNETZ - EVN diff --git a/dpkg/build_pkg.sh b/dpkg/build_pkg.sh index f12087a..c4670ba 100755 --- a/dpkg/build_pkg.sh +++ b/dpkg/build_pkg.sh @@ -17,4 +17,4 @@ if [ $? -ne 0 ]; then exit 1 fi -cd .. +cd .. \ No newline at end of file diff --git a/kaifareader.py b/kaifareader.py index 90b8868..390d6a3 100644 --- a/kaifareader.py +++ b/kaifareader.py @@ -62,7 +62,6 @@ class Supplier: ic_start_byte = None enc_data_start_byte = None - class SupplierTINETZ(Supplier): name = "TINETZ" frame2_start_bytes_hex = '68727268' @@ -70,6 +69,12 @@ class SupplierTINETZ(Supplier): ic_start_byte = 23 enc_data_start_byte = 27 +class SupplierSALZBURGNETZ(Supplier): + name = "SALZBURGNETZ" + frame2_start_bytes_hex = '68727268' + frame2_start_bytes = b'\x68\x72\x72\x68' # 68 72 72 68 + ic_start_byte = 23 + enc_data_start_byte = 27 class SupplierEVN(Supplier): name = "EVN" @@ -78,7 +83,6 @@ class SupplierEVN(Supplier): ic_start_byte = 22 enc_data_start_byte = 26 - class Constants: config_file = "/etc/kaifareader/meter.json" export_format_solarview = "SOLARVIEW" @@ -332,12 +336,15 @@ def get_act_energy_neg_kwh(self): bytesize = g_cfg.get_bytesize(), timeout = g_cfg.get_interval()) -if g_cfg.get_supplier().upper() == SupplierTINETZ.name: +supplierName = g_cfg.get_supplier().upper() +if supplierName == SupplierTINETZ.name: g_supplier = SupplierTINETZ() -elif g_cfg.get_supplier().upper() == SupplierEVN.name: +elif supplierName == SupplierSALZBURGNETZ.name: + g_supplier = SupplierSALZBURGNETZ() +elif supplierName == SupplierEVN.name: g_supplier = SupplierEVN() else: - raise Exception("Supplier not supported: {}".format(g_cfg.get_supplier())) + raise Exception("Supplier not supported: {}".format(supplierName)) # main task endless loop while True: