diff --git a/ChangeLog.md b/ChangeLog.md index 416230f..a6407a1 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,3 +1,10 @@ +Release 3.2.1: + - add modbusprotocoll doc for Solax-X1/X3 G4 (incl. write register) (thanks to @lattemacchiato) (#64) + - fix bug in solax-x1.json at EnergyTotalToGrid + - add Solax-Mic-Pro configuration, thanks to michacee (#35) + - add support for Growatt-MOD_4000_TL3-XH, thanks to Gustavw82 (#70). + - add page loading visualization + Release 3.2.0: - move register.h from PROGMEM into seperate files at FS - change deprecated SPIFFS to LittleFS diff --git a/data/regs/Deye_SUN_SG04LP3.json b/data/regs/Deye_SUN_SG04LP3.json index 584d534..548a123 100644 --- a/data/regs/Deye_SUN_SG04LP3.json +++ b/data/regs/Deye_SUN_SG04LP3.json @@ -1,6 +1,7 @@ { "Deye SUN-xx-SG04LP3": { "config": { + "author": "MagicSven81", "RequestLiveData": [ [ "#ClientID", @@ -1141,7 +1142,7 @@ "name": "PV1DCCurrent", "realname": "PV1 DC Current", "datatype": "float", - "factor": 0.01, + "factor": 0.1, "unit": "A" }, { @@ -1163,7 +1164,7 @@ "name": "PV2DCCurrent", "realname": "PV2 DC Current", "datatype": "float", - "factor": 0.01, + "factor": 0.1, "unit": "A" }, { @@ -1185,7 +1186,7 @@ "name": "PV3DCCurrent", "realname": "PV3 DC Current", "datatype": "float", - "factor": 0.01, + "factor": 0.1, "unit": "A" }, { @@ -1207,7 +1208,7 @@ "name": "PV4DCCurrent", "realname": "PV4 DC Current", "datatype": "float", - "factor": 0.01, + "factor": 0.1, "unit": "A" } ], diff --git a/data/regs/Growatt-MOD.json b/data/regs/Growatt-MOD.json new file mode 100644 index 0000000..9d6379b --- /dev/null +++ b/data/regs/Growatt-MOD.json @@ -0,0 +1,716 @@ +{ + "Growatt-MOD_4000_TL3-XH": { + "config": { + "author": "Gustavw82", + "RequestLiveData": [ + [ + "#ClientID", + "0x04", + "0x00", + "0x00", + "0x00", + "0x77" + ], + [ + "#ClientID", + "0x04", + "0x0C", + "0x1C", + "0x00", + "0x77" + ] + ], + "RequestIdData": [ + "#ClientID", + "0x03", + "0x00", + "0x78", + "0x00", + "0x77" + ], + "ClientIdPos": 0, + "LiveDataFunctionCodePos": 1, + "LiveDataFunctionCode": "0x04", + "IdDataFunctionCodePos": 1, + "IdDataFunctionCode": "0x03", + "LiveDataStartsAtPos": 3, + "IdDataStartsAtPos": 3, + "LiveDataErrorPos": 1, + "LiveDataErrorCode": "0x84", + "IdDataErrorPos": 1, + "IdDataErrorCode": "0x83", + "LiveDataSuccessPos": 1, + "LiveDataSuccessCode": "0x04", + "IdDataSuccessPos": 1, + "IdDataSuccessCode": "0x03" + }, + "data": { + "livedata": [ + { + "position": [ + 3, + 4 + ], + "name": "InverterRunState", + "realname": "Inverter Status", + "datatype": "integer", + "mapping": [ + [ + 0, + "WaitMode" + ], + [ + 1, + "NormalMode" + ], + [ + 3, + "FaultMode" + ] + ] + }, + { + "position": [ + 5, + 6, + 7, + 8 + ], + "name": "InputPower", + "realname": "Erzeugungsleistung Gesamt", + "openwbtopic": "openWB/set/pv/W", + "datatype": "float", + "factor": 0.1, + "unit": "W" + }, + { + "position": [ + 13, + 14, + 15, + 16 + ], + "name": "PowerPv1", + "realname": "Erzeugungsleistung Pv1", + "openwbtopic": "openWB/set/pv/1/W", + "datatype": "float", + "factor": 0.1, + "unit": "W" + }, + { + "position": [ + 17, + 18 + ], + "name": "Spannung PV2", + "realname": "Spannung PV2", + "datatype": "float", + "factor": 0.1, + "unit": "V" + }, + { + "position": [ + 19, + 20 + ], + "name": "Strom PV2", + "realname": "Strom PV2", + "datatype": "float", + "factor": 0.1, + "unit": "A" + }, + { + "position": [ + 21, + 22, + 23, + 24 + ], + "name": "PowerPv2", + "realname": "Erzeugungsleistung Pv2", + "openwbtopic": "openWB/set/pv/2/W", + "datatype": "float", + "factor": 0.1, + "unit": "W" + }, + { + "position": [ + 73, + 74, + 75, + 76 + ], + "name": "Output Power", + "realname": "Ausgangsleistung", + "datatype": "float", + "factor": 0.1, + "unit": "W" + }, + { + "position": [ + 77, + 78 + ], + "name": "GridFrequency", + "realname": "Netzfrequenz", + "datatype": "float", + "factor": 0.01, + "unit": "Hz" + }, + { + "position": [ + 79, + 80 + ], + "name": "SpannungL1", + "realname": "Spannung L1", + "datatype": "float", + "factor": 0.1, + "unit": "V" + }, + { + "position": [ + 81, + 82 + ], + "name": "Strom L1", + "realname": "Strom L1", + "datatype": "float", + "factor": 0.1, + "unit": "A" + }, + { + "position": [ + 83, + 84, + 85, + 86 + ], + "name": "Leistung L1", + "realname": "Leistung L1", + "datatype": "float", + "factor": 0.1, + "unit": "VA" + }, + { + "position": [ + 87, + 88 + ], + "name": "SpannungL2", + "realname": "Spannung L2", + "datatype": "float", + "factor": 0.1, + "unit": "V" + }, + { + "position": [ + 89, + 90 + ], + "name": "Strom L2", + "realname": "Strom L2", + "datatype": "float", + "factor": 0.1, + "unit": "A" + }, + { + "position": [ + 91, + 92, + 93, + 94 + ], + "name": "Leistung L2", + "realname": "Leistung L2", + "datatype": "float", + "factor": 0.1, + "unit": "VA" + }, + { + "position": [ + 95, + 96 + ], + "name": "SpannungL3", + "realname": "Spannung L3", + "datatype": "float", + "factor": 0.1, + "unit": "V" + }, + { + "position": [ + 97, + 98 + ], + "name": "Strom L3", + "realname": "Strom L3", + "datatype": "float", + "factor": 0.1, + "unit": "A" + }, + { + "position": [ + 99, + 100, + 101, + 102 + ], + "name": "Leistung L3", + "realname": "Leistung L3", + "datatype": "float", + "factor": 0.1, + "unit": "VA" + }, + { + "position": [ + 103, + 104 + ], + "name": "SpannungL1L2", + "realname": "Spannung L1 L2", + "datatype": "float", + "factor": 0.1, + "unit": "V" + }, + { + "position": [ + 105, + 106 + ], + "name": "SpannungL2L3", + "realname": "Spannung L2 L3", + "datatype": "float", + "factor": 0.1, + "unit": "V" + }, + { + "position": [ + 107, + 108 + ], + "name": "SpannungL3L1", + "realname": "Spannung L3 L1", + "datatype": "float", + "factor": 0.1, + "unit": "V" + }, + { + "position": [ + 109, + 110, + 111, + 112 + ], + "name": "Energy generated today", + "realname": "Erzeugte Energie heute", + "datatype": "integer", + "factor": 0.1, + "unit": "KWh" + }, + { + "position": [ + 113, + 114, + 115, + 116 + ], + "name": "Total Energy generated", + "realname": "Erzeugte Energie Gesamt", + "datatype": "integer", + "factor": 0.1, + "unit": "KWh" + }, + { + "position": [ + 117, + 118, + 119, + 120 + ], + "name": "Worktime total", + "realname": "Arbeitszeit Gesamt", + "datatype": "integer", + "factor": 0.5, + "unit": "s" + }, + { + "position": [ + 121, + 122, + 123, + 124 + ], + "name": "TodayEnergyKWhPv1", + "realname": "Erzeugte Energie Pv1 heute", + "openwbtopic": "openWB/set/pv/1/WhCounter", + "datatype": "integer", + "factor": 0.1, + "unit": "KWh" + }, + { + "position": [ + 125, + 126, + 127, + 128 + ], + "name": "TotalEnergyWhPv1", + "realname": "Erzeugte Energie Pv1 in Wh", + "openwbtopic": "openWB/set/pv/1/WhCounter", + "datatype": "integer", + "factor": 100, + "unit": "Wh" + }, + { + "position": [ + 129, + 130, + 131, + 132 + ], + "name": "TodayEnergyKWhPv2", + "realname": "Erzeugte Energie Pv2 heute", + "openwbtopic": "openWB/set/pv/2/WhCounter", + "datatype": "integer", + "factor": 0.1, + "unit": "KWh" + }, + { + "position": [ + 133, + 134, + 135, + 136 + ], + "name": "TotalEnergyWhPv2", + "realname": "Erzeugte Energie Pv2 in Wh", + "openwbtopic": "openWB/set/pv/2/WhCounter", + "datatype": "integer", + "factor": 100, + "unit": "Wh" + }, + { + "position": [ + 133, + 134, + 135, + 136 + ], + "name": "TotalEnergyKwhPv2", + "realname": "Erzeugte Energie Pv2 in Kwh", + "openwbtopic": "openWB/set/pv/2/WhCounter", + "datatype": "float", + "factor": 0.1, + "unit": "KWh" + }, + { + "position": [ + 189, + 190 + ], + "name": "InverterTemperature", + "realname": "Inverter Temperatur", + "datatype": "float", + "factor": 0.1, + "unit": "°C" + }, + { + "position": [ + 384, + 385 + ], + "name": "BatVoltage", + "realname": "Battery Voltage", + "datatype": "float", + "factor": 0.01, + "unit": "V" + }, + { + "position": [ + 408, + 409 + ], + "name": "BatChargingPower", + "realname": "Battery Charging Power", + "openwbtopic": "openWB/set/houseBattery/W", + "datatype": "float", + "factor": 0.1, + "unit": "W" + }, + { + "position": [ + 213, + 214 + ], + "name": "Faultcode", + "realname": "Inverter Fehlercode", + "datatype": "integer" + }, + { + "position": [ + 213, + 214 + ], + "name": "Faultmessage", + "realname": "Inverter Fehlermeldung", + "datatype": "integer", + "mapping": [ + [ + 0, + "Kein Fehler" + ], + [ + 1, + "Fehler:99+X" + ], + [ + 2, + "Fehler:99+X" + ], + [ + 3, + "Fehler:99+X" + ], + [ + 4, + "Fehler:99+X" + ], + [ + 5, + "Fehler:99+X" + ], + [ + 6, + "Fehler:99+X" + ], + [ + 7, + "Fehler:99+X" + ], + [ + 8, + "Fehler:99+X" + ], + [ + 9, + "Fehler:99+X" + ], + [ + 10, + "Fehler:99+X" + ], + [ + 11, + "Fehler:99+X" + ], + [ + 12, + "Fehler:99+X" + ], + [ + 13, + "Fehler:99+X" + ], + [ + 14, + "Fehler:99+X" + ], + [ + 15, + "Fehler:99+X" + ], + [ + 16, + "Fehler:99+X" + ], + [ + 17, + "Fehler:99+X" + ], + [ + 18, + "Fehler:99+X" + ], + [ + 19, + "Fehler:99+X" + ], + [ + 20, + "Fehler:99+X" + ], + [ + 21, + "Fehler:99+X" + ], + [ + 22, + "Fehler:99+X" + ], + [ + 23, + "Fehler:99+X" + ], + [ + 24, + "Auto Test fehlgeschlagen" + ], + [ + 25, + "Keine Netzverbindung" + ], + [ + 26, + "PV Isolation schlecht" + ], + [ + 27, + "Residual I High" + ], + [ + 28, + "Output High DCI" + ], + [ + 29, + "PV Spannung Hoch" + ], + [ + 30, + "Netzspannung außer Toleranz" + ], + [ + 31, + "Netzfrequenz außer Toleranz" + ], + [ + 32, + "Temperatur zu hoch" + ] + ] + }, + { + "position": [ + 305, + 306 + ], + "name": "PAC to Grid", + "realname": "Leistung AC ins Netz", + "datatype": "integer", + "unit": "Kwh" + }, + { + "position": [ + 388, + 389 + ], + "name": "BatCapacity", + "realname": "Battery Capacity (SOC)", + "openwbtopic": "openWB/set/houseBattery/%Soc", + "datatype": "integer", + "unit": "%" + }, + { + "position": [ + 414, + 415, + 416, + 417 + ], + "name": "InputEnergyChargeWh", + "realname": "Geladene Energie Speicher (Wh)", + "openwbtopic": "openWB/set/houseBattery/WhImported", + "datatype": "integer", + "factor": 100, + "unit": "Wh" + }, + { + "position": [ + 414, + 415, + 416, + 417 + ], + "name": "InputEnergyChargeKwh", + "realname": "Geladene Energie Speicher (KWh)", + "datatype": "float", + "factor": 0.1, + "unit": "KWh" + }, + { + "position": [ + 410, + 411, + 412, + 413 + ], + "name": "OutputEnergyChargeWh", + "realname": "Entladene Energie Speicher (Wh)", + "openwbtopic": "openWB/set/houseBattery/WhExported", + "datatype": "integer", + "factor": 100, + "unit": "Wh" + }, + { + "position": [ + 410, + 411, + 412, + 413 + ], + "name": "OutputEnergyChargeKwh", + "realname": "Entladene Energie Speicher (KWh)", + "datatype": "float", + "factor": 0.1, + "unit": "KWh" + }, + { + "position": [ + 571, + 572, + 573, + 574 + ], + "name": "Energiebezug Netz gesamt", + "realname": "Energiebezug Netz (KWh)", + "datatype": "float", + "factor": 0.1, + "unit": "KWh" + }, + { + "position": [ + 575, + 576, + 577, + 578 + ], + "name": "Einspeisung Netz gesamt", + "realname": "Einspeisung Netz (KWh)", + "datatype": "float", + "factor": 0.1, + "unit": "KWh" + } + ], + "id": [ + { + "position": [ + 181, + 182, + 183, + 184, + 185, + 186, + 187, + 188, + 189, + 190 + ], + "name": "InverterSN", + "realname": "Inverter SerialNumber", + "datatype": "string" + } + ] + } + } +} \ No newline at end of file diff --git a/data/regs/Growatt-SPH.json b/data/regs/Growatt-SPH.json index 3dd83ce..658fe5f 100644 --- a/data/regs/Growatt-SPH.json +++ b/data/regs/Growatt-SPH.json @@ -1,6 +1,7 @@ { "Growatt-SPH": { "config": { + "author": "thomas-99", "RequestLiveData": [ ["#ClientID", "0x04", "0x00", "0x00", "0x00", "0x77"], ["#ClientID", "0x04", "0x03", "0xE8", "0x00", "0x77"] diff --git a/data/regs/QVolt.json b/data/regs/QVolt.json index 6f8aa9e..3122357 100644 --- a/data/regs/QVolt.json +++ b/data/regs/QVolt.json @@ -1,6 +1,7 @@ { "QVolt-HYP-G3-3P": { "config": { + "author": "effix58", "RequestLiveData": [ [ "#ClientID", diff --git a/data/regs/Sofar.json b/data/regs/Sofar.json index 1350174..381a2c1 100644 --- a/data/regs/Sofar.json +++ b/data/regs/Sofar.json @@ -1,6 +1,7 @@ { "Sofar-KTL Solarmax-SGA": { "config": { + "author": "Dobie007", "RequestLiveData": [ ["#ClientID", "0x03", "0x00", "0x00", "0x00", "0x30"] ], diff --git a/data/regs/Solax-MIC-Pro.json b/data/regs/Solax-MIC-Pro.json new file mode 100644 index 0000000..a5b59ff --- /dev/null +++ b/data/regs/Solax-MIC-Pro.json @@ -0,0 +1,402 @@ +{ + "Solax-Mic-Pro": { + "config": { + "author": "michacee", + "RequestLiveData": [ + [ + "#ClientID", + "0x04", + "0x04", + "0x00", + "0x00", + "0x35" + ] + ], + "RequestIdData": [ + "#ClientID", + "0x03", + "0x03", + "0x00", + "0x00", + "0x07" + ], + "ClientIdPos": 0, + "LiveDataFunctionCodePos": 1, + "LiveDataFunctionCode": "0x04", + "IdDataFunctionCodePos": 1, + "IdDataFunctionCode": "0x03", + "LiveDataStartsAtPos": 3, + "IdDataStartsAtPos": 3, + "LiveDataErrorPos": 1, + "LiveDataErrorCode": "0x84", + "IdDataErrorPos": 1, + "IdDataErrorCode": "0x83", + "LiveDataSuccessPos": 1, + "LiveDataSuccessCode": "0x04", + "IdDataSuccessPos": 1, + "IdDataSuccessCode": "0x03" + }, + "data": { + "livedata": [ + { + "position": [ + 3, + 4 + ], + "name": "PvVoltage1", + "realname": "Pv Voltage 1", + "datatype": "float", + "factor": 0.1, + "unit": "V" + }, + { + "position": [ + 5, + 6 + ], + "name": "PvVoltage2", + "realname": "Pv Voltage 2", + "datatype": "float", + "factor": 0.1, + "unit": "V" + }, + { + "position": [ + 7, + 8 + ], + "name": "PvCurrent1", + "realname": "Pv Current 1", + "datatype": "float", + "factor": 0.1, + "unit": "A" + }, + { + "position": [ + 9, + 10 + ], + "name": "PvCurrent2", + "realname": "Pv Current 2", + "datatype": "float", + "factor": 0.1, + "unit": "A" + }, + { + "position": [ + 11, + 12 + ], + "name": "GridVoltage_R", + "realname": "Grid Voltage L1", + "datatype": "float", + "factor": 0.1, + "unit": "V" + }, + { + "position": [ + 13, + 14 + ], + "name": "GridVoltage_S", + "realname": "Grid Voltage L2", + "datatype": "float", + "factor": 0.1, + "unit": "V" + }, + { + "position": [ + 15, + 16 + ], + "name": "GridVoltage_T", + "realname": "Grid Voltage L3", + "datatype": "float", + "factor": 0.1, + "unit": "V" + }, + { + "position": [ + 17, + 18 + ], + "name": "GridFrequency_R", + "realname": "Grid Frequency L1", + "datatype": "float", + "factor": 0.01, + "unit": "Hz" + }, + { + "position": [ + 19, + 20 + ], + "name": "GridFrequency_S", + "realname": "Grid Frequency L2", + "datatype": "float", + "factor": 0.01, + "unit": "Hz" + }, + { + "position": [ + 21, + 22 + ], + "name": "GridFrequency_T", + "realname": "Grid Frequency L3", + "datatype": "float", + "factor": 0.01, + "unit": "Hz" + }, + { + "position": [ + 23, + 24 + ], + "name": "GridCurrent_R", + "realname": "Grid Current L1", + "datatype": "float", + "factor": 0.1, + "unit": "A" + }, + { + "position": [ + 25, + 26 + ], + "name": "GridCurrent_S", + "realname": "Grid Current L2", + "datatype": "float", + "factor": 0.1, + "unit": "A" + }, + { + "position": [ + 27, + 28 + ], + "name": "GridCurrent_T", + "realname": "Grid Current L3", + "datatype": "float", + "factor": 0.1, + "unit": "A" + }, + { + "position": [ + 29, + 30 + ], + "name": "Temperature", + "realname": "Temperature", + "datatype": "integer", + "unit": "°C" + }, + { + "position": [ + 31, + 32 + ], + "name": "OutputPower", + "realname": "Output Power", + "datatype": "integer", + "unit": "W" + }, + { + "position": [ + 33, + 34 + ], + "name": "InverterStatus", + "realname": "Inverter Status", + "datatype": "integer", + "mapping": [ + [ + 0, + "WaitMode" + ], + [ + 1, + "CheckMode" + ], + [ + 2, + "NormalMode" + ], + [ + 3, + "FaultMode" + ], + [ + 4, + "PermanentFaultMode" + ] + ] + }, + { + "position": [ + 35, + 36 + ], + "name": "GridPower_R", + "realname": "Grid Power L1", + "datatype": "integer", + "unit": "W" + }, + { + "position": [ + 37, + 38 + ], + "name": "GridPower_S", + "realname": "Grid Power L2", + "datatype": "integer", + "unit": "W" + }, + { + "position": [ + 39, + 40 + ], + "name": "GridPower_T", + "realname": "Grid Power L3", + "datatype": "integer", + "unit": "W" + }, + { + "position": [ + 41, + 42 + ], + "name": "PowerPvTotal", + "realname": "Erzeugungsleistung PV Gesamt", + "datatype": "float", + "unit": "W" + }, + { + "position": [ + 43, + 44 + ], + "name": "PowerPv1", + "realname": "Erzeugungsleistung Pv1", + "openwbtopic": "openWB/set/pv/1/W", + "datatype": "float", + "unit": "W" + }, + { + "position": [ + 45, + 46 + ], + "name": "PowerPv2", + "realname": "Erzeugungsleistung Pv2", + "openwbtopic": "openWB/set/pv/2/W", + "datatype": "float", + "unit": "W" + }, + { + "position": [ + 75, + 76, + 73, + 74 + ], + "name": "EnergyTotalToGridWh", + "realname": "Total Energy to Grid in Wh", + "openwbtopic": "openWB/set/pv/WhCounter", + "datatype": "integer", + "factor": 100, + "unit": "Wh" + }, + { + "position": [ + 75, + 76, + 73, + 74 + ], + "name": "EnergyTotalToGridKwh", + "realname": "Total Energy to Grid in KWh", + "datatype": "float", + "factor": 0.001, + "unit": "kWh" + }, + { + "position": [ + 79, + 80, + 77, + 78 + ], + "name": "EtodayToGrid", + "realname": "Today Energy to Grid", + "datatype": "float", + "factor": 0.001, + "unit": "kWh" + }, + { + "position": [ + 243, + 242, + 245, + 244 + ], + "name": "GridPower", + "realname": "Grid Power", + "openwbtopic": "openWB/set/pv/W", + "datatype": "integer", + "unit": "W" + }, + { + "position": [ + 126, + 127, + 129, + 128 + ], + "name": "feedinEnergy", + "realname": "FeedIn Energy", + "datatype": "float", + "factor": 0.01, + "unit": "kWh" + }, + { + "position": [ + 131, + 130, + 133, + 132 + ], + "name": "ConsumeInEnergy", + "realname": "ConsumeIn Energy", + "datatype": "float", + "factor": 0.01, + "unit": "kWh" + } + ], + "id": [ + { + "position": [ + 4, + 3, + 6, + 5, + 8, + 7, + 10, + 9, + 12, + 11, + 14, + 13, + 16, + 15 + ], + "name": "InverterSN", + "realname": "Inverter SerialNumber", + "datatype": "string" + } + ] + } + } +} \ No newline at end of file diff --git a/data/regs/Solax-MIC.json b/data/regs/Solax-MIC.json index d567272..cc29839 100644 --- a/data/regs/Solax-MIC.json +++ b/data/regs/Solax-MIC.json @@ -1,6 +1,7 @@ { "Solax-Mic": { "config": { + "author": "gerdluthe", "RequestLiveData": [ ["#ClientID", "0x04", "0x04", "0x00", "0x00", "0x40"] ], diff --git a/data/regs/Solax-X1.json b/data/regs/Solax-X1.json index f70d147..a610755 100644 --- a/data/regs/Solax-X1.json +++ b/data/regs/Solax-X1.json @@ -1,302 +1,529 @@ { "Solax-X1": { - "config": { - "RequestLiveData": [ - ["#ClientID", "0x04", "0x00", "0x00", "0x00", "0x77"], - ["#ClientID", "0x04", "0x00", "0x78", "0x00", "0x77"] - ], - "RequestIdData": ["#ClientID", "0x03", "0x00", "0x00", "0x00", "0x14"], - "ClientIdPos": 0, - "LiveDataFunctionCodePos": 1, - "LiveDataFunctionCode": "0x04", - "IdDataFunctionCodePos": 1, - "IdDataFunctionCode": "0x03", - "LiveDataStartsAtPos": 3, - "IdDataStartsAtPos": 3, - "LiveDataErrorPos": 1, - "LiveDataErrorCode": "0x84", - "IdDataErrorPos": 1, - "IdDataErrorCode": "0x83", - "LiveDataSuccessPos": 1, - "LiveDataSuccessCode": "0x04", - "IdDataSuccessPos": 1, - "IdDataSuccessCode": "0x03" - }, - "data": { - "livedata": [{ - "position": [3, 4], - "name": "GridVoltage", - "realname": "Grid Voltage", - "datatype": "float", - "factor": 0.1, - "unit": "V" - }, - { - "position": [5, 6], - "name": "GridCurrent", - "realname": "Grid Current", - "datatype": "float", - "factor": 0.1, - "unit": "A" - }, - { - "position": [7, 8], - "name": "GridPower", - "realname": "Grid Power", - "openwbtopic": "openWB/set/pv/W", - "datatype": "integer", - "unit": "W" - }, - { - "position": [9, 10], - "name": "PvVoltage1", - "realname": "Pv Voltage 1", - "datatype": "float", - "factor": 0.1, - "unit": "V" - }, - { - "position": [11, 12], - "name": "PvVoltage2", - "realname": "Pv Voltage 2", - "datatype": "float", - "factor": 0.1, - "unit": "V" - }, - { - "position": [13, 14], - "name": "PvCurrent1", - "realname": "Pv Current 1", - "datatype": "float", - "factor": 0.1, - "unit": "A" - }, - { - "position": [15, 16], - "name": "PvCurrent2", - "realname": "Pv Current 2", - "datatype": "float", - "factor": 0.1, - "unit": "A" - }, - { - "position": [17, 18], - "name": "GridFrequency", - "realname": "Grid Frequency", - "datatype": "float", - "factor": 0.01, - "unit": "Hz" - }, - { - "position": [19, 20], - "name": "Temperature", - "realname": "Temperature", - "datatype": "integer", - "unit": "°C" - }, - { - "position": [21, 22], - "name": "InverterStatus", - "realname": "Inverter Status", - "datatype": "integer", - "mapping": [[0,"WaitMode"],[1,"CheckMode"],[2,"NormalMode"],[3, "FaultMode"],[4,"PermanentFaultMode"],[5,"UpdateMode"],[6,"EPSCheckMode"],[7,"EPSMode"],[8,"SelfTest"],[9,"IdleMode"]] - }, - { - "position": [23, 24], - "name": "PowerPv1", - "realname": "Power PV 1", - "openwbtopic": "openWB/set/pv/1/W", - "datatype": "integer", - "unit": "W" - }, - { - "position": [25, 26], - "name": "PowerPv2", - "realname": "Power PV 2", - "openwbtopic": "openWB/set/pv/2/W", - "datatype": "integer", - "unit": "W" - }, - { - "position": [43, 44], - "name": "BatVoltage", - "realname": "Battery Voltage", - "datatype": "float", - "factor": 0.1, - "unit": "V" - }, - { - "position": [45, 46], - "name": "BatCurrent", - "realname": "Battery Current", - "datatype": "float", - "factor": 0.1, - "unit": "A" - }, - { - "position": [47, 48], - "name": "BatPower", - "realname": "Battery Power", - "datatype": "integer", - "openwbtopic": "openWB/set/houseBattery/W", - "unit": "W" - }, - { - "position": [51, 52], - "name": "BatTemp", - "realname": "Battery Temperature", - "datatype": "integer", - "unit": "°C" - }, - { - "position": [59, 60], - "name": "BatCapacity", - "realname": "Battery Capacity", - "datatype": "integer", - "openwbtopic": "openWB/set/houseBattery/%Soc", - "unit": "%" - }, - { - "position": [58, 59, 60, 61], - "name": "OutputEnergyChargeWh", - "realname": "Output Energy Charge (Wh)", - "openwbtopic": "openWB/set/houseBattery/WhExported", - "datatype": "integer", - "factor": 100, - "unit": "Wh" - }, - { - "position": [58, 59, 60, 61], - "name": "OutputEnergyChargeKWh", - "realname": "Output Energy Charge (KWh)", - "datatype": "float", - "factor": 0.1, - "unit": "KWh" - }, - { - "position": [64, 65], - "name": "OutputEnergyChargeToday", - "realname": "Output Energy Charge Today (KWh)", - "datatype": "float", - "factor": 0.1, - "unit": "kWh" - }, - { - "position": [66, 67, 68, 69], - "name": "InputEnergyChargeWh", - "realname": "Input Energy Charge (Wh)", - "openwbtopic": "openWB/set/houseBattery/WhImported", - "datatype": "integer", - "factor": 100, - "unit": "Wh" - }, - { - "position": [66, 67, 68, 69], - "name": "InputEnergyChargeKWh", - "realname": "Input Energy Charge (KWh)", - "datatype": "float", - "factor": 0.1, - "unit": "KWh" - }, - { - "position": [70, 71], - "name": "InputEnergyChargeToday", - "realname": "Input Energy Charge Today (KWh)", - "datatype": "float", - "factor": 0.1, - "unit": "kWh" - }, - { - "position": [141, 142, 143, 144], - "name": "feedinPower", - "realname": "FeedIn Energy Power to Grid", - "datatype": "integer", - "unit": "W" - }, - { - "position": [145, 146, 147, 148], - "name": "feedinEnergyTotal", - "realname": "FeedIn Energy Total", - "datatype": "float", - "factor": 0.01, - "unit": "kWh" - }, - { - "position": [149, 150, 151, 152], - "name": "consumedEnergyTotal", - "realname": "Consumed Energy Total", - "datatype": "float", - "factor": 0.01, - "unit": "kWh" - }, - { - "position": [163, 164], - "name": "EtodayToGrid", - "realname": "Today Energy to Grid", - "datatype": "float", - "factor": 0.1, - "unit": "kWh" - }, - { - "position": [165, 166, 167, 168], - "name": "EnergyTotalToGridWh", - "realname": "Total Energy to Grid in Wh", - "openwbtopic": "openWB/set/pv/WhCounter", - "datatype": "integer", - "factor": 100, - "unit": "Wh" - }, - { - "position": [165, 166, 167, 168], - "name": "EnergyTotalToGridKwh", - "realname": "Total Energy to Grid in KWh", - "datatype": "float", - "factor": 0.1, - "unit": "kWh" - }, - { - "position": [276, 277, 278, 279], - "name": "OnGridRunTime", - "realname": "OnGrid RunTime", - "datatype": "float", - "factor": 0.1, - "unit": "h" - }, - { - "position": [280, 281, 282, 283], - "name": "OffGridRunTime", - "realname": "OffGrid RunTime", - "datatype": "float", - "factor": 0.1, - "unit": "h" - } - ], - "id": [ - { - "position": [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], - "name": "InverterSN", - "realname": "Inverter SerialNumber", - "datatype": "string" - }, - { - "position": [17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], - "name": "FactoryName", - "realname": "Factory Name", - "datatype": "string" - }, - { - "position": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42], - "name": "ModuleName", - "realname": "Module Name", - "datatype": "string" - } + "config": { + "author": "tobiasfaust", + "RequestLiveData": [ + [ + "#ClientID", + "0x04", + "0x00", + "0x00", + "0x00", + "0x77" + ], + [ + "#ClientID", + "0x04", + "0x00", + "0x78", + "0x00", + "0x77" + ] + ], + "RequestIdData": [ + "#ClientID", + "0x03", + "0x00", + "0x00", + "0x00", + "0x14" + ], + "ClientIdPos": 0, + "LiveDataFunctionCodePos": 1, + "LiveDataFunctionCode": "0x04", + "IdDataFunctionCodePos": 1, + "IdDataFunctionCode": "0x03", + "LiveDataStartsAtPos": 3, + "IdDataStartsAtPos": 3, + "LiveDataErrorPos": 1, + "LiveDataErrorCode": "0x84", + "IdDataErrorPos": 1, + "IdDataErrorCode": "0x83", + "LiveDataSuccessPos": 1, + "LiveDataSuccessCode": "0x04", + "IdDataSuccessPos": 1, + "IdDataSuccessCode": "0x03" + }, + "data": { + "livedata": [ + { + "position": [ + 3, + 4 + ], + "name": "GridVoltage", + "realname": "Grid Voltage", + "datatype": "float", + "factor": 0.1, + "unit": "V" + }, + { + "position": [ + 5, + 6 + ], + "name": "GridCurrent", + "realname": "Grid Current", + "datatype": "float", + "factor": 0.1, + "unit": "A" + }, + { + "position": [ + 7, + 8 + ], + "name": "GridPower", + "realname": "Grid Power", + "openwbtopic": "openWB/set/pv/W", + "datatype": "integer", + "unit": "W" + }, + { + "position": [ + 9, + 10 + ], + "name": "PvVoltage1", + "realname": "Pv Voltage 1", + "datatype": "float", + "factor": 0.1, + "unit": "V" + }, + { + "position": [ + 11, + 12 + ], + "name": "PvVoltage2", + "realname": "Pv Voltage 2", + "datatype": "float", + "factor": 0.1, + "unit": "V" + }, + { + "position": [ + 13, + 14 + ], + "name": "PvCurrent1", + "realname": "Pv Current 1", + "datatype": "float", + "factor": 0.1, + "unit": "A" + }, + { + "position": [ + 15, + 16 + ], + "name": "PvCurrent2", + "realname": "Pv Current 2", + "datatype": "float", + "factor": 0.1, + "unit": "A" + }, + { + "position": [ + 17, + 18 + ], + "name": "GridFrequency", + "realname": "Grid Frequency", + "datatype": "float", + "factor": 0.01, + "unit": "Hz" + }, + { + "position": [ + 19, + 20 + ], + "name": "Temperature", + "realname": "Temperature", + "datatype": "integer", + "unit": "°C" + }, + { + "position": [ + 21, + 22 + ], + "name": "InverterStatus", + "realname": "Inverter Status", + "datatype": "integer", + "mapping": [ + [ + 0, + "WaitMode" + ], + [ + 1, + "CheckMode" + ], + [ + 2, + "NormalMode" + ], + [ + 3, + "FaultMode" + ], + [ + 4, + "PermanentFaultMode" + ], + [ + 5, + "UpdateMode" + ], + [ + 6, + "EPSCheckMode" + ], + [ + 7, + "EPSMode" + ], + [ + 8, + "SelfTest" + ], + [ + 9, + "IdleMode" + ] + ] + }, + { + "position": [ + 23, + 24 + ], + "name": "PowerPv1", + "realname": "Power PV 1", + "openwbtopic": "openWB/set/pv/1/W", + "datatype": "integer", + "unit": "W" + }, + { + "position": [ + 25, + 26 + ], + "name": "PowerPv2", + "realname": "Power PV 2", + "openwbtopic": "openWB/set/pv/2/W", + "datatype": "integer", + "unit": "W" + }, + { + "position": [ + 43, + 44 + ], + "name": "BatVoltage", + "realname": "Battery Voltage", + "datatype": "float", + "factor": 0.1, + "unit": "V" + }, + { + "position": [ + 45, + 46 + ], + "name": "BatCurrent", + "realname": "Battery Current", + "datatype": "float", + "factor": 0.1, + "unit": "A" + }, + { + "position": [ + 47, + 48 + ], + "name": "BatPower", + "realname": "Battery Power", + "datatype": "integer", + "openwbtopic": "openWB/set/houseBattery/W", + "unit": "W" + }, + { + "position": [ + 51, + 52 + ], + "name": "BatTemp", + "realname": "Battery Temperature", + "datatype": "integer", + "unit": "°C" + }, + { + "position": [ + 59, + 60 + ], + "name": "BatCapacity", + "realname": "Battery Capacity", + "datatype": "integer", + "openwbtopic": "openWB/set/houseBattery/%Soc", + "unit": "%" + }, + { + "position": [ + 58, + 59, + 60, + 61 + ], + "name": "OutputEnergyChargeWh", + "realname": "Output Energy Charge (Wh)", + "openwbtopic": "openWB/set/houseBattery/WhExported", + "datatype": "integer", + "factor": 100, + "unit": "Wh" + }, + { + "position": [ + 58, + 59, + 60, + 61 + ], + "name": "OutputEnergyChargeKWh", + "realname": "Output Energy Charge (KWh)", + "datatype": "float", + "factor": 0.1, + "unit": "KWh" + }, + { + "position": [ + 64, + 65 + ], + "name": "OutputEnergyChargeToday", + "realname": "Output Energy Charge Today (KWh)", + "datatype": "float", + "factor": 0.1, + "unit": "kWh" + }, + { + "position": [ + 66, + 67, + 68, + 69 + ], + "name": "InputEnergyChargeWh", + "realname": "Input Energy Charge (Wh)", + "openwbtopic": "openWB/set/houseBattery/WhImported", + "datatype": "integer", + "factor": 100, + "unit": "Wh" + }, + { + "position": [ + 66, + 67, + 68, + 69 + ], + "name": "InputEnergyChargeKWh", + "realname": "Input Energy Charge (KWh)", + "datatype": "float", + "factor": 0.1, + "unit": "KWh" + }, + { + "position": [ + 70, + 71 + ], + "name": "InputEnergyChargeToday", + "realname": "Input Energy Charge Today (KWh)", + "datatype": "float", + "factor": 0.1, + "unit": "kWh" + }, + { + "position": [ + 146, + 145, + 143, + 144 + ], + "name": "feedinPower", + "realname": "FeedIn Energy Power to Grid", + "datatype": "integer", + "unit": "W" + }, + { + "position": [ + 150, + 149, + 147, + 148 + ], + "name": "feedinEnergyTotal", + "realname": "FeedIn Energy Total", + "datatype": "float", + "factor": 0.01, + "unit": "kWh" + }, + { + "position": [ + 153, + 154, + 151, + 152 + ], + "name": "consumedEnergyTotal", + "realname": "Consumed Energy Total", + "datatype": "float", + "factor": 0.01, + "unit": "kWh" + }, + { + "position": [ + 163, + 164 + ], + "name": "EtodayToGrid", + "realname": "Today Energy to Grid", + "datatype": "float", + "factor": 0.1, + "unit": "kWh" + }, + { + "position": [ + 169, + 170, + 167, + 168 + ], + "name": "EnergyTotalToGridWh", + "realname": "Total Energy to Grid in Wh", + "openwbtopic": "openWB/set/pv/WhCounter", + "datatype": "integer", + "factor": 100, + "unit": "Wh" + }, + { + "position": [ + 169, + 170, + 167, + 168 + ], + "name": "EnergyTotalToGridKwh", + "realname": "Total Energy to Grid in KWh", + "datatype": "float", + "factor": 0.1, + "unit": "kWh" + }, + { + "position": [ + 280, + 281, + 278, + 279 + ], + "name": "OnGridRunTime", + "realname": "OnGrid RunTime", + "datatype": "float", + "factor": 0.1, + "unit": "h" + }, + { + "position": [ + 284, + 285, + 282, + 283 + ], + "name": "OffGridRunTime", + "realname": "OffGrid RunTime", + "datatype": "float", + "factor": 0.1, + "unit": "h" + } + ], + "id": [ + { + "position": [ + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16 + ], + "name": "InverterSN", + "realname": "Inverter SerialNumber", + "datatype": "string" + }, + { + "position": [ + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30 + ], + "name": "FactoryName", + "realname": "Factory Name", + "datatype": "string" + }, + { + "position": [ + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42 + ], + "name": "ModuleName", + "realname": "Module Name", + "datatype": "string" + } + ] + }, + "set": [ + { + "name": "TargetBatSOC", + "request": [ + "#ClientID", + "0x06", + "0x00", + "0x83" + ] + } ] - }, - "set": [ - { - "name": "TargetBatSOC", - "request" : ["#ClientID", "0x06", "0x00", "0x83"] - } - ] } } \ No newline at end of file diff --git a/data/regs/Solax-X3.json b/data/regs/Solax-X3.json index 118d847..765776b 100644 --- a/data/regs/Solax-X3.json +++ b/data/regs/Solax-X3.json @@ -1,6 +1,7 @@ { "Solax-X3": { "config": { + "author": "", "RequestLiveData": [ [ "#ClientID", @@ -840,6 +841,7 @@ }, "Solax-X3-PRO": { "config": { + "author": "MagicSven81", "RequestLiveData": [ [ "#ClientID", diff --git a/data/web/Javascript.js b/data/web/Javascript.js index a839ad4..70f1aaf 100644 --- a/data/web/Javascript.js +++ b/data/web/Javascript.js @@ -290,65 +290,57 @@ function isVisible(_obj) { return ret; } -/*############################################################ -# DataForm: id of FormElement which contains all input fields -# SubmitForm: id of FormElement which contains hidden input filed, named "json", for submit -# jsontype: -# 1 = standard, 1 level -# 2 = array, each item separately -############################################################*/ -function onSubmit(DataForm, jsontype){ - //set default - if (!jsontype) jsontype = 1; - - // init json String - var JsonData; - if (jsontype == 1) { JsonData = {data: {}}; } - else if (jsontype == 2) { JsonData = {data: []}; } +/******************************* +separator: +regex of item ID to identify first element in row + - if set, returned json is an array, all elements per row, example: "^myonoffswitch.*" + - if emty, all elements at one level together, ONLY for small json´s (->memory issue) +*******************************/ +function onSubmit(DataForm, separator='') { + // init json Objects + var JsonData, tempData; - var count = 0; + if (separator.length == 0) { JsonData = {data: {}}; } + else { JsonData = {data: []};} + tempData = {}; var elems = document.getElementById(DataForm).elements; for(var i = 0; i < elems.length; i++){ if(elems[i].name && elems[i].value) { - if (!isVisible(elems[i])) continue; + if (!isVisible(elems[i])) { continue; } + + // tempData -> JsonData if new row (first named element (-> match) in row) + if (separator.length > 0 && elems[i].id.match(separator) && Object.keys(tempData).length > 0) { + JsonData.data.push(tempData); + tempData = {}; + } else if (separator.length == 0 && Object.keys(tempData).length > 0) { + JsonData.data[Object.keys(tempData)[0]] = tempData[Object.keys(tempData)[0]]; + tempData = {}; + } if (elems[i].type == "checkbox") { - count++; - if (jsontype == 1) { JsonData.data[elems[i].name] = (elems[i].checked==true?1:0); } - else if (jsontype == 2) { - JsonData.data.push({ "name" : elems[i].name, - "value": (elems[i].checked==true?1:0) }); - } + tempData[elems[i].name] = (elems[i].checked==true?1:0); } else if (elems[i].id.match(/^Alle.*/) || elems[i].id.match(/^GpioPin.*/) || elems[i].id.match(/^AnalogPin.*/) || elems[i].type == "number") { - count++; - if (jsontype == 1) { JsonData.data[elems[i].name] = parseInt(elems[i].value); } - else if (jsontype == 2) { - JsonData.data.push({ "name" : elems[i].name, - "value": parseInt(elems[i].value) }); - } + tempData[elems[i].name] = parseInt(elems[i].value); } else if (elems[i].type == "radio") { - if (jsontype == 1) { if (elems[i].checked==true) {JsonData.data[elems[i].name] = elems[i].value;} } - else if (jsontype == 2) { - if (elems[i].checked==true) { - count++; - JsonData.data.push({ "name" : elems[i].name, - "value": elems[i].value }); - } - } + if (elems[i].checked==true) {tempData[elems[i].name] = elems[i].value;} } else { - if (jsontype == 1) { JsonData.data[elems[i].name] = elems[i].value; } - else if (jsontype == 2) { - count++; - JsonData.data.push({ "name" : elems[i].name, - "value": elems[i].value }); - } + tempData[elems[i].name] = elems[i].value; } } } + + // ende elements + if (separator.length > 0 && Object.keys(tempData).length > 0) { + JsonData.data.push(tempData); + tempData = {}; + } else if (separator.length == 0 && Object.keys(tempData).length > 0) { + JsonData.data[Object.keys(tempData)[0]] = tempData[Object.keys(tempData)[0]]; + tempData = {}; + } setResponse(true, "save ...") @@ -374,12 +366,9 @@ function onSubmit(DataForm, jsontype){ data['subaction'] = filename; requestData(JSON.stringify(data), false); }); - - } - /******************************* blendet Zeilen der Tabelle aus show: Array of shown IDs return true; diff --git a/data/web/Style.css b/data/web/Style.css index f9fc126..7fdbc50 100644 --- a/data/web/Style.css +++ b/data/web/Style.css @@ -209,3 +209,28 @@ body { .texthover:hover { background-color: #cccccc; } + +/* show page loading */ +/* https://dev.to/ziratsu/spinning-loader-in-pure-css-4dh */ +#loader { + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + margin: auto; + width: 100px; + height: 100px; + border-radius: 50%; + border: 4px solid crimson; + border: 4px solid transparent; + border-top-color: crimson; + border-bottom-color: crimson; + animation: spin 1s ease-in-out infinite; +} + +@keyframes spin { + to { + transform: rotate(360deg); + } +} \ No newline at end of file diff --git a/data/web/baseconfig.html b/data/web/baseconfig.html index f747f49..a20fd4c 100644 --- a/data/web/baseconfig.html +++ b/data/web/baseconfig.html @@ -9,6 +9,7 @@ Modbus MQTT Gateway +
diff --git a/data/web/baseconfig.js b/data/web/baseconfig.js index 93da0a4..f63a3e8 100644 --- a/data/web/baseconfig.js +++ b/data/web/baseconfig.js @@ -9,7 +9,13 @@ function GetInitData() { var data = {}; data.action = "GetInitData"; data.subaction = "baseconfig"; - requestData(JSON.stringify(data), true); + requestData(JSON.stringify(data), true, MyCallback); +} + +// ************************************************ +function MyCallback() { + document.querySelector("#loader").style.visibility = "hidden"; + document.querySelector("body").style.visibility = "visible"; } // ************************************************ \ No newline at end of file diff --git a/data/web/handlefiles.html b/data/web/handlefiles.html index c66fa5a..75eb171 100644 --- a/data/web/handlefiles.html +++ b/data/web/handlefiles.html @@ -10,6 +10,7 @@ HandleFiles +
diff --git a/data/web/handlefiles.js b/data/web/handlefiles.js index 6f1037a..9358a68 100644 --- a/data/web/handlefiles.js +++ b/data/web/handlefiles.js @@ -5,6 +5,8 @@ var DirJson; window.addEventListener('load', initHandleFS, false); function initHandleFS() { init("/"); + document.querySelector("#loader").style.visibility = "hidden"; + document.querySelector("body").style.visibility = "visible"; } function init(startpath) { @@ -12,7 +14,6 @@ function init(startpath) { obj = document.getElementById('fullpath').innerHTML = ''; // div obj = document.getElementById('filename').value = ''; // input field obj = document.getElementById('content').value = ''; - } // *********************************** diff --git a/data/web/modbusconfig.html b/data/web/modbusconfig.html index cf6cb64..cfc0b1c 100644 --- a/data/web/modbusconfig.html +++ b/data/web/modbusconfig.html @@ -9,6 +9,7 @@ ModbusConfig +
diff --git a/data/web/modbusconfig.js b/data/web/modbusconfig.js index 1dad776..3a7038d 100644 --- a/data/web/modbusconfig.js +++ b/data/web/modbusconfig.js @@ -15,6 +15,8 @@ function GetInitData() { // ************************************************ function MyCallback() { CreateSelectionListFromInputField('input[type=number][id^=GpioPin]', [gpio]); + document.querySelector("#loader").style.visibility = "hidden"; + document.querySelector("body").style.visibility = "visible"; } // ************************************************ \ No newline at end of file diff --git a/data/web/modbusitemconfig.html b/data/web/modbusitemconfig.html index 3dcf718..240363c 100644 --- a/data/web/modbusitemconfig.html +++ b/data/web/modbusitemconfig.html @@ -9,6 +9,7 @@ status +
@@ -45,7 +46,7 @@

- + \ No newline at end of file diff --git a/data/web/modbusitemconfig.js b/data/web/modbusitemconfig.js index 379373d..a8f7fa5 100644 --- a/data/web/modbusitemconfig.js +++ b/data/web/modbusitemconfig.js @@ -12,10 +12,14 @@ function GetInitData() { var data = {}; data.action = "RefreshLiveData"; data.subaction = "all"; - requestData(JSON.stringify(data), false); + requestData(JSON.stringify(data), false, MyCallback); } // ************************************************ +function MyCallback() { + document.querySelector("#loader").style.visibility = "hidden"; + document.querySelector("body").style.visibility = "visible"; +} function RefreshLiveData() { var data = {}; diff --git a/data/web/navi.js b/data/web/navi.js index 489e830..17d7be6 100644 --- a/data/web/navi.js +++ b/data/web/navi.js @@ -24,6 +24,10 @@ function highlightNavi(item) { } } + + top.frames["frame_main"].document.querySelector("#loader").style.visibility = "visible"; + top.frames["frame_main"].document.querySelector("body").style.visibility = "hidden"; + } // ************************************************ \ No newline at end of file diff --git a/data/web/rawdata.html b/data/web/rawdata.html index 5354e1d..efe6a5e 100644 --- a/data/web/rawdata.html +++ b/data/web/rawdata.html @@ -10,7 +10,7 @@ RawData - +
diff --git a/data/web/rawdata.js b/data/web/rawdata.js index acd3a22..08710fd 100644 --- a/data/web/rawdata.js +++ b/data/web/rawdata.js @@ -15,8 +15,11 @@ function GetInitData() { } function MyCallback() { - reset_rawdata('id_rawdata') - reset_rawdata('live_rawdata') + reset_rawdata('id_rawdata'); + reset_rawdata('live_rawdata'); + + document.querySelector("#loader").style.visibility = "hidden"; + document.querySelector("body").style.visibility = "visible"; } /******************************* diff --git a/data/web/status.html b/data/web/status.html index a59a849..47f25c4 100644 --- a/data/web/status.html +++ b/data/web/status.html @@ -9,6 +9,7 @@ status +
diff --git a/data/web/status.js b/data/web/status.js index 4ffaba6..e6a662a 100644 --- a/data/web/status.js +++ b/data/web/status.js @@ -11,7 +11,7 @@ function GetInitData() { var data = {}; data['action'] = "GetInitData"; data['subaction'] = "status"; - requestData(JSON.stringify(data), false); + requestData(JSON.stringify(data), false, MyCallback); } // ************************************************ @@ -22,4 +22,10 @@ function RefreshLiveData() { requestData(JSON.stringify(data), true); } +// ************************************************ +function MyCallback() { + document.querySelector("#loader").style.visibility = "hidden"; + document.querySelector("body").style.visibility = "visible"; +} + // ************************************************ \ No newline at end of file diff --git a/docs/Solax-Hybrid.X1.X3-G4.ModbusTCP.RTU.V3.29-.English.pdf b/docs/Solax-Hybrid.X1.X3-G4.ModbusTCP.RTU.V3.29-.English.pdf new file mode 100644 index 0000000..803773f Binary files /dev/null and b/docs/Solax-Hybrid.X1.X3-G4.ModbusTCP.RTU.V3.29-.English.pdf differ diff --git a/src/MyWebServer.cpp b/src/MyWebServer.cpp index 3909263..c44c792 100644 --- a/src/MyWebServer.cpp +++ b/src/MyWebServer.cpp @@ -138,7 +138,9 @@ void MyWebServer::handleFavIcon(AsyncWebServerRequest *request) { } void MyWebServer::handleReboot(AsyncWebServerRequest *request) { - request->send(LittleFS, "/web/UpdateResponse.html", "text/html"); + AsyncWebServerResponse *response = request->beginResponse_P(200, "text/html", HTML_UPDATERESPONSE); + response->addHeader("Server","ESP Async Web Server"); + request->send(response); this->DoReboot = true; } diff --git a/src/_Release.h b/src/_Release.h index 38cb378..218b0a2 100644 --- a/src/_Release.h +++ b/src/_Release.h @@ -1 +1 @@ -#define Release "3.2.0" +#define Release "3.2.1" diff --git a/src/handleFiles.cpp b/src/handleFiles.cpp index f72eb41..1f2ab88 100644 --- a/src/handleFiles.cpp +++ b/src/handleFiles.cpp @@ -145,61 +145,3 @@ void handleFiles::handleUpload(AsyncWebServerRequest *request, String filename, } } } - -//############################################################### -// returns the WebContent -//############################################################### -void handleFiles::GetWebContentConfig(AsyncResponseStream *response) { - char buffer[200] = {0}; - memset(buffer, 0, sizeof(buffer)); - - response->print("\n"); - response->print("\n"); - response->print("
\n"); - response->print("\n"); - response->print("\n"); - response->print("\n"); - response->print("\n"); - response->print("\n"); - response->print("\n"); - response->print("\n"); - response->print("\n"); - response->print("\n"); - response->print("\n"); - response->print("\n"); - response->print("\n"); - response->print("\n"); - response->print("\n"); - response->print("\n"); - response->print("\n"); - response->print("\n"); - response->print("\n"); - response->print("
DateienInhalt
\n"); - response->print("\n"); - response->print("\n"); - response->print("\n"); - response->print("\n"); - response->print("\n"); - response->print("
\n"); - response->print("path:\n"); - response->print("\n"); - response->print("
{path}
\n"); - response->print("\n"); - response->print("
\n"); - response->print("
\n"); - response->print("\n"); - response->print("
\n"); - response->print("
filename: \n"); - response->print("\n"); - response->print("\n"); - response->print("\n"); - response->print("\n"); - response->print("\n"); - response->print("
\n"); - - -} \ No newline at end of file diff --git a/src/handleFiles.h b/src/handleFiles.h index 598f221..b700170 100644 --- a/src/handleFiles.h +++ b/src/handleFiles.h @@ -8,7 +8,6 @@ class handleFiles { public: handleFiles(AsyncWebServer *server); - void GetWebContentConfig(AsyncResponseStream *response); void HandleAjaxRequest(JsonDocument& jsonGet, AsyncResponseStream* response); void handleUpload(AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final); diff --git a/src/modbus.cpp b/src/modbus.cpp index 72f0484..237e0b7 100644 --- a/src/modbus.cpp +++ b/src/modbus.cpp @@ -415,6 +415,7 @@ void modbus::QueryQueueToInverter() { RS485Serial->flush(); digitalWrite(this->pin_RTS, RS485Receive); + // wait 100ms to get response unsigned long timeout=millis()+100; while (millis()<=timeout) { yield(); } @@ -515,7 +516,7 @@ int modbus::JsonPosArrayToInt(JsonArray posArray, JsonArray posArray2) { for(uint16_t v : posArray) { if (v < this->DataFrame->size()) { val_i = (val_i << 8) | this->DataFrame->at(v); - val_max = (val_max << 8) | 0xFF; + val_max = (val_max << 8) | 0xFF; } } } @@ -1220,28 +1221,32 @@ void modbus::LoadJsonItemConfig() { } } - String ItemName = elem["name"].as(); - //ItemName = ItemName.substring(7, ItemName.length()); //Name: active_ + for (JsonPair kv : elem.as()) { + const char* ItemName = kv.key().c_str(); - for(uint16_t i=0; iInverterLiveData->size(); i++) { - if (this->InverterLiveData->at(i).Name == ItemName ) { - this->InverterLiveData->at(i).active = elem["value"].as(); + //Serial.println(kv.key().c_str()); + //Serial.println(kv.value().as()); - if (Config->GetDebugLevel() >=3) { - Serial.printf("item %s -> %s\n", ItemName.c_str(), (this->InverterLiveData->at(i).active?"enabled":"disabled")); - } + for(uint16_t i=0; iInverterLiveData->size(); i++) { + if (this->InverterLiveData->at(i).Name == ItemName ) { + this->InverterLiveData->at(i).active = kv.value().as(); + + if (Config->GetDebugLevel() >=3) { + Serial.printf("item %s -> %s\n", ItemName, (this->InverterLiveData->at(i).active?"enabled":"disabled")); + } - break; + break; + } } } } while (stream.findUntil(",","]")); configFile.close(); } else { - if (Config->GetDebugLevel() >=1) {Serial.println("failed to load modbus item json config, load default config");} + if (Config->GetDebugLevel() >=1) {Serial.println("failed to load modbusitemconfig.json, load default item config");} } } else { - if (Config->GetDebugLevel() >=3) {Serial.println("ModbusItemConfig.json config File not exists, all items are inactive as default");} + if (Config->GetDebugLevel() >=3) {Serial.println("modbusitemconfig.json config File not exists, all items are inactive as default");} } }