diff --git a/.gitignore b/.gitignore index 92a3c239..128261ef 100644 --- a/.gitignore +++ b/.gitignore @@ -38,4 +38,6 @@ python_protocol_gateway.egg-info/* inflxudb_backlog/* #ignore dumps for dev -tools/dumps/* \ No newline at end of file +tools/dumps/* +/.vs/PythonProtocolGateway.slnx/FileContentIndex +/.vs diff --git a/classes/protocol_settings.py b/classes/protocol_settings.py index 79205241..f6bfd18b 100644 --- a/classes/protocol_settings.py +++ b/classes/protocol_settings.py @@ -11,7 +11,7 @@ from enum import Enum from typing import TYPE_CHECKING, Union -from defs.common import strtoint +from defs.common import strtoint, strtobool_or_og if TYPE_CHECKING: from configparser import SectionProxy @@ -224,6 +224,8 @@ class registry_map_entry: write_mode : WriteMode = WriteMode.READ ''' enable disable reading/writing ''' + ha_disc : dict[str, any] = None + def __str__(self): return self.variable_name @@ -677,6 +679,15 @@ def process_row(row): if "write" in row: writeMode = WriteMode.fromString(row["write"]) + ha_discovery = {} + if "ha discovery" in row and row["ha discovery"]: + ha_discovery = {key.strip().lower(): strtobool_or_og(value.strip().lower()) for key, value in dict(disc.split(":") for disc in row["ha discovery"].split(",")).items()} + + elif writeMode == WriteMode.WRITE or WriteMode.WRITEONLY: + ha_discovery = dict({'p': 'number', 'enabled_by_default' : True}) + else: + ha_discovery = dict({'p': 'sensor', 'enabled_by_default' : True}) + for i in r: item = registry_map_entry( registry_type = registry_type, @@ -698,7 +709,8 @@ def process_row(row): value_regex=value_regex, read_command = read_command, read_interval=read_interval, - write_mode=writeMode + write_mode=writeMode, + ha_disc = ha_discovery ) registry_map.append(item) @@ -750,29 +762,29 @@ def process_row(row): item = registry_map[index] if index > 0: #if high/low, its a double - if ( - item.documented_name.endswith("_l") - and registry_map[index-1].documented_name.replace("_h", "_l") == item.documented_name - ): - combined_item = registry_map[index-1] + if (item.documented_name.endswith("_l")): + if (registry_map[index-1].documented_name.replace("_h", "_l") == item.documented_name): + combined_item = registry_map[index-1] + elif (registry_map[index+1].documented_name.replace("_h", "_l") == item.documented_name): + combined_item = registry_map[index+1] - if not combined_item.data_type or combined_item.data_type == Data_Type.USHORT: - if registry_map[index].data_type != Data_Type.USHORT: - combined_item.data_type = registry_map[index].data_type - else: - combined_item.data_type = Data_Type.UINT + if not combined_item.data_type or combined_item.data_type == Data_Type.USHORT: + if registry_map[index].data_type != Data_Type.USHORT: + combined_item.data_type = registry_map[index].data_type + else: + combined_item.data_type = Data_Type.UINT - if combined_item.documented_name == combined_item.variable_name: - combined_item.variable_name = combined_item.variable_name[:-2].strip() + if combined_item.documented_name == combined_item.variable_name: + combined_item.variable_name = combined_item.variable_name[:-2].strip() - combined_item.documented_name = combined_item.documented_name[:-2].strip() + combined_item.documented_name = combined_item.documented_name[:-2].strip() - if not combined_item.unit: #fix inconsistsent documentation - combined_item.unit = registry_map[index].unit - combined_item.unit_mod = registry_map[index].unit_mod + if not combined_item.unit: #fix inconsistsent documentation + combined_item.unit = registry_map[index].unit + combined_item.unit_mod = registry_map[index].unit_mod - del registry_map[index] + del registry_map[index] #apply mask if self.variable_mask: diff --git a/classes/transports/mqtt.py b/classes/transports/mqtt.py index a669b006..d4405a9d 100644 --- a/classes/transports/mqtt.py +++ b/classes/transports/mqtt.py @@ -3,6 +3,7 @@ import random import time import warnings +import copy from configparser import SectionProxy import paho.mqtt.client @@ -163,7 +164,10 @@ def write_data(self, data : dict[str, str], from_transport : transport_base): self._log.info(f"write data from [{from_transport.transport_name}] to mqtt transport") self._log.info(data) #have to send this every loop, because mqtt doesnt disconnect when HA restarts. HA bug. - info = self.client.publish(self.base_topic + "/" + from_transport.device_identifier + "/availability","online", qos=0,retain=True) + + #If this is retain= false I think it'll stp showing everything online when PPG disconnects + info = self.client.publish(self.base_topic + "/" + from_transport.device_identifier + "/availability","online", qos=0,retain=False) + if info.rc == MQTT_ERR_NO_CONN: self.connected = False @@ -215,10 +219,25 @@ def mqtt_discovery(self, from_transport : transport_base): device["identifiers"] = "hotnoob_" + from_transport.device_model + "_" + from_transport.device_serial_number device["name"] = from_transport.device_name + #these should probably be read dynamically so it updates automatically on releases... + origin = {} + origin["name"] = "python-protocol-gateway" + origin["sw"] = "1.1.11-dev" + origin["url"] = "https://github.com/HotNoob/PythonProtocolGateway" + registry_map : list[registry_map_entry] = [] for entries in from_transport.protocolSettings.registry_map.values(): registry_map.extend(entries) + disc_payload_base = {} + disc_payload_base["availability_topic"] = self.base_topic + "/" + from_transport.device_identifier + "/availability" + disc_payload_base["device"] = device + disc_payload_base["origin"] = origin + disc_payload_base["cmps"] = {} + disc_payload = copy.deepcopy(disc_payload_base) + + write_only = {} + length = len(registry_map) count = 0 for item in registry_map: @@ -230,7 +249,6 @@ def mqtt_discovery(self, from_transport : transport_base): if item.write_mode == WriteMode.READDISABLED: #disabled continue - clean_name = item.variable_name.lower().replace(" ", "_").strip() if not clean_name: #if name is empty, skip continue @@ -242,37 +260,47 @@ def mqtt_discovery(self, from_transport : transport_base): if self.__holding_register_prefix and item.registry_type == Registry_Type.HOLDING: clean_name = self.__holding_register_prefix + clean_name - print(("#Publishing Topic "+str(count)+" of " + str(length) + ' "'+str(clean_name)+'"').ljust(100)+"#", end="\r", flush=True) #device['sw_version'] = bms_version - disc_payload = {} - disc_payload["availability_topic"] = self.base_topic + "/" + from_transport.device_identifier + "/availability" - disc_payload["device"] = device - disc_payload["name"] = clean_name - disc_payload["unique_id"] = "hotnoob_" + from_transport.device_serial_number + "_"+clean_name + unique_id = "hotnoob_" + from_transport.device_serial_number + "_" + clean_name + disc_payload["cmps"][unique_id] = {} + disc_payload["cmps"][unique_id]["name"] = clean_name + disc_payload["cmps"][unique_id]["unique_id"] = unique_id + disc_payload["cmps"][unique_id].update(item.ha_disc) + writePrefix = "" if from_transport.write_enabled and ( item.write_mode == WriteMode.WRITE or item.write_mode == WriteMode.WRITEONLY ): writePrefix = "" #home assistant doesnt like write prefix - disc_payload["state_topic"] = self.base_topic + "/" +from_transport.device_identifier + writePrefix+ "/"+clean_name + disc_payload["cmps"][unique_id]["state_topic"] = self.base_topic + "/" + from_transport.device_identifier + writePrefix+ "/" + clean_name if item.unit: - disc_payload["unit_of_measurement"] = item.unit - + disc_payload["cmps"][unique_id]["unit_of_measurement"] = item.unit - discovery_topic = self.discovery_topic+"/sensor/HN-" + from_transport.device_serial_number + writePrefix + "/" + disc_payload["name"].replace(" ", "_") + "/config" + discovery_topic = self.discovery_topic+"/device/HN-" + from_transport.device_serial_number + writePrefix + "/config" - self.client.publish(discovery_topic, - json.dumps(disc_payload),qos=1, retain=True) - - #send WO message to indicate topic is write only + #add WO message to be sent later to indicate topic is write only if item.write_mode == WriteMode.WRITEONLY: - self.client.publish(disc_payload["state_topic"], "WRITEONLY") + write_only[disc_payload["cmps"][unique_id]["state_topic"]] = "WRITEONLY" + + #break up items into batches to make the messages smaller + if len(disc_payload["cmps"]) > 10: + self.client.publish(discovery_topic, json.dumps(disc_payload),qos=1, retain=True) + #reset component list for next batch + disc_payload = copy.deepcopy(disc_payload_base) + time.sleep(0.07) + + #publish whatever is left + if len(disc_payload["cmps"]) > 0: + self.client.publish(discovery_topic, json.dumps(disc_payload),qos=1, retain=True) + time.sleep(0.07) #slow down for better reliability + for t, val in write_only.items(): + self.client.publish(t, val) time.sleep(0.07) #slow down for better reliability - self.client.publish(disc_payload["availability_topic"],"online",qos=0, retain=True) + self.client.publish(disc_payload["availability_topic"],"online",qos=0, retain=False) print() self._log.info("Published HA "+str(count)+"x Discovery Topics") diff --git a/defs/common.py b/defs/common.py index fb20b770..dfe7ee50 100644 --- a/defs/common.py +++ b/defs/common.py @@ -17,6 +17,19 @@ def strtobool (val): return 0 +def strtobool_or_og(val): + """Convert a string representation of truth to boolean if it represents a boolean otherwise returns the original value. + True values are 'y', 'yes', 't', 'true', 'on', and '1' + False values are 'n', 'no', 'f', 'false', 'off', and '0' + """ + if isinstance(val, str): + clean_val = val.strip().lower() + if clean_val in ("y", "yes", "t", "true", "on", "1"): + return True + elif clean_val in ("n", "no", "f", "false", "off", "0"): + return False + return val + def strtoint(val : str) -> int: ''' converts str to int, but allows for hex string input, identified by x prefix''' diff --git a/protocols/eg4/eg4_v58.input_registry_map.csv b/protocols/eg4/eg4_v58.input_registry_map.csv index 928feda7..18d04121 100644 --- a/protocols/eg4/eg4_v58.input_registry_map.csv +++ b/protocols/eg4/eg4_v58.input_registry_map.csv @@ -1,76 +1,76 @@ -variable name,data type,register,documented name,unit,values,note,,,,,,,,,,,, +variable name,data type,register,documented name,unit,values,note,ha discovery,,,,,,,,,,, ,,0,State,,0-65535,For more information,,,,,,,,,,,, -PV1 Voltage,,1,Vpv1,0.1V,0-65535,PV1 voltage,,,,,,,,,,,, -PV2 Voltage,,2,Vpv2,0.1V,0-65535,PV2 voltage,,,,,,,,,,,, -PV3 Voltage,,3,Vpv3,0.1V,0-65536,PV3 voltage,,,,,,,,,,,, -,,4,Vbat,0.1V,0-65535,Battery voltage,,,,,,,,,,,, -,8bit,5,SOC,%,0-100,Battery capacity,,,,,,,,,,,, +PV1 Voltage,,1,Vpv1,0.1V,0-65535,PV1 voltage,"device_class: voltage,state_class: measurement, p: sensor, enabled_by_default: true",,,,,,,,,,, +PV2 Voltage,,2,Vpv2,0.1V,0-65535,PV2 voltage,"device_class: voltage,state_class: measurement, p: sensor, enabled_by_default: true",,,,,,,,,,, +PV3 Voltage,,3,Vpv3,0.1V,0-65535,PV3 voltage,"device_class: voltage,state_class: measurement, p: sensor, enabled_by_default: false",,,,,,,,,,, +,,4,Vbat,0.1V,0-65535,Battery voltage,"device_class: voltage,state_class: measurement, p: sensor, enabled_by_default: true",,,,,,,,,,, +,8bit,5,SOC,%,0-100,Battery capacity,"device_class: energy_storage,state_class: measurement, p: sensor, enabled_by_default: true",,,,,,,,,,, ,8bit,5.b8,SOH,%,0-100,Battery State of health,,,,,,,,,,,, ,,6,Internal Fault,,0-65535,For more information,,,,,,,,,,,, -,,7,Ppv1,W,0-65535,PV1 power/ AC enery storage Ppv,,,,,,,,,,,, -,,8,Ppv2,W,0-65535,PV2 power,,,,,,,,,,,, -,,9,Ppv3,W,0-65536,PV3 power (total PV power,,,,,,,,,,,, -,,10,Pcharge,W,0-65535,Charging power (power flowing into the battery),,,,,,,,,,,, -,,11,Pdischarge,W,0-65535,Discharging power (power flowing out of battery power),,,,,,,,,,,, -,,12,VacR,0.1V,0-65535,R-phase utility grid voltage,,,,,,,,,,,, -,,13,VacS,0.1V,0-65535,S-phase utility grid voltage,,,,,,,,,,,, -,,14,VacT,0.1V,0-65535,T-phase utility grid voltage,,,,,,,,,,,, -Grid Hz,,15,Fac,0.01Hz,0-65535,Utility grid frequency,,,,,,,,,,,, -,,16,Pinv,W,0-65535,On-gird inverter power (For three phase: R phase),,,,,,,,,,,, -,,17,Prec,W,0-65535,AC charging rectification power (For three phase: R phase),,,,,,,,,,,, -,,18,IinvRMS,0.01A,0-65535,Inverter rms current output (For three phase: R phase),,,,,,,,,,,, -,,19,PF,0.001,0-2000,Power factor x?(0,,,,,,,,,,,, -,,20,VepsR,0.1V,0-65535,R phase off-grid output voltage,,,,,,,,,,,, -,,21,VepsS,0.1V,0-65535,S phase off-grid output voltage,,,,,,,,,,,, -,,22,VepsT,0.1V,0-65535,T phase off-grid output voltage,,,,,,,,,,,, -,,23,Feps,0.01Hz,0-65535,Off-grid output frequency,,,,,,,,,,,, -,,24,Peps,W,0-65535,Off-grid inverter power (For three phase: R phase),,,,,,,,,,,, -,,25,Seps,VA,0-65535,Off-grid apparent power (For three phase: R phase),,,,,,,,,,,, -,,26,Ptogrid,W,0-65535,User on-grid power (For three phase: R phase),,,,,,,,,,,, -,,27,Ptouser,W,0-65535,Grid power capacity (For three phase: R phase),,,,,,,,,,,, -,,28,Epv1_day,0.1kWh,0-65535,PV1 power generation today / AC Energy Storage Epv_day,,,,,,,,,,,, -,,29,Epv2_day,0.1kWh,0-65535,PV2 power generation today,,,,,,,,,,,, -,,30,Epv3_day,0.1kWh,0-65535,PV3 power generation today (total PV=PV1+PV2+PV3),,,,,,,,,,,, -,,31,Einv_day,0.1kWh,0-65535,Today's on-grid inverter output energy,,,,,,,,,,,, -,,32,Erec_day,0.1kWh,0-65535,Today's AC charging rectifier energy,,,,,,,,,,,, -,,33,Echg_day,0.1kWh,0-65535,Energy Charge today,,,,,,,,,,,, -,,34,Edischg_day,0.1kWh,0-65535,Energy Discharge today,,,,,,,,,,,, -,,35,Eeps_day,0.1kWh,0-65535,Today's off-grid output energy,,,,,,,,,,,, -,,36,Etogrid_day,0.1kWh,0-65535,Today's export to gird energy,,,,,,,,,,,, -,,37,Etouser_day,0.1kWh,0-65535,Electricity supplied to user from the grid today,,,,,,,,,,,, -,,38,Vbus1,0.1V,0-65535,Voltage of Bus 1,,,,,,,,,,,, -,,39,Vbus2,0.1V,0-65535,Voltage of Bus 2,,,,,,,,,,,, -,,40,Epv1_all L,0.1kWh,0-65535,PV1 cumulative power generation/AC energy storage Epv_all Low byte,,,,,,,,,,,, -,,41,Epv1_all H,0.1kWh,0-65535,PV1 cumulative power generation/AC energy storage Epv_all high byte,,,,,,,,,,,, -,,42,Epv2_all L,0.1kWh,0-65535,PV2 cumulative power generation low byte,,,,,,,,,,,, -,,43,Epv2_all H,0.1kWh,0-65535,PV2 cumulative power generation high byte,,,,,,,,,,,, -,,44,Epv3_all L,0.1kWh,0-65535,PV3 cumulative power generation low byte (total PV=PV1+PV2+PV3),,,,,,,,,,,, -,,45,Epv3_all H,0.1kWh,0-65535,PV3 cumulative power generation high byte (total PV=PV1+PV2+PV3),,,,,,,,,,,, -,,46,Einv_all L,0.1kWh,0-65535,Inverter output accumulated power low byte,,,,,,,,,,,, -,,47,Einv_all H,0.1kWh,0-65535,Inverter output accumulates power high byte,,,,,,,,,,,, -,,48,Erec_all L,0.1kWh,0-65535,AC charging accumulates rectified power Low byte,,,,,,,,,,,, -,,49,Erec_all H,0.1kWh,0-65535,AC charging accumulates rectified power high byte,,,,,,,,,,,, -,,50,Echg_all L,0.1kWh,0-65535,Cumulative charge energy low byte,,,,,,,,,,,, -,,51,Echg_all H,0.1kWh,0-65535,Cumulative charge energy high byte,,,,,,,,,,,, -,,52,Edischg_all L,0.1kWh,0-65535,Cumulative discharge charge energy Low byte,,,,,,,,,,,, -,,53,Edischg_all H,0.1kWh,0-65535,Cumulative discharge charge energy High byte,,,,,,,,,,,, -,,54,Eeps_all L,0.1kWh,0-65535,Cumulative inverter off-grid output energy Low byte,,,,,,,,,,,, -,,55,Eeps_all H,0.1kWh,0-65535,Cumulative inverter off-grid output energy High byte,,,,,,,,,,,, -,,56,Etogrid_all L,0.1kWh,0-65535,Accumulate export energy Low byte,,,,,,,,,,,, -,,57,Etogrid_all H,0.1kWh,0-65535,Accumulate export energy High byte,,,,,,,,,,,, -,,58,Etouser_all L,0.1kWh,0-65535,Cumulative import energy Low byte,,,,,,,,,,,, -,,59,Etouser_all H,0.1kWh,0-65535,Cumulative import energy high byte,,,,,,,,,,,, -,,60,FaultCode L,,0-65535,For more information,,,,,,,,,,,, -,,61,FaultCode H,,0-65535,For more information,,,,,,,,,,,, -,,62,WarningCode L,,0-65535,For more information,,,,,,,,,,,, -,,63,WarningCode H,,0-65535,For more information,,,,,,,,,,,, -,,64,Tinner,celsius,0-65535,Internal temperature,,,,,,,,,,,, -,,65,Tradiator1,Celsius,0-65535,Radiator temperature 1,,,,,,,,,,,, -,,66,Tradiator2,celsius,0-65535,Radiator temperature 2,,,,,,,,,,,, -,,67,Tbat,celsius,0-65535,Battery temperature,,,,,,,,,,,, -,,69,RunningTime L,second,,Runtime duration,,,,,,,,,,,, -,,70,RunningTime H,second,,Runtime duration,,,,,,,,,,,, -,4bit,71,AutoTestStart,Bit0-3,,0 - not started , 1 - started,,,,,,,,,,, +,,7,Ppv1,W,0-65535,PV1 power/ AC enery storage Ppv,"device_class: power,state_class: measurement, p: sensor, enabled_by_default: true",power,measurement,,,,,,,,, +,,8,Ppv2,W,0-65535,PV2 power,"device_class: power,state_class: measurement, p: sensor, enabled_by_default: true",power,measurement,,,,,,,,, +,,9,Ppv3,W,0-65536,PV3 power (total PV power,"device_class: power,state_class: measurement, p: sensor, enabled_by_default: true",power,measurement,,,,,,,,, +,,10,Pcharge,W,0-65535,Charging power (power flowing into the battery),"device_class: power,state_class: measurement, p: sensor, enabled_by_default: true",power,measurement,,,,,,,,, +,,11,Pdischarge,W,0-65535,Discharging power (power flowing out of battery power),"device_class: power,state_class: measurement, p: sensor, enabled_by_default: true",power,measurement,,,,,,,,, +,,12,VacR,0.1V,0-65535,R-phase utility grid voltage,"device_class: voltage,state_class: measurement, p: sensor, enabled_by_default: true",voltage,measurement,,,,,,,,, +,,13,VacS,0.1V,0-65535,S-phase utility grid voltage,"device_class: voltage,state_class: measurement, p: sensor, enabled_by_default: false",voltage,measurement,,,,,,,,, +,,14,VacT,0.1V,0-65535,T-phase utility grid voltage,"device_class: voltage,state_class: measurement, p: sensor, enabled_by_default: false",voltage,measurement,,,,,,,,, +Grid Hz,,15,Fac,0.01Hz,0-65535,Utility grid frequency,,frequency,measurement,,,,,,,,, +,,16,Pinv,W,0-65535,On-gird inverter power (For three phase: R phase),"device_class: power,state_class: measurement, p: sensor, enabled_by_default: true",power,measurement,,,,,,,,, +,,17,Prec,W,0-65535,AC charging rectification power (For three phase: R phase),"device_class: power,state_class: measurement, p: sensor, enabled_by_default: true",power,measurement,,,,,,,,, +,,18,IinvRMS,0.01A,0-65535,Inverter rms current output (For three phase: R phase),"device_class: current,state_class: measurement, p: sensor, enabled_by_default: true",current,measurement,,,,,,,,, +,,19,PF,0.001,0-2000,Power factor x?(0,,power_factor,measurement,,,,,,,,, +,,20,VepsR,0.1V,0-65535,R phase off-grid output voltage,,voltage,measurement,,,,,,,,, +,,21,VepsS,0.1V,0-65535,S phase off-grid output voltage,,voltage,measurement,,,,,,,,, +,,22,VepsT,0.1V,0-65535,T phase off-grid output voltage,,voltage,measurement,,,,,,,,, +,,23,Feps,0.01Hz,0-65535,Off-grid output frequency,,frequency,measurement,,,,,,,,, +,,24,Peps,W,0-65535,Off-grid inverter power (For three phase: R phase),,power,measurement,,,,,,,,, +,,25,Seps,VA,0-65535,Off-grid apparent power (For three phase: R phase),,apparent_power,measurement,,,,,,,,, +,,26,Ptogrid,W,0-65535,User on-grid power (For three phase: R phase),,power,measurement,,,,,,,,, +,,27,Ptouser,W,0-65535,Grid power capacity (For three phase: R phase),,power,measurement,,,,,,,,, +,,28,Epv1_day,0.1kWh,0-65535,PV1 power generation today / AC Energy Storage Epv_day,,energy,total,,,,,,,,, +,,29,Epv2_day,0.1kWh,0-65535,PV2 power generation today,,energy,total,,,,,,,,, +,,30,Epv3_day,0.1kWh,0-65535,PV3 power generation today (total PV=PV1+PV2+PV3),,energy,total,,,,,,,,, +,,31,Einv_day,0.1kWh,0-65535,Today's on-grid inverter output energy,,energy,total,,,,,,,,, +,,32,Erec_day,0.1kWh,0-65535,Today's AC charging rectifier energy,,energy,total,,,,,,,,, +,,33,Echg_day,0.1kWh,0-65535,Energy Charge today,,energy,total,,,,,,,,, +,,34,Edischg_day,0.1kWh,0-65535,Energy Discharge today,,energy,total,,,,,,,,, +,,35,Eeps_day,0.1kWh,0-65535,Today's off-grid output energy,,energy,total,,,,,,,,, +,,36,Etogrid_day,0.1kWh,0-65535,Today's export to gird energy,,energy,total,,,,,,,,, +,,37,Etouser_day,0.1kWh,0-65535,Electricity supplied to user from the grid today,,energy,total,,,,,,,,, +,,38,Vbus1,0.1V,0-65535,Voltage of Bus 1,,voltage,measurement,,,,,,,,, +,,39,Vbus2,0.1V,0-65535,Voltage of Bus 2,,voltage,measurement,,,,,,,,, +,,40,Epv1_all_l,0.1kWh,0-65535,PV1 cumulative power generation/AC energy storage Epv_all Low byte,,energy,total,,,,,,,,, +,,41,Epv1_all_h,0.1kWh,0-65535,PV1 cumulative power generation/AC energy storage Epv_all high byte,,energy,total,,,,,,,,, +,,42,Epv2_all_l,0.1kWh,0-65535,PV2 cumulative power generation low byte,,energy,total,,,,,,,,, +,,43,Epv2_all_h,0.1kWh,0-65535,PV2 cumulative power generation high byte,,energy,total,,,,,,,,, +,,44,Epv3_all_l,0.1kWh,0-65535,PV3 cumulative power generation low byte (total PV=PV1+PV2+PV3),,energy,total,,,,,,,,, +,,45,Epv3_all_h,0.1kWh,0-65535,PV3 cumulative power generation high byte (total PV=PV1+PV2+PV3),,energy,total,,,,,,,,, +,,46,Einv_all_l,0.1kWh,0-65535,Inverter output accumulated power low byte,,energy,total,,,,,,,,, +,,47,Einv_all_h,0.1kWh,0-65535,Inverter output accumulates power high byte,,energy,total,,,,,,,,, +,,48,Erec_all_l,0.1kWh,0-65535,AC charging accumulates rectified power Low byte,,energy,total,,,,,,,,, +,,49,Erec_all_h,0.1kWh,0-65535,AC charging accumulates rectified power high byte,,energy,total,,,,,,,,, +,,50,Echg_all_l,0.1kWh,0-65535,Cumulative charge energy low byte,,energy,total,,,,,,,,, +,,51,Echg_all_h,0.1kWh,0-65535,Cumulative charge energy high byte,,energy,total,,,,,,,,, +,,52,Edischg_all_l,0.1kWh,0-65535,Cumulative discharge charge energy Low byte,,energy,total,,,,,,,,, +,,53,Edischg_all_h,0.1kWh,0-65535,Cumulative discharge charge energy High byte,,energy,total,,,,,,,,, +,,54,Eeps_all_l,0.1kWh,0-65535,Cumulative inverter off-grid output energy Low byte,,energy,total,,,,,,,,, +,,55,Eeps_all_h,0.1kWh,0-65535,Cumulative inverter off-grid output energy High byte,,energy,total,,,,,,,,, +,,56,Etogrid_all_l,0.1kWh,0-65535,Accumulate export energy Low byte,,energy,total,,,,,,,,, +,,57,Etogrid_all_h,0.1kWh,0-65535,Accumulate export energy High byte,,energy,total,,,,,,,,, +,,58,Etouser_all_l,0.1kWh,0-65535,Cumulative import energy Low byte,,energy,total,,,,,,,,, +,,59,Etouser_all_h,0.1kWh,0-65535,Cumulative import energy high byte,,energy,total,,,,,,,,, +,,60,FaultCode_l,,0-65535,For more information,,,,,,,,,,,, +,,61,FaultCode_h,,0-65535,For more information,,,,,,,,,,,, +,,62,WarningCode_l,,0-65535,For more information,,,,,,,,,,,, +,,63,WarningCode_h,,0-65535,For more information,,,,,,,,,,,, +,,64,Tinner,celsius,0-65535,Internal temperature,,temperature,measurement,,,,,,,,, +,,65,Tradiator1,Celsius,0-65535,Radiator temperature 1,,temperature,measurement,,,,,,,,, +,,66,Tradiator2,celsius,0-65535,Radiator temperature 2,,temperature,measurement,,,,,,,,, +,,67,Tbat,celsius,0-65535,Battery temperature,,temperature,measurement,,,,,,,,, +,,69,RunningTime_l,second,,Runtime duration,,duration,,,,,,,,,, +,,70,RunningTime_h,second,,Runtime duration,,duration,,,,,,,,,, +,4bit,71,AutoTestStart,Bit0-3,,0 - not started ,,,,,,,,,,,, ,4bit,71.b4,UbAutoTestStatus,Bit4-7,,0-waiting 1-testing 2-test fail 3-V test OK 4-F test OK 5- test pass,,,,,,,,,,,, ,4bit,71.b8,UbAutoTestStep,Bit8-11,,1-V1L test 2-V1H 3-F1L test 4-F1H test 5-V2L test 6-V2H test 7-F2L test 8-F2H test,,,,,,,,,,,, ,,72,wAutoTestLimit,0.1V/0. 01Hz,,"When ubAuto Test Step=1,2,5,6, is the voltage limit; When ubAutoTest Step=3,4,7,8, it is the frequency limit",,,,,,,,,,,, @@ -82,10 +82,10 @@ Grid Hz,,15,Fac,0.01Hz,0-65535,Utility grid frequency,,,,,,,,,,,, ,1bit,77.b2,ACCoupleEn,Bit2,0 or 1,0-Disable 1-Enable,,,,,,,,,,,, ,4bit,80,BatTypeAndBrand,,,For more information,,,,,,,,,,,, ,4bit,80.b4,BatComType,,0 or 1,0-CAN 1-485,,,,,,,,,,,, -,,81,MaxChgCurr,0.01A,,The maximum charging current of BMS limits,,,,,,,,,,,, -,,82,MaxDischgCurr,0.01A,,The maximum discharging current of BMS limits,,,,,,,,,,,, -,,83,ChargeVoltRef,0.1V,,Recommends charging voltage by BMS,,,,,,,,,,,, -,,84,DischgCutVolt,0.1V,,Recommends a discharging cut-off voltage by BMS,,,,,,,,,,,, +,,81,MaxChgCurr,0.01A,,The maximum charging current of BMS limits,,current,,,,,,,,,, +,,82,MaxDischgCurr,0.01A,,The maximum discharging current of BMS limits,,current,,,,,,,,,, +,,83,ChargeVoltRef,0.1V,,Recommends charging voltage by BMS,,voltage,,,,,,,,,, +,,84,DischgCutVolt,0.1V,,Recommends a discharging cut-off voltage by BMS,,voltage,,,,,,,,,, ,,85,BatStatus0_BMS,,,Status information of BMS,,,,,,,,,,,, ,,86,BatStatus1_BMS,,,Status information of BMS,,,,,,,,,,,, ,,87,BatStatus2_BMS,,,Status information of BMS,,,,,,,,,,,, @@ -99,14 +99,14 @@ Grid Hz,,15,Fac,0.01Hz,0-65535,Utility grid frequency,,,,,,,,,,,, ,,95,BatStatus_INV,,,The inverter aggregates lithium battery status information,,,,,,,,,,,, ,,96,BatParallelNum,,,Number of batteries in parallel,,,,,,,,,,,, ,,97,BatCapacity,Ah,,Battery capacity,,,,,,,,,,,, -,SHORT,98,BatCurrent_BMS,0.1A,,Battery current ,,,,,,,,,,,, +,SHORT,98,BatCurrent_BMS,0.1A,,Battery current ,,current,,,,,,,,,, ,,99,FaultCode_BMS,,,,,,,,,,,,,,, ,,100,WarningCode_BMS,,,,,,,,,,,,,,, -,,101,MaxCellVolt_BMS,0.001V,,Maximum voltage of cell,,,,,,,,,,,, -,,102,MinCellVolt_BMS,0.001V,,Minimum voltage of cell,,,,,,,,,,,, -,SHORT,103,MaxCellTemp_BMS,0.1C,,Maximum temperature of cell,,,,,,,,,,,, -,SHORT,104,MinCellTemp_BMS,0.1C,,Minimum temperature of cell,,,,,,,,,,,, -,,105,BMSFWUpdateState,,1-3,1-Upgrade in process 2-Upgrade successful 3- Upgrade failed,,,,,,,,,,,, +,,101,MaxCellVolt_BMS,0.001V,,Maximum voltage of cell,,voltage,,,,,,,,,, +,,102,MinCellVolt_BMS,0.001V,,Minimum voltage of cell,,voltage,,,,,,,,,, +,SHORT,103,MaxCellTemp_BMS,0.1C,,Maximum temperature of cell,,temperature,,,,,,,,,, +,SHORT,104,MinCellTemp_BMS,0.1C,,Minimum temperature of cell,,temperature,,,,,,,,,, +,,105,BMSFWUpdateState,,3-Jan,1-Upgrade in process 2-Upgrade successful 3- Upgrade failed,,,,,,,,,,,, ,,106,CycleCnt_BMS,,,Number of charging/discharging cycles,,,,,,,,,,,, ,,107,BatVoltSample_INV,0.1V,,Tnverter samples the battery voltage,,,,,,,,,,,, ,,108,T1,0.1C,,BT temperature for 12k,,,,,,,,,,,, @@ -115,10 +115,10 @@ Grid Hz,,15,Fac,0.01Hz,0-65535,Utility grid frequency,,,,,,,,,,,, ,,111,T4,0.1C,,Reserved,,,,,,,,,,,, ,,112,T5,0.1C,,Reserved,,,,,,,,,,,, ,2bit,113,MasterOrSlave,Bit0~1,1,2,,,,,,,,,,,, -,2bit,113.b2,SingleOrThreePhase,Bit2~3,1-3,1:R, 2:S , 3:T, Parallel phase 1:R 2:S 3:T,,,,,,,,, +,2bit,113.b2,SingleOrThreePhase,Bit2~3,3-Jan,1:R,,,,,,,,,,,, ,4bit,113.b4,Resvd,Bit4~7,,Reserved,,,,,,,,,,,, ,8bit,113.b8,ParallelNum,Bit8~16,1~255,Number of inverters in parallel,,,,,,,,,,,, -,,114,OnGridloadPower,W,,Load power of the 12k inverter when it is not off-grid,,,,,,,,,,,, +,,114,OnGridloadPower,W,,Load power of the 12k inverter when it is not off-grid,,power,,,,,,,,,, ,8bit,115,SN_0__Year,,[0-9a-zA-Z],The serial number is a ten-digit ASCII code For example: The serial number is AB12345678 SN[0]=0x41(A) : : : : SN[9]=0x38(8),,,,,,,,,,,, ,8bit,115.b8,SN_1__week,,[0-9a-zA-Z],,,,,,,,,,,,, ,8bit,116,SN_2__week,,[0-9a-zA-Z],,,,,,,,,,,,, @@ -130,13 +130,13 @@ Grid Hz,,15,Fac,0.01Hz,0-65535,Utility grid frequency,,,,,,,,,,,, ,8bit,119,SN_8__serial number,,[0-9a-zA-Z],,,,,,,,,,,,, ,8bit,119.b8,SN_9__serial number,,[0-9a-zA-Z],,,,,,,,,,,,, ,ASCII_LE,115~119,Serial Number,,,Serial Number as one string instead of split,,,,,,,,,,,, -,,120,VBusP,0.1V,,,Half BUS voltage,Half BUS voltage,Half BUS voltage,Half BUS voltage,Half BUS voltage,Half BUS voltage,Half BUS voltage,Half BUS voltage,Half BUS voltage,Half BUS voltage,Half BUS voltage,Half BUS voltage -,,121,GenVolt,0.1V,,Generator voltage Voltage of generator for three phase: R phase,,,,,,,,,,,, -,,122,GenFreq,0.01Hz,,Generator frequency,,,,,,,,,,,, -,,123,GenPower,W,,Voltage of generator for three phase: R phase,,,,,,,,,,,, -,,124,Egen_day,0.1kWh,,Energy of generator today,,,,,,,,,,,, -,,125,Egen_all L,0.1kWh,,Low byte of total generator energy,,,,,,,,,,,, -,,126,Egen_all H,0.1kWh,,High byte of total generator energy,,,,,,,,,,,, +,,120,VBusP,0.1V,,,,voltage,,Half BUS voltage,Half BUS voltage,Half BUS voltage,Half BUS voltage,Half BUS voltage,Half BUS voltage,Half BUS voltage,Half BUS voltage,Half BUS voltage +,,121,GenVolt,0.1V,,Generator voltage Voltage of generator for three phase: R phase,,voltage,,,,,,,,,, +,,122,GenFreq,0.01Hz,,Generator frequency,,frequency,,,,,,,,,, +,,123,GenPower,W,,Voltage of generator for three phase: R phase,,power,,,,,,,,,, +,,124,Egen_day,0.1kWh,,Energy of generator today,,energy,,,,,,,,,, +,,125,Egen_all_l,0.1kWh,,Low byte of total generator energy,,,,,,,,,,,, +,,126,Egen_all_h,0.1kWh,,High byte of total generator energy,,,,,,,,,,,, ,,127,EPSVoltL1N,0.1V,,Voltage of EPS L1N Voltage of generator for three phase: S phase,,,,,,,,,,,, ,,128,EPSVoltL2N,0.1V,,Voltage of EPS L2N Voltage of generator for three phase: T phase,,,,,,,,,,,, ,,129,Peps_L1N,W,,Active power of EPS L1N Off-grid active power of three phase: S phase,,,,,,,,,,,, @@ -145,10 +145,10 @@ Grid Hz,,15,Fac,0.01Hz,0-65535,Utility grid frequency,,,,,,,,,,,, ,,132,Seps_L2N,VA,,Apparent power of EPS L2N Off-grid apparent power of three phase: T phase,,,,,,,,,,,, ,,133,EepsL1N_day,0.1kWh,,Daily energy of EPSL1N Off-grid daily energy of three phase: S phase,,,,,,,,,,,, ,,134,EepsL2N_day,0.1kWh,,Daily energy of EPSL2N Off-grid daily energy of three phase: T phase,,,,,,,,,,,, -,,135,EepsL1N_all L,0.1kWh,,Low byte of total EPSL1N energy Total off-grid power of three phase: S phase,,,,,,,,,,,, -,,136,EepsL1N_all H,0.1kWh,,High byte of total EPSL1N energy Total off-grid power of three cameras: S phase,,,,,,,,,,,, -,,137,EepsL2N_all L,0.1kWh,,Low word of total EPSL2N energy Total off-grid power of three phase: T phase,,,,,,,,,,,, -,,138,EepsL2N_all H,0.1kWh,,High byte of total EPSL2N energy Total off-grid power of three byte: T phase,,,,,,,,,,,, +,,135,EepsL1N_all_l,0.1kWh,,Low byte of total EPSL1N energy Total off-grid power of three phase: S phase,,,,,,,,,,,, +,,136,EepsL1N_all_h,0.1kWh,,High byte of total EPSL1N energy Total off-grid power of three cameras: S phase,,,,,,,,,,,, +,,137,EepsL2N_all_l,0.1kWh,,Low word of total EPSL2N energy Total off-grid power of three phase: T phase,,,,,,,,,,,, +,,138,EepsL2N_all_h,0.1kWh,,High byte of total EPSL2N energy Total off-grid power of three byte: T phase,,,,,,,,,,,, ,,140,AFCI_CurrCH1,mA,,AFCI current,,,,,,,,,,,, ,,141,AFCI_CurrCH2,mA,,AFCI current,,,,,,,,,,,, ,,142,AFCI_CurrCH3,mA,,AFCI current,,,,,,,,,,,, @@ -177,8 +177,8 @@ Grid Hz,,15,Fac,0.01Hz,0-65535,Utility grid frequency,,,,,,,,,,,, ,,169,AutoTestTripTime _7_,ms,,,,,,,,,,,,,, ,,170,Pload,W,,,,,,,,,,,,,, ,,171,Eload_day,0.1kWh,,,,,,,,,,,,,, -,,172,Eload_allL,0.1kWh,,,,,,,,,,,,,, -,,173,Eload_allH,0.1kWh,,,,,,,,,,,,,, +,,172,Eload_all_l,0.1kWh,,,,,,,,,,,,,, +,,173,Eload_all_h,0.1kWh,,,,,,,,,,,,,, ,4bit,174,SwitchState_SafetySw,Bit0~4,0~0x1F,The status of the 5-digit safety DIP switch,,,,,,,,,,,, ,,180,Pinv_S,W,0-65535,On grid inverter power of three phase: S phase,,,,,,,,,,,, ,,181,Pinv_T,W,0-65535,On grid inverter power of three phase: T phase,,,,,,,,,,,,