From 5e04eb563d96e800a51f113c879ecbcc5f2fe05e Mon Sep 17 00:00:00 2001 From: HotNoob Date: Tue, 20 Feb 2024 17:07:22 -0600 Subject: [PATCH 1/6] Update growatt.py --- growatt.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/growatt.py b/growatt.py index 338b092..e78da79 100644 --- a/growatt.py +++ b/growatt.py @@ -148,7 +148,8 @@ def read_input_register(self) -> dict[str,str]: if item.bytes == 1: #read byte value = float(registry[item.register]) elif item.bytes == 2: #read double - value = float((registry[item.register] << 16) + registry[item.register + 1]) + #value = float((registry[item.register] << 16) + registry[item.register + 1]) + value = int.from_bytes(registry[item.register], registry[item.register+1]) if item.unit_mod != float(1): value = value * item.unit_mod From a93f1d41a5c33a59c0f40c8de3bbc443279c0fbf Mon Sep 17 00:00:00 2001 From: HotNoob Date: Tue, 20 Feb 2024 17:08:30 -0600 Subject: [PATCH 2/6] Update growatt.py --- growatt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/growatt.py b/growatt.py index e78da79..10c3b0f 100644 --- a/growatt.py +++ b/growatt.py @@ -149,7 +149,7 @@ def read_input_register(self) -> dict[str,str]: value = float(registry[item.register]) elif item.bytes == 2: #read double #value = float((registry[item.register] << 16) + registry[item.register + 1]) - value = int.from_bytes(registry[item.register], registry[item.register+1]) + value = int.from_bytes([registry[item.register], registry[item.register+1]]) if item.unit_mod != float(1): value = value * item.unit_mod From 6787839a883053abc3eddfec58bbe9bcc69831ba Mon Sep 17 00:00:00 2001 From: HotNoob Date: Tue, 20 Feb 2024 17:33:59 -0600 Subject: [PATCH 3/6] add data types --- growatt.py | 14 +- protocol_settings.py | 31 ++++- protocols/v0.14.input_registry_map.csv | 180 ++++++++++++------------- 3 files changed, 126 insertions(+), 99 deletions(-) diff --git a/growatt.py b/growatt.py index 10c3b0f..e15c70d 100644 --- a/growatt.py +++ b/growatt.py @@ -4,9 +4,10 @@ """ import logging import time +import struct from pymodbus.exceptions import ModbusIOException -from protocol_settings import registry_map_entry, protocol_settings +from protocol_settings import Data_Type, registry_map_entry, protocol_settings # Codes StateCodes = { @@ -145,11 +146,14 @@ def read_input_register(self) -> dict[str,str]: for item in self.protocolSettings.input_registry_map: value = '' - if item.bytes == 1: #read byte + + if item.data_type == Data_Type.BYTE: #read byte value = float(registry[item.register]) - elif item.bytes == 2: #read double - #value = float((registry[item.register] << 16) + registry[item.register + 1]) - value = int.from_bytes([registry[item.register], registry[item.register+1]]) + elif item.data_type == Data_Type.UINT: #read uint + value = float((registry[item.register] << 16) + registry[item.register + 1]) + elif item.data_type == Data_Type.INT: #read int + value = int.from_bytes(bytes([registry[item.register], registry[item.register + 1]]), byteorder='little', signed=True) + if item.unit_mod != float(1): value = value * item.unit_mod diff --git a/protocol_settings.py b/protocol_settings.py index 3c6e674..c1a9488 100644 --- a/protocol_settings.py +++ b/protocol_settings.py @@ -1,10 +1,23 @@ import csv from dataclasses import dataclass +import enum import json import re import os +class Data_Type(enum): + BYTE = 1 + USHORT = 2 + UINT = 3 + SHORT = 4 + INT = 5 + @classmethod + def fromString(cls, name : str): + name = name.strip().upper() + return getattr(cls, name) + + @dataclass class registry_map_entry: register : int @@ -12,7 +25,7 @@ class registry_map_entry: documented_name : str unit : str unit_mod : float - bytes : int = 1 + data_type : Data_Type = Data_Type.BYTE class protocol_settings: protocol : str @@ -110,13 +123,18 @@ def load__registry(self, path) -> list[registry_map_entry]: if numeric_part == 0: numeric_part = float(1) + + data_type = Data_Type.BYTE + if row['data_type']: + data_type = Data_Type.fromString(row['data type']) item = registry_map_entry( register= int(row['register']), variable_name= variable_name, documented_name = row['documented name'], unit= str(character_part), - unit_mod= numeric_part + unit_mod= numeric_part, + data_type= data_type ) registry_map.append(item) @@ -130,7 +148,12 @@ def load__registry(self, path) -> list[registry_map_entry]: and registry_map[index-1].documented_name.replace('_h', '_l') == item.documented_name ): combined_item = registry_map[index-1] - combined_item.bytes = 2 + + if not combined_item.data_type: + if registry_map[index].data_type != Data_Type.BYTE: + combined_item.data_type = registry_map[index].data_type + else: + combined_item.data_type = Data_Type.INT if combined_item.documented_name == combined_item.variable_name: combined_item.variable_name = combined_item.variable_name[:-2].strip() @@ -188,4 +211,4 @@ def load__holding_registry_map(self, file : str = '', settings_dir : str = ''): self.holding_registry_size = item.register -settings = protocol_settings('v0.14') \ No newline at end of file +#settings = protocol_settings('v0.14') \ No newline at end of file diff --git a/protocols/v0.14.input_registry_map.csv b/protocols/v0.14.input_registry_map.csv index 9c4e1dc..c256b92 100644 --- a/protocols/v0.14.input_registry_map.csv +++ b/protocols/v0.14.input_registry_map.csv @@ -1,90 +1,90 @@ -register;variable name;documented name;description;value;unit;note;;;;;;;;;; -0;;System Status;System run state;0: Standby;1; PV an Grid Combine Discharge2: Discharge;3: Fault;4: Flash;5: PV charge;6: AC charge;7: Combine charge;8: Combine charge and Bypass;9: PV charge and Bypass;10: AC charge and Bypass; 11: Bypass;12: PV charge andDischarge -1;PV1 Voltage;Vpv1;PV1 voltage;;0.1V;;;;;;;;;;; -2;PV2 Voltage;Vpv2;PV2 voltage;;0.1V;;;;;;;;;;; -3;PV1 Watts;Ppv1 H;PV1 charge power (high);;0.1W;;;;;;;;;;; -4;;Ppv1 L;PV1 charge power (low);;0.1W;;;;;;;;;;; -5;PV2 Watts;Ppv2 H;PV2 charge power (high);;0.1W;;;;;;;;;;; -6;;Ppv2 L;PV2 charge power (low);;0.1W;;;;;;;;;;; -7;Buck1 Current;Buck1Curr;Buck1 current;;0.1A;;;;;;;;;;; -8;Buck2 Current;Buck2Curr;Buck2 current;;0.1A;;;;;;;;;;; -9;Output Wattage;OP_Watt H;Output active power (high);;0.1W;;;;;;;;;;; -10;;OP_Watt L;Output active power (low);;0.1W;;;;;;;;;;; -11;Output VA;OP_VA H;Output apparent power (high);;0.1VA;;;;;;;;;;; -12;;OP_VA L;Output apparent power (low);;0.1VA;;;;;;;;;;; -13;AC Charge Watts;ACChr_Watt H;AC charge watt (high);;0.1W;;;;;;;;;;; -14;;ACChr_Watt L;AC charge watt (low);;0.1W;;;;;;;;;;; -15;AC Charge VA;ACChr_VA H;AC charge apparent power (high);;0.1VA;;;;;;;;;;; -16;;ACChr_VA L;AC charge apparent power (low);;0.1VA;;;;;;;;;;; -17;Battery Voltage;Bat Volt;Battery volt (M3);;0.01V;;;;;;;;;;; -18;Battery SOC;BatterySOC;Battery SOC;0~100;1.00%;;;;;;;;;;; -19;Bus Voltage;Bus Volt;Bus Voltage;;0.1V;;;;;;;;;;; -20;Grid Voltage;Grid Volt;AC input Volt;;0.1V;;;;;;;;;;; -21;Grid Hz;Line Freq;AC input frequency;;0;;;;;;;;;;; -22;Output Voltage;OutputVolt;AC output Volt;;0.1V;;;;;;;;;;; -23;Output Hz;OutputFreq;AC output frequency;;0.01Hz;;;;;;;;;;; -24;Output DCV;Ouput DCV;Ouput DC Volt;;0.1V;;;;;;;;;;; -25;;InvTemp;Inv Temperature;;0.1C;;;;;;;;;;; -26;;DcDc Temp;DC-DC Temperature;;0.1C;;;;;;;;;;; -27;Load Percentage;LoadPercent;Load Percent;0~1000;0.10%;;;;;;;;;;; -28;Battery Port Voltage;Bat_s_Volt;Battery-port volt (DSP);;0.01V;;;;;;;;;;; -29;Battery Bus Voltage;Bat_Volt_DSP;Battery-bus volt (DSP);;0.01V;;;;;;;;;;; -30;;Time total H;Work time total (high);;0.5;;;;;;;;;;; -31;;Time total L;Work time total (low);;0. 5S;;;;;;;;;;; -32;Buck1 Temperature;Buck1_NTC;Buck1 Temperature;;0.1C;;;;;;;;;;; -33;Buck2 Temperature;Buck2_NTC;Buck2 Temperature;;0.1C;;;;;;;;;;; -34;Output Current;OP_Curr;Output Current;;0.1A;;;;;;;;;;; -35;Inverter Current;Inv_Curr;Inv Current;;0.1A;;;;;;;;;;; -36;AC Input Watts;AC_InWatt H;AC input watt (high);;0.1W;;;;;;;;;;; -37;;AC_InWatt L;AC input watt (low);;0.1W;;;;;;;;;;; -38;AC Input VA;AC_InVA H;AC input apparent power (high);;0.1VA;;;;;;;;;;; -39;;AC_InVA L;AC input apparent power (low);;0.1VA;;;;;;;;;;; -40;;Fault bit;fault bit;&*1;;;;;;;;;;;; -41;;Warning bit;Warning bit;&*1;;;;;;;;;;;; -42;;Warning bit high;;;;;;;;;;;;;; -43;;warning value;warning value;;;;;;;;;;;;; -44;;DTC;Device Type Code;&*6;;;;;;;;;;;; -45;;Check Step;Product check step;1:PV1 charge power check 2:PV2 charge power check 3:AC charge Powercheck;;;;;;;;;;;; -46;;Production Line Mode;Production Line Mode;0: Not at Production Line Mode 1: Production Line Mode 2: Production LineClear Fault Mode;;;;;;;;;;;; -47;;ConstantPowerOKFlag;Constant Power OK Flag;0: Not OK 1: OK;;;;;;;;;;;; -48;PV1 KWH Today;Epv1_today H;PV Energy today;;;;;;;;;;;;; -49;;Epv1_today L;PV Energy today;;0.1kWh;;;;;;;;;;; -50;PV1 KWH Total;Epv1_total H;PV Energy total;;;;;;;;;;;;; -51;;Epv1_total L;PV Energy total;;0.1kWh;;;;;;;;;;; -52;PV2 KWH Today;Epv2_today H;PV Energy today;;;;;;;;;;;;; -53;;Epv2_today L;PV Energy today;;0.1kWh;;;;;;;;;;; -54;PV2 KWH Total;Epv2_total H;PV Energy total;;;;;;;;;;;;; -55;;Epv2_total L;PV Energy total;;0.1kWh;;;;;;;;;;; -56;AC Input KWH Today;Eac_chrToday H;AC charge Energy today;;;;;;;;;;;;; -57;;Eac_chrToday L;AC charge Energy today;;0.1kWh;;;;;;;;;;; -58;AC Input KWH Total;Eac_chrTotal H;AC charge Energy total;;;;;;;;;;;;; -59;;Eac_chrTotal L;AC charge Energy total;;0.1kWh;;;;;;;;;;; -60;Battery Discharge KWH Today;Ebat_dischrToday H;Bat discharge Energy today;;;;;;;;;;;;; -61;;Ebat_dischrToday L;Bat discharge Energy today;;0.1kWh;;;;;;;;;;; -62;Battery Discharge KWH Total;Ebat_dischrTotal H;Bat discharge Energy total;;;;;;;;;;;;; -63;;Ebat_dischrTotal L;Bat discharge Energy total;;0.1kWh;;;;;;;;;;; -64;AC Discharge KWH Today;Eac_dischrToday H;AC discharge Energy today;;;;;;;;;;;;; -65;;Eac_dischrToday L;AC discharge Energy today;;0.1kWh;;;;;;;;;;; -66;AC Discharge KWH Total;Eac_dischrTotal H;AC discharge Energy total;;;;;;;;;;;;; -67;;Eac_dischrTotal L;AC discharge Energy total;;0.1kWh;;;;;;;;;;; -68;AC Charge Current;ACChrCurr;AC Charge Battery Current;;0.1;;;;;;;;;;; -69;AC Discharge Watts;AC_DisChrWatt H;AC discharge watt (high);;0.1W;;;;;;;;;;; -70;;AC_DisChrWatt L;AC discharge watt (low);;0.1W;;;;;;;;;;; -71;AC Discharge VA;AC_DisChrVA H;AC discharge apparent power (high);;0.1VA;;;;;;;;;;; -72;;AC_DisChrVA L;AC discharge apparent power (low);;0.1VA;;;;;;;;;;; -73;Battery Discharge Watts;Bat_DisChrWatt H;Bat discharge watt (high);;0.1W;;;;;;;;;;; -74;;Bat_DisChrWatt L;Bat discharge watt (low);;0.1W;;;;;;;;;;; -75;Battery Discharge VA;Bat_DisChrVA H;Bat discharge apparent power (high);;0.1VA;;;;;;;;;;; -76;;Bat_DisChrVA L;Bat discharge apparent power (low);;0.1VA;;;;;;;;;;; -77;Battery Input Watts;Bat_Watt H;Bat watt (high);(signed int 32) Positive:Battery Discharge Power Negative: Battery Charge Power;0.1W;;0.1W;;;;;;;;; -78;;Bat_Watt L;Bat watt (low);;0.1W;;;;;;;;;;; -79;;uwSlaveExistCnt ;uwSlaveExistCnt ;;;;;;;;;;;;; -80;Battery Over Charge Flag;BatOverCharge ;Battery Over Charge Flag ;0:Battery not over charge 1:Battery over charge ;; ;;;;;;;;;; -81;MPPT Fan Speed Percent;MpptFanSpeed ;Fan speed of MPPT Charger ;0~100 ;1.00%;;;;;;;;;;; -82;Inverter Fan Speed Percent;InvFanSpeed ;Fan speed of Inverter ;0~100 ;1.00%;;;;;;;;;;; -83;Total Charge Current;TotalChgCur ;Total Charge current ;;0.1A;;;;;;;;;;; -85;;Eop_dischrToday H ;Op discharge Enerday today ;;;;;;;;;;;;; -86;;Eop_dischrToday L ;;;;;;;;;;;;;; -87;;Eop_dischrTotal H ;Op discharge Enerday total ;;;;;;;;;;;;; -88;;Eop_dischrTotal L ;;;;;;;;;;;;;; -90;Parallel Charge Current;ParaChgCurr ;Para system charge current ;;0.1A;;;;;;;;;;; +register;variable name;documented name;description;value;data type;unit;note;;;;;;;;;; +0;;System Status;System run state;0: Standby;;1; PV an Grid Combine Discharge2: Discharge;3: Fault;4: Flash;5: PV charge;6: AC charge;7: Combine charge;8: Combine charge and Bypass;9: PV charge and Bypass;10: AC charge and Bypass; 11: Bypass;12: PV charge andDischarge +1;PV1 Voltage;Vpv1;PV1 voltage;;;0.1V;;;;;;;;;;; +2;PV2 Voltage;Vpv2;PV2 voltage;;;0.1V;;;;;;;;;;; +3;PV1 Watts;Ppv1 H;PV1 charge power (high);;;0.1W;;;;;;;;;;; +4;;Ppv1 L;PV1 charge power (low);;;0.1W;;;;;;;;;;; +5;PV2 Watts;Ppv2 H;PV2 charge power (high);;;0.1W;;;;;;;;;;; +6;;Ppv2 L;PV2 charge power (low);;;0.1W;;;;;;;;;;; +7;Buck1 Current;Buck1Curr;Buck1 current;;;0.1A;;;;;;;;;;; +8;Buck2 Current;Buck2Curr;Buck2 current;;;0.1A;;;;;;;;;;; +9;Output Wattage;OP_Watt H;Output active power (high);;;0.1W;;;;;;;;;;; +10;;OP_Watt L;Output active power (low);;;0.1W;;;;;;;;;;; +11;Output VA;OP_VA H;Output apparent power (high);;;0.1VA;;;;;;;;;;; +12;;OP_VA L;Output apparent power (low);;;0.1VA;;;;;;;;;;; +13;AC Charge Watts;ACChr_Watt H;AC charge watt (high);;;0.1W;;;;;;;;;;; +14;;ACChr_Watt L;AC charge watt (low);;;0.1W;;;;;;;;;;; +15;AC Charge VA;ACChr_VA H;AC charge apparent power (high);;;0.1VA;;;;;;;;;;; +16;;ACChr_VA L;AC charge apparent power (low);;;0.1VA;;;;;;;;;;; +17;Battery Voltage;Bat Volt;Battery volt (M3);;;0.01V;;;;;;;;;;; +18;Battery SOC;BatterySOC;Battery SOC;0~100;;1.00%;;;;;;;;;;; +19;Bus Voltage;Bus Volt;Bus Voltage;;;0.1V;;;;;;;;;;; +20;Grid Voltage;Grid Volt;AC input Volt;;;0.1V;;;;;;;;;;; +21;Grid Hz;Line Freq;AC input frequency;;;0;;;;;;;;;;; +22;Output Voltage;OutputVolt;AC output Volt;;;0.1V;;;;;;;;;;; +23;Output Hz;OutputFreq;AC output frequency;;;0.01Hz;;;;;;;;;;; +24;Output DCV;Ouput DCV;Ouput DC Volt;;;0.1V;;;;;;;;;;; +25;;InvTemp;Inv Temperature;;;0.1C;;;;;;;;;;; +26;;DcDc Temp;DC-DC Temperature;;;0.1C;;;;;;;;;;; +27;Load Percentage;LoadPercent;Load Percent;0~1000;;0.10%;;;;;;;;;;; +28;Battery Port Voltage;Bat_s_Volt;Battery-port volt (DSP);;;0.01V;;;;;;;;;;; +29;Battery Bus Voltage;Bat_Volt_DSP;Battery-bus volt (DSP);;;0.01V;;;;;;;;;;; +30;;Time total H;Work time total (high);;;0.5;;;;;;;;;;; +31;;Time total L;Work time total (low);;;0. 5S;;;;;;;;;;; +32;Buck1 Temperature;Buck1_NTC;Buck1 Temperature;;;0.1C;;;;;;;;;;; +33;Buck2 Temperature;Buck2_NTC;Buck2 Temperature;;;0.1C;;;;;;;;;;; +34;Output Current;OP_Curr;Output Current;;;0.1A;;;;;;;;;;; +35;Inverter Current;Inv_Curr;Inv Current;;;0.1A;;;;;;;;;;; +36;AC Input Watts;AC_InWatt H;AC input watt (high);;;0.1W;;;;;;;;;;; +37;;AC_InWatt L;AC input watt (low);;;0.1W;;;;;;;;;;; +38;AC Input VA;AC_InVA H;AC input apparent power (high);;;0.1VA;;;;;;;;;;; +39;;AC_InVA L;AC input apparent power (low);;;0.1VA;;;;;;;;;;; +40;;Fault bit;fault bit;&*1;;;;;;;;;;;;; +41;;Warning bit;Warning bit;&*1;;;;;;;;;;;;; +42;;Warning bit high;;;;;;;;;;;;;;; +43;;warning value;warning value;;;;;;;;;;;;;; +44;;DTC;Device Type Code;&*6;;;;;;;;;;;;; +45;;Check Step;Product check step;1:PV1 charge power check 2:PV2 charge power check 3:AC charge Powercheck;;;;;;;;;;;;; +46;;Production Line Mode;Production Line Mode;0: Not at Production Line Mode 1: Production Line Mode 2: Production LineClear Fault Mode;;;;;;;;;;;;; +47;;ConstantPowerOKFlag;Constant Power OK Flag;0: Not OK 1: OK;;;;;;;;;;;;; +48;PV1 KWH Today;Epv1_today H;PV Energy today;;;;;;;;;;;;;; +49;;Epv1_today L;PV Energy today;;;0.1kWh;;;;;;;;;;; +50;PV1 KWH Total;Epv1_total H;PV Energy total;;;;;;;;;;;;;; +51;;Epv1_total L;PV Energy total;;;0.1kWh;;;;;;;;;;; +52;PV2 KWH Today;Epv2_today H;PV Energy today;;;;;;;;;;;;;; +53;;Epv2_today L;PV Energy today;;;0.1kWh;;;;;;;;;;; +54;PV2 KWH Total;Epv2_total H;PV Energy total;;;;;;;;;;;;;; +55;;Epv2_total L;PV Energy total;;;0.1kWh;;;;;;;;;;; +56;AC Input KWH Today;Eac_chrToday H;AC charge Energy today;;;;;;;;;;;;;; +57;;Eac_chrToday L;AC charge Energy today;;;0.1kWh;;;;;;;;;;; +58;AC Input KWH Total;Eac_chrTotal H;AC charge Energy total;;;;;;;;;;;;;; +59;;Eac_chrTotal L;AC charge Energy total;;;0.1kWh;;;;;;;;;;; +60;Battery Discharge KWH Today;Ebat_dischrToday H;Bat discharge Energy today;;;;;;;;;;;;;; +61;;Ebat_dischrToday L;Bat discharge Energy today;;;0.1kWh;;;;;;;;;;; +62;Battery Discharge KWH Total;Ebat_dischrTotal H;Bat discharge Energy total;;;;;;;;;;;;;; +63;;Ebat_dischrTotal L;Bat discharge Energy total;;;0.1kWh;;;;;;;;;;; +64;AC Discharge KWH Today;Eac_dischrToday H;AC discharge Energy today;;;;;;;;;;;;;; +65;;Eac_dischrToday L;AC discharge Energy today;;;0.1kWh;;;;;;;;;;; +66;AC Discharge KWH Total;Eac_dischrTotal H;AC discharge Energy total;;;;;;;;;;;;;; +67;;Eac_dischrTotal L;AC discharge Energy total;;;0.1kWh;;;;;;;;;;; +68;AC Charge Current;ACChrCurr;AC Charge Battery Current;;;0.1;;;;;;;;;;; +69;AC Discharge Watts;AC_DisChrWatt H;AC discharge watt (high);;;0.1W;;;;;;;;;;; +70;;AC_DisChrWatt L;AC discharge watt (low);;;0.1W;;;;;;;;;;; +71;AC Discharge VA;AC_DisChrVA H;AC discharge apparent power (high);;;0.1VA;;;;;;;;;;; +72;;AC_DisChrVA L;AC discharge apparent power (low);;;0.1VA;;;;;;;;;;; +73;Battery Discharge Watts;Bat_DisChrWatt H;Bat discharge watt (high);;;0.1W;;;;;;;;;;; +74;;Bat_DisChrWatt L;Bat discharge watt (low);;;0.1W;;;;;;;;;;; +75;Battery Discharge VA;Bat_DisChrVA H;Bat discharge apparent power (high);;;0.1VA;;;;;;;;;;; +76;;Bat_DisChrVA L;Bat discharge apparent power (low);;;0.1VA;;;;;;;;;;; +77;Battery Input Watts;Bat_Watt H;Bat watt (high);(signed int 32) Positive:Battery Discharge Power Negative: Battery Charge Power;INT;0.1W;;0.1W;;;;;;;;; +78;;Bat_Watt L;Bat watt (low);;;0.1W;;;;;;;;;;; +79;;uwSlaveExistCnt ;uwSlaveExistCnt ;;;;;;;;;;;;;; +80;Battery Over Charge Flag;BatOverCharge ;Battery Over Charge Flag ;0:Battery not over charge 1:Battery over charge ;;; ;;;;;;;;;; +81;MPPT Fan Speed Percent;MpptFanSpeed ;Fan speed of MPPT Charger ;0~100 ;;1.00%;;;;;;;;;;; +82;Inverter Fan Speed Percent;InvFanSpeed ;Fan speed of Inverter ;0~100 ;;1.00%;;;;;;;;;;; +83;Total Charge Current;TotalChgCur ;Total Charge current ;;;0.1A;;;;;;;;;;; +85;;Eop_dischrToday H ;Op discharge Enerday today ;;;;;;;;;;;;;; +86;;Eop_dischrToday L ;;;;;;;;;;;;;;; +87;;Eop_dischrTotal H ;Op discharge Enerday total ;;;;;;;;;;;;;; +88;;Eop_dischrTotal L ;;;;;;;;;;;;;;; +90;Parallel Charge Current;ParaChgCurr ;Para system charge current ;;;0.1A;;;;;;;;;;; From db6d0ed1513c34a96270b0830ecb85c373b864a4 Mon Sep 17 00:00:00 2001 From: HotNoob Date: Tue, 20 Feb 2024 17:35:40 -0600 Subject: [PATCH 4/6] Update protocol_settings.py --- protocol_settings.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/protocol_settings.py b/protocol_settings.py index c1a9488..e06b91c 100644 --- a/protocol_settings.py +++ b/protocol_settings.py @@ -1,12 +1,12 @@ import csv from dataclasses import dataclass -import enum +from enum import Enum import json import re import os -class Data_Type(enum): +class Data_Type(Enum): BYTE = 1 USHORT = 2 UINT = 3 From b29693c453c78fa4ca0b0c052a5feadd1e28c3ec Mon Sep 17 00:00:00 2001 From: HotNoob Date: Tue, 20 Feb 2024 17:36:27 -0600 Subject: [PATCH 5/6] Update protocol_settings.py --- protocol_settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol_settings.py b/protocol_settings.py index e06b91c..878eef4 100644 --- a/protocol_settings.py +++ b/protocol_settings.py @@ -125,7 +125,7 @@ def load__registry(self, path) -> list[registry_map_entry]: numeric_part = float(1) data_type = Data_Type.BYTE - if row['data_type']: + if 'data_type' in row and row['data_type']: data_type = Data_Type.fromString(row['data type']) item = registry_map_entry( From 7b9d4066c9b56507a6965b27087c36206aacb0a4 Mon Sep 17 00:00:00 2001 From: HotNoob Date: Tue, 20 Feb 2024 17:37:18 -0600 Subject: [PATCH 6/6] Update protocol_settings.py --- protocol_settings.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/protocol_settings.py b/protocol_settings.py index 878eef4..bfcdf87 100644 --- a/protocol_settings.py +++ b/protocol_settings.py @@ -125,6 +125,8 @@ def load__registry(self, path) -> list[registry_map_entry]: numeric_part = float(1) data_type = Data_Type.BYTE + + #optional row, only needed for non-default data types if 'data_type' in row and row['data_type']: data_type = Data_Type.fromString(row['data type'])