mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[Solax] Changes in values parser for X3-Hybrid-G4 (#17549)
* Fixes in indexes from Ruepert #1 Signed-off-by: Konstantin Polihronov <polychronov@gmail.com>
This commit is contained in:
parent
58f59055a4
commit
51e1205abf
@ -45,11 +45,11 @@ public interface LocalData {
|
|||||||
LocalConnectRawDataBean getData();
|
LocalConnectRawDataBean getData();
|
||||||
|
|
||||||
default double getPV1Voltage() {
|
default double getPV1Voltage() {
|
||||||
return Short.MIN_VALUE;
|
return Integer.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
default double getPV1Current() {
|
default double getPV1Current() {
|
||||||
return Short.MIN_VALUE;
|
return Integer.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
default short getPV1Power() {
|
default short getPV1Power() {
|
||||||
@ -57,11 +57,11 @@ public interface LocalData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
default double getPV2Voltage() {
|
default double getPV2Voltage() {
|
||||||
return Short.MIN_VALUE;
|
return Integer.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
default double getPV2Current() {
|
default double getPV2Current() {
|
||||||
return Short.MIN_VALUE;
|
return Integer.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
default short getPV2Power() {
|
default short getPV2Power() {
|
||||||
@ -77,11 +77,11 @@ public interface LocalData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
default double getBatteryVoltage() {
|
default double getBatteryVoltage() {
|
||||||
return Short.MIN_VALUE;
|
return Integer.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
default double getBatteryCurrent() {
|
default double getBatteryCurrent() {
|
||||||
return Short.MIN_VALUE;
|
return Integer.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
default short getBatteryPower() {
|
default short getBatteryPower() {
|
||||||
@ -104,7 +104,7 @@ public interface LocalData {
|
|||||||
return Short.MIN_VALUE;
|
return Short.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
default short getFeedInPower() {
|
default int getFeedInPower() {
|
||||||
return Short.MIN_VALUE;
|
return Short.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,55 +113,55 @@ public interface LocalData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
default double getTotalEnergy() {
|
default double getTotalEnergy() {
|
||||||
return Short.MIN_VALUE;
|
return Integer.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
default short getTotalBatteryDischargeEnergy() {
|
default double getTotalBatteryDischargeEnergy() {
|
||||||
return Short.MIN_VALUE;
|
return Integer.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
default short getTotalBatteryChargeEnergy() {
|
default double getTotalBatteryChargeEnergy() {
|
||||||
return Short.MIN_VALUE;
|
return Integer.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
default double getTotalPVEnergy() {
|
default double getTotalPVEnergy() {
|
||||||
return Short.MIN_VALUE;
|
return Integer.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
default short getTotalFeedInEnergy() {
|
default double getTotalFeedInEnergy() {
|
||||||
return Short.MIN_VALUE;
|
return Integer.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
default double getTotalConsumption() {
|
default double getTotalConsumption() {
|
||||||
return Short.MIN_VALUE;
|
return Integer.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
default double getTodayEnergy() {
|
default double getTodayEnergy() {
|
||||||
return Short.MIN_VALUE;
|
return Integer.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
default double getTodayFeedInEnergy() {
|
default double getTodayFeedInEnergy() {
|
||||||
return Short.MIN_VALUE;
|
return Integer.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
default double getTodayConsumption() {
|
default double getTodayConsumption() {
|
||||||
return Short.MIN_VALUE;
|
return Integer.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
default double getTodayBatteryDischargeEnergy() {
|
default double getTodayBatteryDischargeEnergy() {
|
||||||
return Short.MIN_VALUE;
|
return Integer.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
default double getTodayBatteryChargeEnergy() {
|
default double getTodayBatteryChargeEnergy() {
|
||||||
return Short.MIN_VALUE;
|
return Integer.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
default double getInverterVoltage() {
|
default double getInverterVoltage() {
|
||||||
return Short.MIN_VALUE;
|
return Integer.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
default double getInverterCurrent() {
|
default double getInverterCurrent() {
|
||||||
return Short.MIN_VALUE;
|
return Integer.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
default short getInverterOutputPower() {
|
default short getInverterOutputPower() {
|
||||||
@ -169,31 +169,31 @@ public interface LocalData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
default double getInverterFrequency() {
|
default double getInverterFrequency() {
|
||||||
return Short.MIN_VALUE;
|
return Integer.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
default double getVoltagePhase1() {
|
default double getVoltagePhase1() {
|
||||||
return Short.MIN_VALUE;
|
return Integer.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
default double getVoltagePhase2() {
|
default double getVoltagePhase2() {
|
||||||
return Short.MIN_VALUE;
|
return Integer.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
default double getVoltagePhase3() {
|
default double getVoltagePhase3() {
|
||||||
return Short.MIN_VALUE;
|
return Integer.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
default double getCurrentPhase1() {
|
default double getCurrentPhase1() {
|
||||||
return Short.MIN_VALUE;
|
return Integer.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
default double getCurrentPhase2() {
|
default double getCurrentPhase2() {
|
||||||
return Short.MIN_VALUE;
|
return Integer.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
default double getCurrentPhase3() {
|
default double getCurrentPhase3() {
|
||||||
return Short.MIN_VALUE;
|
return Integer.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
default short getOutputPowerPhase1() {
|
default short getOutputPowerPhase1() {
|
||||||
@ -213,15 +213,15 @@ public interface LocalData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
default double getFrequencyPhase1() {
|
default double getFrequencyPhase1() {
|
||||||
return Short.MIN_VALUE;
|
return Integer.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
default double getFrequencyPhase2() {
|
default double getFrequencyPhase2() {
|
||||||
return Short.MIN_VALUE;
|
return Integer.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
default double getFrequencyPhase3() {
|
default double getFrequencyPhase3() {
|
||||||
return Short.MIN_VALUE;
|
return Integer.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
default short getInverterWorkModeCode() {
|
default short getInverterWorkModeCode() {
|
||||||
|
@ -49,7 +49,7 @@ public class X1HybridG4Data extends CommonLocalDeviceData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short getFeedInPower() {
|
public int getFeedInPower() {
|
||||||
return getFromRawData(32);
|
return getFromRawData(32);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ package org.openhab.binding.solax.internal.model.local;
|
|||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.openhab.binding.solax.internal.connectivity.rawdata.local.LocalConnectRawDataBean;
|
import org.openhab.binding.solax.internal.connectivity.rawdata.local.LocalConnectRawDataBean;
|
||||||
|
import org.openhab.binding.solax.internal.util.ByteUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@link X3HybridG4Data} is an implementation of the single phased inverter data interface for X3 Hybrid G4
|
* The {@link X3HybridG4Data} is an implementation of the single phased inverter data interface for X3 Hybrid G4
|
||||||
@ -129,7 +130,7 @@ public class X3HybridG4Data extends CommonLocalDeviceData {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getBatteryVoltage() {
|
public double getBatteryVoltage() {
|
||||||
return ((double) getFromRawData(39)) / 100;
|
return ((double) ByteUtil.read32BitSigned(getFromRawData(169), getFromRawData(170))) / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -155,8 +156,8 @@ public class X3HybridG4Data extends CommonLocalDeviceData {
|
|||||||
// Feed in power
|
// Feed in power
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short getFeedInPower() {
|
public int getFeedInPower() {
|
||||||
return (short) (getFromRawData(34) - getFromRawData(35));
|
return ByteUtil.read32BitSigned(getFromRawData(34), getFromRawData(35));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Totals
|
// Totals
|
||||||
@ -168,47 +169,47 @@ public class X3HybridG4Data extends CommonLocalDeviceData {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getTotalEnergy() {
|
public double getTotalEnergy() {
|
||||||
return ((double) getFromRawData(68)) / 10;
|
return ((double) ByteUtil.read32BitSigned(getFromRawData(68), getFromRawData(69))) / 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short getTotalBatteryDischargeEnergy() {
|
public double getTotalBatteryDischargeEnergy() {
|
||||||
return getFromRawData(74);
|
return ((double) ByteUtil.read32BitSigned(getFromRawData(74), getFromRawData(75))) / 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short getTotalBatteryChargeEnergy() {
|
public double getTotalBatteryChargeEnergy() {
|
||||||
return getFromRawData(76);
|
return ((double) ByteUtil.read32BitSigned(getFromRawData(76), getFromRawData(77))) / 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getTotalPVEnergy() {
|
public double getTotalPVEnergy() {
|
||||||
return ((double) getFromRawData(80)) / 10;
|
return ((double) ByteUtil.read32BitSigned(getFromRawData(80), getFromRawData(81))) / 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short getTotalFeedInEnergy() {
|
public double getTotalFeedInEnergy() {
|
||||||
return getFromRawData(86);
|
return ((double) ByteUtil.read32BitSigned(getFromRawData(86), getFromRawData(87))) / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getTotalConsumption() {
|
public double getTotalConsumption() {
|
||||||
return ((double) getFromRawData(88)) / 10;
|
return ((double) ByteUtil.read32BitSigned(getFromRawData(88), getFromRawData(89))) / 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getTodayEnergy() {
|
public double getTodayEnergy() {
|
||||||
return ((double) getFromRawData(82)) / 10;
|
return ((double) getFromRawData(70)) / 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getTodayFeedInEnergy() {
|
public double getTodayFeedInEnergy() {
|
||||||
return ((double) getFromRawData(90)) / 100;
|
return ((double) ByteUtil.read32BitSigned(getFromRawData(90), getFromRawData(91))) / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getTodayConsumption() {
|
public double getTodayConsumption() {
|
||||||
return ((double) getFromRawData(92)) / 100;
|
return ((double) ByteUtil.read32BitSigned(getFromRawData(92), getFromRawData(93))) / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -45,7 +45,8 @@ public class X3HybridG4DataParser implements RawDataParser {
|
|||||||
CHANNEL_INVERTER_OUTPUT_FREQUENCY_PHASE3, CHANNEL_POWER_USAGE, CHANNEL_TOTAL_ENERGY,
|
CHANNEL_INVERTER_OUTPUT_FREQUENCY_PHASE3, CHANNEL_POWER_USAGE, CHANNEL_TOTAL_ENERGY,
|
||||||
CHANNEL_TOTAL_BATTERY_CHARGE_ENERGY, CHANNEL_TOTAL_PV_ENERGY, CHANNEL_TOTAL_CONSUMPTION,
|
CHANNEL_TOTAL_BATTERY_CHARGE_ENERGY, CHANNEL_TOTAL_PV_ENERGY, CHANNEL_TOTAL_CONSUMPTION,
|
||||||
CHANNEL_TODAY_ENERGY, CHANNEL_TODAY_FEED_IN_ENERGY, CHANNEL_TODAY_CONSUMPTION,
|
CHANNEL_TODAY_ENERGY, CHANNEL_TODAY_FEED_IN_ENERGY, CHANNEL_TODAY_CONSUMPTION,
|
||||||
CHANNEL_TODAY_BATTERY_CHARGE_ENERGY, CHANNEL_TODAY_BATTERY_DISCHARGE_ENERGY, CHANNEL_INVERTER_WORKMODE);
|
CHANNEL_TODAY_BATTERY_CHARGE_ENERGY, CHANNEL_TODAY_BATTERY_DISCHARGE_ENERGY, CHANNEL_INVERTER_WORKMODE,
|
||||||
|
CHANNEL_TOTAL_FEED_IN_ENERGY, CHANNEL_TOTAL_BATTERY_DISCHARGE_ENERGY);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LocalData getData(LocalConnectRawDataBean rawData) {
|
public LocalData getData(LocalConnectRawDataBean rawData) {
|
||||||
|
@ -31,14 +31,15 @@ public class TestX3HybridG4Parser extends AbstractParserTest {
|
|||||||
{
|
{
|
||||||
sn:XYZ,
|
sn:XYZ,
|
||||||
ver:3.005.01,
|
ver:3.005.01,
|
||||||
type:14,Data:[
|
type:14,
|
||||||
|
Data:[
|
||||||
2316,2329,2315,18,18,18,372,363,365,1100,
|
2316,2329,2315,18,18,18,372,363,365,1100,
|
||||||
12,23,34,45,56,67,4996,4996,4996,2,
|
12,23,34,45,56,67,4996,4996,4996,2,
|
||||||
0,0,0,0,0,0,0,0,0,0,
|
0,0,0,0,0,0,0,0,0,0,
|
||||||
0,0,0,1,65494,65535,0,0,0,31330,
|
0,0,0,1,65494,65535,0,0,0,31330,
|
||||||
320,1034,3078,1,44,1100,256,1294,0,0,
|
320,1034,3078,1,44,1100,256,1294,0,0,
|
||||||
7445,5895,100,0,38,0,0,0,0,0,
|
7445,5895,100,0,38,0,0,0,0,0,
|
||||||
0,0,0,0,0,0,0,0,505,0,
|
0,0,0,0,0,0,0,0,588,1,
|
||||||
396,0,0,0,102,0,142,0,62,110,
|
396,0,0,0,102,0,142,0,62,110,
|
||||||
570,0,463,0,0,0,1925,0,369,0,
|
570,0,463,0,0,0,1925,0,369,0,
|
||||||
506,1925,304,309,0,0,0,0,0,0,
|
506,1925,304,309,0,0,0,0,0,0,
|
||||||
@ -47,6 +48,24 @@ public class TestX3HybridG4Parser extends AbstractParserTest {
|
|||||||
Information:[12.000,14,XY,8,1.23,0.00,1.24,1.09,0.00,1]
|
Information:[12.000,14,XY,8,1.23,0.00,1.24,1.09,0.00,1]
|
||||||
}
|
}
|
||||||
""";
|
""";
|
||||||
|
private static final String RAW_DATA_X3_RUEPERT = """
|
||||||
|
{
|
||||||
|
"sn":"SRABCDEFGH",
|
||||||
|
"ver":"3.009.03",
|
||||||
|
"type":14,
|
||||||
|
"Data":[
|
||||||
|
2367,2360,2375,10,10,10,48,48,58,154,
|
||||||
|
6077,5297,19,19,1177,1058,5003,5003,5003,2,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,32310,
|
||||||
|
600,1971,3213,61,1959,1,46,154,256,10528,
|
||||||
|
3083,6154,100,0,34,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,2380,1,
|
||||||
|
52,77,0,0,6253,0,7500,0,37,46,
|
||||||
|
6854,1,64,4,0,0,2662,8,10050,0,
|
||||||
|
30,0,518,0,0,0,0,0,0,0,
|
||||||
|
0,0,1,51,1,23,47,256,3504,2400,300,300,249,227,34,33,74,1620,1024,16448,16448,16448,0,0,0,3352,3344,57729,21,20564,12339,18753,12354,16694,13124,12848,20564,12339,19010,12857,16690,13124,13368,20564,12339,19010,12601,16691,12356,12597,20564,12339,19010,12601,16691,12356,14387,0,0,0,0,0,0,0,515,257,1281,1027,0,32310,0,0,0,0,0,0,0,0,0,0,0,0,0,161,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"Information":[10.000,14,"H34A10IA999999",8,1.41,0.00,1.40,1.09,0.00,1]}
|
||||||
|
""";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected InverterType getInverterType() {
|
protected InverterType getInverterType() {
|
||||||
@ -86,9 +105,9 @@ public class TestX3HybridG4Parser extends AbstractParserTest {
|
|||||||
assertEquals(2, data.getInverterWorkModeCode()); // [19]
|
assertEquals(2, data.getInverterWorkModeCode()); // [19]
|
||||||
assertEquals("2", data.getInverterWorkMode()); // [19]
|
assertEquals("2", data.getInverterWorkMode()); // [19]
|
||||||
|
|
||||||
assertEquals(-41, data.getFeedInPower()); // [34] - [35]
|
assertEquals(-42, data.getFeedInPower()); // [34][35]
|
||||||
|
|
||||||
assertEquals(313.3, data.getBatteryVoltage()); // [39]
|
assertEquals(2.59, data.getBatteryVoltage()); // [39]
|
||||||
assertEquals(3.2, data.getBatteryCurrent()); // [40]
|
assertEquals(3.2, data.getBatteryCurrent()); // [40]
|
||||||
assertEquals(1034, data.getBatteryPower()); // [41]
|
assertEquals(1034, data.getBatteryPower()); // [41]
|
||||||
assertEquals(45, data.getBatteryLevel()); // [103]
|
assertEquals(45, data.getBatteryLevel()); // [103]
|
||||||
@ -96,15 +115,15 @@ public class TestX3HybridG4Parser extends AbstractParserTest {
|
|||||||
|
|
||||||
// Totals
|
// Totals
|
||||||
assertEquals(1294, data.getPowerUsage()); // [47]
|
assertEquals(1294, data.getPowerUsage()); // [47]
|
||||||
assertEquals(50.5, data.getTotalEnergy()); // [68]
|
assertEquals(6612.4, data.getTotalEnergy()); // [68][69]
|
||||||
assertEquals(102, data.getTotalBatteryDischargeEnergy()); // [74]
|
assertEquals(10.2, data.getTotalBatteryDischargeEnergy()); // [74][75]
|
||||||
assertEquals(142, data.getTotalBatteryChargeEnergy()); // [76]
|
assertEquals(14.2, data.getTotalBatteryChargeEnergy()); // [76][77]
|
||||||
assertEquals(57, data.getTotalPVEnergy()); // [80]
|
assertEquals(57, data.getTotalPVEnergy()); // [80][81]
|
||||||
assertEquals(1925, data.getTotalFeedInEnergy()); // [86]
|
assertEquals(19.25, data.getTotalFeedInEnergy()); // [86][87]
|
||||||
assertEquals(36.9, data.getTotalConsumption()); // [88]
|
assertEquals(36.9, data.getTotalConsumption()); // [88]
|
||||||
assertEquals(46.3, data.getTodayEnergy()); // [82] / 10
|
assertEquals(39.6, data.getTodayEnergy()); // [82] / 10
|
||||||
assertEquals(5.06, data.getTodayFeedInEnergy()); // [90] / 100
|
assertEquals(1261573.06, data.getTodayFeedInEnergy()); // [90][91] / 100
|
||||||
assertEquals(3.04, data.getTodayConsumption()); // [92] / 100
|
assertEquals(202509.28, data.getTodayConsumption()); // [92][93] / 100
|
||||||
assertEquals(6.2, data.getTodayBatteryDischargeEnergy()); // [78] / 100
|
assertEquals(6.2, data.getTodayBatteryDischargeEnergy()); // [78] / 100
|
||||||
assertEquals(11, data.getTodayBatteryChargeEnergy()); // [79] / 100
|
assertEquals(11, data.getTodayBatteryChargeEnergy()); // [79] / 100
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user