]> git.basschouten.com Git - openhab-addons.git/commitdiff
[senechome] Fix `ArrayIndexOutOfBoundsException` when less than 4 packs (#17299)
authorlsiepel <leosiepel@gmail.com>
Mon, 9 Sep 2024 17:12:23 +0000 (19:12 +0200)
committerGitHub <noreply@github.com>
Mon, 9 Sep 2024 17:12:23 +0000 (19:12 +0200)
* Fix issue and warnings
* Fix operator

Signed-off-by: Leo Siepel <leosiepel@gmail.com>
20 files changed:
bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/SenecHomeApi.java
bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/SenecHomeHandler.java
bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/SenecSystemStatus.java
bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/SenecWallboxStatus.java
bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/dto/SenecHomeBattery.java [new file with mode: 0644]
bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/dto/SenecHomeEnergy.java [new file with mode: 0644]
bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/dto/SenecHomeGrid.java [new file with mode: 0644]
bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/dto/SenecHomePower.java [new file with mode: 0644]
bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/dto/SenecHomeResponse.java [new file with mode: 0644]
bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/dto/SenecHomeStatistics.java [new file with mode: 0644]
bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/dto/SenecHomeTemperature.java [new file with mode: 0644]
bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/dto/SenecHomeWallbox.java [new file with mode: 0644]
bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/json/SenecHomeBattery.java [deleted file]
bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/json/SenecHomeEnergy.java [deleted file]
bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/json/SenecHomeGrid.java [deleted file]
bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/json/SenecHomePower.java [deleted file]
bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/json/SenecHomeResponse.java [deleted file]
bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/json/SenecHomeStatistics.java [deleted file]
bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/json/SenecHomeTemperature.java [deleted file]
bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/json/SenecHomeWallbox.java [deleted file]

index 9dd66a1dd5647c15470ca42101be782f241bcc30..ccb0246e7a9648a600f47295847a30a963282499 100644 (file)
@@ -27,7 +27,7 @@ import org.eclipse.jetty.http.HttpHeader;
 import org.eclipse.jetty.http.HttpMethod;
 import org.eclipse.jetty.http.HttpStatus;
 import org.eclipse.jetty.http.MimeTypes;
-import org.openhab.binding.senechome.internal.json.SenecHomeResponse;
+import org.openhab.binding.senechome.internal.dto.SenecHomeResponse;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
index 85733e6e870a1b7098cea9f1a33d5973847c3d53..a5eaf7831b52bf704dc1e760786444ddd48aa950 100644 (file)
@@ -32,7 +32,7 @@ import javax.measure.Unit;
 import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.jetty.client.HttpClient;
-import org.openhab.binding.senechome.internal.json.SenecHomeResponse;
+import org.openhab.binding.senechome.internal.dto.SenecHomeResponse;
 import org.openhab.core.cache.ExpiringCache;
 import org.openhab.core.library.types.DecimalType;
 import org.openhab.core.library.types.OnOffType;
@@ -67,8 +67,6 @@ public class SenecHomeHandler extends BaseThingHandler {
     private static final BigDecimal DIVISOR_MILLI_TO_KILO = BigDecimal.valueOf(1000000);
     // divisor to transform from milli to "iso" UNIT (e.g. mV => V)
     private static final BigDecimal DIVISOR_MILLI_TO_ISO = BigDecimal.valueOf(1000);
-    // divisor to transform from "iso" to kilo UNIT (e.g. W => kW)
-    private static final BigDecimal DIVISOR_ISO_TO_KILO = BigDecimal.valueOf(1000);
     // ix (x=1,3,8) types => hex encoded integer value
     private static final String VALUE_TYPE_INT1 = "i1";
     public static final String VALUE_TYPE_INT3 = "i3";
@@ -82,7 +80,7 @@ public class SenecHomeHandler extends BaseThingHandler {
 
     private @Nullable ScheduledFuture<?> refreshJob;
     private @Nullable PowerLimitationStatusDTO limitationStatus = null;
-    private final @Nullable SenecHomeApi senecHomeApi;
+    private final SenecHomeApi senecHomeApi;
     private SenecHomeConfigurationDTO config = new SenecHomeConfigurationDTO();
     private final ExpiringCache<Boolean> refreshCache = new ExpiringCache<>(Duration.ofSeconds(5), this::refreshState);
 
@@ -133,6 +131,18 @@ public class SenecHomeHandler extends BaseThingHandler {
         refreshCache.getValue();
     }
 
+    private <Q extends Quantity<Q>> void updateQtyStateIfAvailable(String channel, String @Nullable [] valueArray,
+            int arrayIndex, int scale, Unit<Q> unit) {
+        updateQtyStateIfAvailable(channel, valueArray, arrayIndex, scale, unit, null);
+    }
+
+    private <Q extends Quantity<Q>> void updateQtyStateIfAvailable(String channel, String @Nullable [] valueArray,
+            int arrayIndex, int scale, Unit<Q> unit, @Nullable BigDecimal divisor) {
+        if (valueArray != null && valueArray.length > arrayIndex) {
+            updateQtyState(channel, valueArray[arrayIndex], scale, unit, divisor);
+        }
+    }
+
     public @Nullable Boolean refreshState() {
         SenecHomeResponse response = null;
         try {
@@ -197,65 +207,68 @@ public class SenecHomeHandler extends BaseThingHandler {
             updateQtyState(CHANNEL_SENEC_GRID_VOLTAGE_PH3, response.grid.currentGridVoltagePerPhase[2], 2, Units.VOLT);
             updateQtyState(CHANNEL_SENEC_GRID_FREQUENCY, response.grid.currentGridFrequency, 2, Units.HERTZ);
 
-            if (response.battery.chargedEnergy != null) {
-                updateQtyState(CHANNEL_SENEC_CHARGED_ENERGY_PACK1, response.battery.chargedEnergy[0], 2,
-                        Units.KILOWATT_HOUR, DIVISOR_MILLI_TO_KILO);
-                updateQtyState(CHANNEL_SENEC_CHARGED_ENERGY_PACK2, response.battery.chargedEnergy[1], 2,
-                        Units.KILOWATT_HOUR, DIVISOR_MILLI_TO_KILO);
-                updateQtyState(CHANNEL_SENEC_CHARGED_ENERGY_PACK3, response.battery.chargedEnergy[2], 2,
-                        Units.KILOWATT_HOUR, DIVISOR_MILLI_TO_KILO);
-                updateQtyState(CHANNEL_SENEC_CHARGED_ENERGY_PACK4, response.battery.chargedEnergy[3], 2,
-                        Units.KILOWATT_HOUR, DIVISOR_MILLI_TO_KILO);
-            }
-            if (response.battery.dischargedEnergy != null) {
-                updateQtyState(CHANNEL_SENEC_DISCHARGED_ENERGY_PACK1, response.battery.dischargedEnergy[0], 2,
-                        Units.KILOWATT_HOUR, DIVISOR_MILLI_TO_KILO);
-                updateQtyState(CHANNEL_SENEC_DISCHARGED_ENERGY_PACK2, response.battery.dischargedEnergy[1], 2,
-                        Units.KILOWATT_HOUR, DIVISOR_MILLI_TO_KILO);
-                updateQtyState(CHANNEL_SENEC_DISCHARGED_ENERGY_PACK3, response.battery.dischargedEnergy[2], 2,
-                        Units.KILOWATT_HOUR, DIVISOR_MILLI_TO_KILO);
-                updateQtyState(CHANNEL_SENEC_DISCHARGED_ENERGY_PACK4, response.battery.dischargedEnergy[3], 2,
-                        Units.KILOWATT_HOUR, DIVISOR_MILLI_TO_KILO);
-            }
+            updateQtyStateIfAvailable(CHANNEL_SENEC_CHARGED_ENERGY_PACK1, response.battery.chargedEnergy, 0, 2,
+                    Units.KILOWATT_HOUR, DIVISOR_MILLI_TO_KILO);
+            updateQtyStateIfAvailable(CHANNEL_SENEC_CHARGED_ENERGY_PACK2, response.battery.chargedEnergy, 1, 2,
+                    Units.KILOWATT_HOUR, DIVISOR_MILLI_TO_KILO);
+            updateQtyStateIfAvailable(CHANNEL_SENEC_CHARGED_ENERGY_PACK3, response.battery.chargedEnergy, 2, 2,
+                    Units.KILOWATT_HOUR, DIVISOR_MILLI_TO_KILO);
+            updateQtyStateIfAvailable(CHANNEL_SENEC_CHARGED_ENERGY_PACK4, response.battery.chargedEnergy, 3, 2,
+                    Units.KILOWATT_HOUR, DIVISOR_MILLI_TO_KILO);
+
+            updateQtyStateIfAvailable(CHANNEL_SENEC_DISCHARGED_ENERGY_PACK1, response.battery.dischargedEnergy, 0, 2,
+                    Units.KILOWATT_HOUR, DIVISOR_MILLI_TO_KILO);
+            updateQtyStateIfAvailable(CHANNEL_SENEC_DISCHARGED_ENERGY_PACK2, response.battery.dischargedEnergy, 1, 2,
+                    Units.KILOWATT_HOUR, DIVISOR_MILLI_TO_KILO);
+            updateQtyStateIfAvailable(CHANNEL_SENEC_DISCHARGED_ENERGY_PACK3, response.battery.dischargedEnergy, 2, 2,
+                    Units.KILOWATT_HOUR, DIVISOR_MILLI_TO_KILO);
+            updateQtyStateIfAvailable(CHANNEL_SENEC_DISCHARGED_ENERGY_PACK4, response.battery.dischargedEnergy, 3, 2,
+                    Units.KILOWATT_HOUR, DIVISOR_MILLI_TO_KILO);
+
             if (response.battery.cycles != null) {
-                updateDecimalState(CHANNEL_SENEC_CYCLES_PACK1, response.battery.cycles[0]);
-                updateDecimalState(CHANNEL_SENEC_CYCLES_PACK2, response.battery.cycles[1]);
-                updateDecimalState(CHANNEL_SENEC_CYCLES_PACK3, response.battery.cycles[2]);
-                updateDecimalState(CHANNEL_SENEC_CYCLES_PACK4, response.battery.cycles[3]);
-            }
-            if (response.battery.current != null) {
-                updateQtyState(CHANNEL_SENEC_CURRENT_PACK1, response.battery.current[0], 2, Units.AMPERE);
-                updateQtyState(CHANNEL_SENEC_CURRENT_PACK2, response.battery.current[1], 2, Units.AMPERE);
-                updateQtyState(CHANNEL_SENEC_CURRENT_PACK3, response.battery.current[2], 2, Units.AMPERE);
-                updateQtyState(CHANNEL_SENEC_CURRENT_PACK4, response.battery.current[3], 2, Units.AMPERE);
-            }
-            if (response.battery.voltage != null) {
-                updateQtyState(CHANNEL_SENEC_VOLTAGE_PACK1, response.battery.voltage[0], 2, Units.VOLT);
-                updateQtyState(CHANNEL_SENEC_VOLTAGE_PACK2, response.battery.voltage[1], 2, Units.VOLT);
-                updateQtyState(CHANNEL_SENEC_VOLTAGE_PACK3, response.battery.voltage[2], 2, Units.VOLT);
-                updateQtyState(CHANNEL_SENEC_VOLTAGE_PACK4, response.battery.voltage[3], 2, Units.VOLT);
-            }
-            if (response.battery.maxCellVoltage != null) {
-                updateQtyState(CHANNEL_SENEC_MAX_CELL_VOLTAGE_PACK1, response.battery.maxCellVoltage[0], 3, Units.VOLT,
-                        DIVISOR_MILLI_TO_ISO);
-                updateQtyState(CHANNEL_SENEC_MAX_CELL_VOLTAGE_PACK2, response.battery.maxCellVoltage[1], 3, Units.VOLT,
-                        DIVISOR_MILLI_TO_ISO);
-                updateQtyState(CHANNEL_SENEC_MAX_CELL_VOLTAGE_PACK3, response.battery.maxCellVoltage[2], 3, Units.VOLT,
-                        DIVISOR_MILLI_TO_ISO);
-                updateQtyState(CHANNEL_SENEC_MAX_CELL_VOLTAGE_PACK4, response.battery.maxCellVoltage[3], 3, Units.VOLT,
-                        DIVISOR_MILLI_TO_ISO);
-            }
-            if (response.battery.minCellVoltage != null) {
-                updateQtyState(CHANNEL_SENEC_MIN_CELL_VOLTAGE_PACK1, response.battery.minCellVoltage[0], 3, Units.VOLT,
-                        DIVISOR_MILLI_TO_ISO);
-                updateQtyState(CHANNEL_SENEC_MIN_CELL_VOLTAGE_PACK2, response.battery.minCellVoltage[1], 3, Units.VOLT,
-                        DIVISOR_MILLI_TO_ISO);
-                updateQtyState(CHANNEL_SENEC_MIN_CELL_VOLTAGE_PACK3, response.battery.minCellVoltage[2], 3, Units.VOLT,
-                        DIVISOR_MILLI_TO_ISO);
-                updateQtyState(CHANNEL_SENEC_MIN_CELL_VOLTAGE_PACK4, response.battery.minCellVoltage[3], 3, Units.VOLT,
-                        DIVISOR_MILLI_TO_ISO);
+                int length = response.battery.cycles.length;
+                if (length > 0) {
+                    updateDecimalState(CHANNEL_SENEC_CYCLES_PACK1, response.battery.cycles[0]);
+                }
+                if (length > 1) {
+                    updateDecimalState(CHANNEL_SENEC_CYCLES_PACK2, response.battery.cycles[1]);
+                }
+                if (length > 2) {
+                    updateDecimalState(CHANNEL_SENEC_CYCLES_PACK3, response.battery.cycles[2]);
+                }
+                if (length > 3) {
+                    updateDecimalState(CHANNEL_SENEC_CYCLES_PACK4, response.battery.cycles[3]);
+                }
             }
 
+            updateQtyStateIfAvailable(CHANNEL_SENEC_CURRENT_PACK1, response.battery.current, 0, 2, Units.AMPERE);
+            updateQtyStateIfAvailable(CHANNEL_SENEC_CURRENT_PACK2, response.battery.current, 1, 2, Units.AMPERE);
+            updateQtyStateIfAvailable(CHANNEL_SENEC_CURRENT_PACK3, response.battery.current, 2, 2, Units.AMPERE);
+            updateQtyStateIfAvailable(CHANNEL_SENEC_CURRENT_PACK4, response.battery.current, 3, 2, Units.AMPERE);
+
+            updateQtyStateIfAvailable(CHANNEL_SENEC_VOLTAGE_PACK1, response.battery.voltage, 0, 2, Units.VOLT);
+            updateQtyStateIfAvailable(CHANNEL_SENEC_VOLTAGE_PACK2, response.battery.voltage, 1, 2, Units.VOLT);
+            updateQtyStateIfAvailable(CHANNEL_SENEC_VOLTAGE_PACK3, response.battery.voltage, 2, 2, Units.VOLT);
+            updateQtyStateIfAvailable(CHANNEL_SENEC_VOLTAGE_PACK4, response.battery.voltage, 3, 2, Units.VOLT);
+
+            updateQtyStateIfAvailable(CHANNEL_SENEC_MAX_CELL_VOLTAGE_PACK1, response.battery.maxCellVoltage, 0, 3,
+                    Units.VOLT, DIVISOR_MILLI_TO_ISO);
+            updateQtyStateIfAvailable(CHANNEL_SENEC_MAX_CELL_VOLTAGE_PACK2, response.battery.maxCellVoltage, 1, 3,
+                    Units.VOLT, DIVISOR_MILLI_TO_ISO);
+            updateQtyStateIfAvailable(CHANNEL_SENEC_MAX_CELL_VOLTAGE_PACK3, response.battery.maxCellVoltage, 2, 3,
+                    Units.VOLT, DIVISOR_MILLI_TO_ISO);
+            updateQtyStateIfAvailable(CHANNEL_SENEC_MAX_CELL_VOLTAGE_PACK4, response.battery.maxCellVoltage, 3, 3,
+                    Units.VOLT, DIVISOR_MILLI_TO_ISO);
+
+            updateQtyStateIfAvailable(CHANNEL_SENEC_MIN_CELL_VOLTAGE_PACK1, response.battery.minCellVoltage, 0, 3,
+                    Units.VOLT, DIVISOR_MILLI_TO_ISO);
+            updateQtyStateIfAvailable(CHANNEL_SENEC_MIN_CELL_VOLTAGE_PACK2, response.battery.minCellVoltage, 1, 3,
+                    Units.VOLT, DIVISOR_MILLI_TO_ISO);
+            updateQtyStateIfAvailable(CHANNEL_SENEC_MIN_CELL_VOLTAGE_PACK3, response.battery.minCellVoltage, 2, 3,
+                    Units.VOLT, DIVISOR_MILLI_TO_ISO);
+            updateQtyStateIfAvailable(CHANNEL_SENEC_MIN_CELL_VOLTAGE_PACK4, response.battery.minCellVoltage, 3, 3,
+                    Units.VOLT, DIVISOR_MILLI_TO_ISO);
+
             if (response.temperature != null) {
                 updateQtyState(CHANNEL_SENEC_BATTERY_TEMPERATURE, response.temperature.batteryTemperature, 0,
                         SIUnits.CELSIUS);
@@ -376,9 +389,10 @@ public class SenecHomeHandler extends BaseThingHandler {
     }
 
     protected void updatePowerLimitationStatus(Channel channel, boolean status, int duration) {
-        if (this.limitationStatus != null) {
-            if (this.limitationStatus.state == status) {
-                long stateSince = new Date().getTime() - this.limitationStatus.time;
+        PowerLimitationStatusDTO limitationStatus = this.limitationStatus;
+        if (limitationStatus != null) {
+            if (limitationStatus.state == status) {
+                long stateSince = new Date().getTime() - limitationStatus.time;
 
                 if (((int) (stateSince / 1000)) < duration) {
                     // skip updating state (possible flapping state)
@@ -387,15 +401,17 @@ public class SenecHomeHandler extends BaseThingHandler {
                     logger.debug("{} longer than required duration {}", status, duration);
                 }
             } else {
-                this.limitationStatus.state = status;
-                this.limitationStatus.time = new Date().getTime();
+                limitationStatus.state = status;
+                limitationStatus.time = new Date().getTime();
+                this.limitationStatus = limitationStatus;
 
                 // skip updating state (state changed, possible flapping state)
                 return;
             }
         } else {
-            this.limitationStatus = new PowerLimitationStatusDTO();
-            this.limitationStatus.state = status;
+            limitationStatus = new PowerLimitationStatusDTO();
+            limitationStatus.state = status;
+            this.limitationStatus = limitationStatus;
         }
 
         logger.debug("Updating power limitation state {}", status);
index affed421c299d5fb0133d0a96916457192bf006c..2f73d76adc584d51487efe62be7529d24c0af522 100644 (file)
@@ -12,6 +12,8 @@
  */
 package org.openhab.binding.senechome.internal;
 
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
 /**
  * The {@link SenecSystemStatus} class defines available Senec specific
  * system states.
@@ -19,6 +21,7 @@ package org.openhab.binding.senechome.internal;
  * @author Steven Schwarznau - Initial contribution
  *
  */
+@NonNullByDefault
 public enum SenecSystemStatus {
 
     INITIALSTATE(0, "INITIAL STATE"),
index 3beae4585370cd435b839c6d91af26488f875cc4..63ad27f4a3f824a57493e7f9a1fb54458617f2cb 100644 (file)
  */
 package org.openhab.binding.senechome.internal;
 
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
 /**
  * Enum with available Senec specific wallbox states.
  *
  * @author Erwin Guib - Initial Contribution
  */
+@NonNullByDefault
 public enum SenecWallboxStatus {
     WAIT_FOR_EV(0xA1, "Waiting for EV"),
     EV_ASKING_CHARGE(0xB1, "EV asking for charge"),
diff --git a/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/dto/SenecHomeBattery.java b/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/dto/SenecHomeBattery.java
new file mode 100644 (file)
index 0000000..886982b
--- /dev/null
@@ -0,0 +1,71 @@
+/**
+ * Copyright (c) 2010-2024 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.senechome.internal.dto;
+
+import java.io.Serializable;
+import java.util.Arrays;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Battery related data from section "BMS".
+ *
+ * @author Erwin Guib - Initial Contribution
+ */
+public class SenecHomeBattery implements Serializable {
+
+    public static final long serialVersionUID = -2850415059107677832L;
+
+    /**
+     * Total charged energy per battery pack (mWh).
+     */
+    public @SerializedName("CHARGED_ENERGY") String[] chargedEnergy;
+
+    /**
+     * Total discharged energy per battery pack (mWh).
+     */
+    public @SerializedName("DISCHARGED_ENERGY") String[] dischargedEnergy;
+
+    /**
+     * Number of load cycles per battery pack.
+     */
+    public @SerializedName("CYCLES") String[] cycles;
+
+    /**
+     * Current per battery pack (A).
+     */
+    public @SerializedName("CURRENT") String[] current;
+
+    /**
+     * Voltage per battery pack (V).
+     */
+    public @SerializedName("VOLTAGE") String[] voltage;
+
+    /**
+     * Maximum cell voltage per battery pack (mV).
+     */
+    public @SerializedName("MAX_CELL_VOLTAGE") String[] maxCellVoltage;
+
+    /**
+     * Minimum cell voltage per battery pack (mV).
+     */
+    public @SerializedName("MIN_CELL_VOLTAGE") String[] minCellVoltage;
+
+    @Override
+    public String toString() {
+        return "SenecHomeBattery{" + "chargedEnergy=" + Arrays.toString(chargedEnergy) + ", dischargedEnergy="
+                + Arrays.toString(dischargedEnergy) + ", cycles=" + Arrays.toString(cycles) + ", current="
+                + Arrays.toString(current) + ", voltage=" + Arrays.toString(voltage) + ", maxCellVoltage="
+                + Arrays.toString(maxCellVoltage) + ", minCellVoltage=" + Arrays.toString(minCellVoltage) + '}';
+    }
+}
diff --git a/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/dto/SenecHomeEnergy.java b/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/dto/SenecHomeEnergy.java
new file mode 100644 (file)
index 0000000..f943394
--- /dev/null
@@ -0,0 +1,74 @@
+/**
+ * Copyright (c) 2010-2024 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.senechome.internal.dto;
+
+import java.io.Serializable;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Json model of senec home devices: This sub model contains values of current workload, i. e. current consumption and
+ * battery charge.
+ *
+ * Section is "ENERGY"
+ *
+ * @author Steven Schwarznau - Initial Contribution
+ */
+public class SenecHomeEnergy implements Serializable {
+
+    private static final long serialVersionUID = -5491226594672777034L;
+
+    /**
+     * House power consumption (W).
+     */
+    public @SerializedName("GUI_HOUSE_POW") String housePowerConsumption;
+
+    /**
+     * Total inverter power (W).
+     * Named "energyProduction" on channel/thing-type side.
+     */
+    public @SerializedName("GUI_INVERTER_POWER") String inverterPowerGeneration;
+
+    /**
+     * Battery power in W (+values loading, -values unloading)
+     */
+    public @SerializedName("GUI_BAT_DATA_POWER") String batteryPower;
+
+    /**
+     * Battery current (A).
+     */
+    public @SerializedName("GUI_BAT_DATA_CURRENT") String batteryCurrent;
+
+    /**
+     * Battery voltage (V).
+     */
+    public @SerializedName("GUI_BAT_DATA_VOLTAGE") String batteryVoltage;
+
+    /**
+     * Battery charge rate (%).
+     */
+    public @SerializedName("GUI_BAT_DATA_FUEL_CHARGE") String batteryFuelCharge;
+
+    /**
+     * Encoded system state.
+     */
+    public @SerializedName("STAT_STATE") String systemState;
+
+    @Override
+    public String toString() {
+        return "SenecHomeEnergy [housePowerConsumption=" + housePowerConsumption + ", inverterPowerGeneration="
+                + inverterPowerGeneration + ", batteryPower=" + batteryPower + ", batteryVoltage=" + batteryVoltage
+                + ", batteryCurrent=" + batteryCurrent + ", batteryFuelCharge=" + batteryFuelCharge + ", systemState="
+                + systemState + "]";
+    }
+}
diff --git a/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/dto/SenecHomeGrid.java b/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/dto/SenecHomeGrid.java
new file mode 100644 (file)
index 0000000..9955ae9
--- /dev/null
@@ -0,0 +1,62 @@
+/**
+ * Copyright (c) 2010-2024 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.senechome.internal.dto;
+
+import java.io.Serializable;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Json model of senec home devices: This sub model contains grid related power values.
+ *
+ * Section "PM1OBJ1" (Enfluri Netz Werte)
+ *
+ * @author Steven Schwarznau - Initial Contribution
+ */
+public class SenecHomeGrid implements Serializable {
+
+    private static final long serialVersionUID = -7479338321370375451L;
+
+    /**
+     * grid value indicating the current power draw (for values larger zero) or supply (for negative values)
+     */
+    public @SerializedName("P_TOTAL") String currentGridValue;
+
+    /**
+     * grid voltage for each phase
+     */
+    public @SerializedName("U_AC") String[] currentGridVoltagePerPhase;
+
+    /**
+     * grid current for each phase
+     */
+    public @SerializedName("I_AC") String[] currentGridCurrentPerPhase;
+
+    /**
+     * grid power for each phase, draw (for values larger zero) or supply (for negative values)
+     */
+    public @SerializedName("P_AC") String[] currentGridPowerPerPhase;
+
+    /**
+     * grid frequency
+     */
+    public @SerializedName("FREQ") String currentGridFrequency;
+
+    @Override
+    public String toString() {
+        return "SenecHomeGrid [currentGridValue=" + currentGridValue + ", gridVoltagePerPhase= "
+                + currentGridVoltagePerPhase + ", currentGridCurrentPerPhase= " + currentGridCurrentPerPhase
+                + ", currentGridPowerPerPhase= " + currentGridPowerPerPhase + ", currentGridFrequency="
+                + currentGridFrequency + "]";
+    }
+}
diff --git a/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/dto/SenecHomePower.java b/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/dto/SenecHomePower.java
new file mode 100644 (file)
index 0000000..85901fa
--- /dev/null
@@ -0,0 +1,56 @@
+/**
+ * Copyright (c) 2010-2024 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.senechome.internal.dto;
+
+import java.io.Serializable;
+import java.util.Arrays;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Json model of senec home devices: This sub model provides the current power statistics by the inverter.
+ *
+ * Section "PV1" in Senec JSON.
+ *
+ * @author Steven Schwarznau - Initial Contribution
+ */
+public class SenecHomePower implements Serializable {
+
+    private static final long serialVersionUID = -7092741166288342343L;
+
+    /**
+     * Power limitation (%).
+     */
+    public @SerializedName("POWER_RATIO") String powerLimitation;
+
+    /**
+     * Current DC current per MPP (A).
+     */
+    public @SerializedName("MPP_CUR") String[] currentPerMpp;
+
+    /**
+     * Current DC power per MPP (W)
+     */
+    public @SerializedName("MPP_POWER") String[] powerPerMpp;
+
+    /**
+     * Current DC tension per MPP (V).
+     */
+    public @SerializedName("MPP_VOL") String[] voltagePerMpp;
+
+    @Override
+    public String toString() {
+        return "SenecHomePower [powerLimitation=" + powerLimitation + ", mppCur=" + Arrays.toString(currentPerMpp)
+                + ", mppPower=" + Arrays.toString(powerPerMpp) + ", mppVol=" + Arrays.toString(voltagePerMpp) + "]";
+    }
+}
diff --git a/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/dto/SenecHomeResponse.java b/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/dto/SenecHomeResponse.java
new file mode 100644 (file)
index 0000000..ef828ae
--- /dev/null
@@ -0,0 +1,40 @@
+/**
+ * Copyright (c) 2010-2024 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.senechome.internal.dto;
+
+import java.io.Serializable;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Json model of senec home devices rebuilt by analyzing the api.
+ *
+ * @author Steven Schwarznau - Initial Contribution
+ */
+public class SenecHomeResponse implements Serializable {
+
+    private static final long serialVersionUID = -2672622188872750438L;
+
+    public @SerializedName("PV1") SenecHomePower power = new SenecHomePower();
+    public @SerializedName("ENERGY") SenecHomeEnergy energy = new SenecHomeEnergy();
+    public @SerializedName("PM1OBJ1") SenecHomeGrid grid = new SenecHomeGrid();
+    public @SerializedName("BMS") SenecHomeBattery battery = new SenecHomeBattery();
+    public @SerializedName("TEMPMEASURE") SenecHomeTemperature temperature = new SenecHomeTemperature();
+    public @SerializedName("WALLBOX") SenecHomeWallbox wallbox = new SenecHomeWallbox();
+
+    @Override
+    public String toString() {
+        return "SenecHomeResponse [power=" + power + ", energy=" + energy + ", grid=" + grid + ", battery" + battery
+                + "temperature" + temperature + "wallbox" + wallbox + "]";
+    }
+}
diff --git a/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/dto/SenecHomeStatistics.java b/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/dto/SenecHomeStatistics.java
new file mode 100644 (file)
index 0000000..3e104a3
--- /dev/null
@@ -0,0 +1,73 @@
+/**
+ * Copyright (c) 2010-2024 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.senechome.internal.dto;
+
+import java.io.Serializable;
+import java.util.Arrays;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Json model of senec home devices: This sub model provides the current statistics by the inverter.
+ *
+ * Section "STATISTIC" in Senec JSON.
+ *
+ * @author Korbinian Probst - Initial Contribution
+ */
+public class SenecHomeStatistics implements Serializable {
+
+    private static final long serialVersionUID = -1102310892637495823L;
+
+    /**
+     * total Wh charged to the battery (kWh)
+     */
+    public @SerializedName("LIVE_BAT_CHARGE") String liveBatCharge;
+
+    /**
+     * total Wh discharged from the battery (kWh)
+     */
+    public @SerializedName("LIVE_BAT_DISCHARGE") String liveBatDischarge;
+
+    /**
+     * total Wh imported from grid (kWh)
+     */
+    public @SerializedName("LIVE_GRID_IMPORT") String liveGridImport;
+
+    /**
+     * total Wh supplied to the grid (kWh)
+     */
+    public @SerializedName("LIVE_GRID_EXPORT") String liveGridExport;
+
+    /**
+     * Total house consumption (kWh)
+     */
+    public @SerializedName("LIVE_HOUSE_CONS") String liveHouseConsumption;
+
+    /**
+     * Total Wh produced (kWh)
+     */
+    public @SerializedName("LIVE_PV_GEN") String livePowerGenerator;
+
+    /**
+     * Total Wh provided to Wallbox (Wh)
+     */
+    public @SerializedName("LIVE_WB_ENERGY") String[] liveWallboxEnergy;
+
+    @Override
+    public String toString() {
+        return "SenecHomeStatistics [liveBatCharge=" + liveBatCharge + ", liveBatDischarge=" + liveBatDischarge
+                + ", liveGridImport=" + liveGridImport + ", liveGridExport=" + liveGridExport
+                + ", liveHouseConsumption=" + liveHouseConsumption + ", livePowerGen=" + livePowerGenerator
+                + ", liveWallboxEnergy=" + Arrays.toString(liveWallboxEnergy) + "]";
+    }
+}
diff --git a/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/dto/SenecHomeTemperature.java b/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/dto/SenecHomeTemperature.java
new file mode 100644 (file)
index 0000000..739f380
--- /dev/null
@@ -0,0 +1,48 @@
+/**
+ * Copyright (c) 2010-2024 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.senechome.internal.dto;
+
+import java.io.Serializable;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Senec Temperature information from "TEMPMEASURE" section.
+ *
+ * @author Erwin Guib - Initial Contribution
+ */
+public class SenecHomeTemperature implements Serializable {
+
+    private static final long serialVersionUID = 5300207918289980752L;
+
+    /**
+     * Battery temperature (°C).
+     */
+    public @SerializedName("BATTERY_TEMP") String batteryTemperature;
+
+    /**
+     * Case temperature (°C).
+     */
+    public @SerializedName("CASE_TEMP") String caseTemperature;
+
+    /**
+     * MCU Temperature (°C).
+     */
+    public @SerializedName("MCU_TEMP") String mcuTemperature;
+
+    @Override
+    public String toString() {
+        return "SenecHomeTemperature{" + "batteryTemperature='" + batteryTemperature + '\'' + ", caseTemperature='"
+                + caseTemperature + '\'' + ", mcuTemperature='" + mcuTemperature + '\'' + '}';
+    }
+}
diff --git a/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/dto/SenecHomeWallbox.java b/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/dto/SenecHomeWallbox.java
new file mode 100644 (file)
index 0000000..1bf23cf
--- /dev/null
@@ -0,0 +1,60 @@
+/**
+ * Copyright (c) 2010-2024 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.senechome.internal.dto;
+
+import java.io.Serializable;
+import java.util.Arrays;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Senec wallbox specific data from "WALLBOX" section.
+ *
+ * @author Erwin Guib - Initial Contribution
+ */
+public class SenecHomeWallbox implements Serializable {
+
+    private static final long serialVersionUID = -664163242812451235L;
+
+    /**
+     * Encoded wallbox state.
+     */
+    public @SerializedName("STATE") String[] state;
+
+    /**
+     * L1 Charging current per wallbox (A).
+     */
+    public @SerializedName("L1_CHARGING_CURRENT") String[] l1ChargingCurrent;
+
+    /**
+     * L2 Charging current per wallbox (A).
+     */
+    public @SerializedName("L2_CHARGING_CURRENT") String[] l2ChargingCurrent;
+
+    /**
+     * L3 Charging current per wallbox (A).
+     */
+    public @SerializedName("L3_CHARGING_CURRENT") String[] l3ChargingCurrent;
+
+    /**
+     * Charging power per wallbox (W).
+     */
+    public @SerializedName("APPARENT_CHARGING_POWER") String[] chargingPower;
+
+    @Override
+    public String toString() {
+        return "SenecWallbox{" + "l1ChargingCurrent=" + Arrays.toString(l1ChargingCurrent) + ", l2ChargingCurrent="
+                + Arrays.toString(l2ChargingCurrent) + ", l3ChargingCurrent=" + Arrays.toString(l3ChargingCurrent)
+                + '}';
+    }
+}
diff --git a/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/json/SenecHomeBattery.java b/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/json/SenecHomeBattery.java
deleted file mode 100644 (file)
index a2cc9ed..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- * Copyright (c) 2010-2024 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.senechome.internal.json;
-
-import java.io.Serializable;
-import java.util.Arrays;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Battery related data from section "BMS".
- *
- * @author Erwin Guib - Initial Contribution
- */
-public class SenecHomeBattery implements Serializable {
-
-    public static final long serialVersionUID = -2850415059107677832L;
-
-    /**
-     * Total charged energy per battery pack (mWh).
-     */
-    public @SerializedName("CHARGED_ENERGY") String[] chargedEnergy;
-
-    /**
-     * Total discharged energy per battery pack (mWh).
-     */
-    public @SerializedName("DISCHARGED_ENERGY") String[] dischargedEnergy;
-
-    /**
-     * Number of load cycles per battery pack.
-     */
-    public @SerializedName("CYCLES") String[] cycles;
-
-    /**
-     * Current per battery pack (A).
-     */
-    public @SerializedName("CURRENT") String[] current;
-
-    /**
-     * Voltage per battery pack (V).
-     */
-    public @SerializedName("VOLTAGE") String[] voltage;
-
-    /**
-     * Maximum cell voltage per battery pack (mV).
-     */
-    public @SerializedName("MAX_CELL_VOLTAGE") String[] maxCellVoltage;
-
-    /**
-     * Minimum cell voltage per battery pack (mV).
-     */
-    public @SerializedName("MIN_CELL_VOLTAGE") String[] minCellVoltage;
-
-    @Override
-    public String toString() {
-        return "SenecHomeBattery{" + "chargedEnergy=" + Arrays.toString(chargedEnergy) + ", dischargedEnergy="
-                + Arrays.toString(dischargedEnergy) + ", cycles=" + Arrays.toString(cycles) + ", current="
-                + Arrays.toString(current) + ", voltage=" + Arrays.toString(voltage) + ", maxCellVoltage="
-                + Arrays.toString(maxCellVoltage) + ", minCellVoltage=" + Arrays.toString(minCellVoltage) + '}';
-    }
-}
diff --git a/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/json/SenecHomeEnergy.java b/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/json/SenecHomeEnergy.java
deleted file mode 100644 (file)
index c4c7fbf..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * Copyright (c) 2010-2024 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.senechome.internal.json;
-
-import java.io.Serializable;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Json model of senec home devices: This sub model contains values of current workload, i. e. current consumption and
- * battery charge.
- *
- * Section is "ENERGY"
- *
- * @author Steven Schwarznau - Initial Contribution
- */
-public class SenecHomeEnergy implements Serializable {
-
-    private static final long serialVersionUID = -5491226594672777034L;
-
-    /**
-     * House power consumption (W).
-     */
-    public @SerializedName("GUI_HOUSE_POW") String housePowerConsumption;
-
-    /**
-     * Total inverter power (W).
-     * Named "energyProduction" on channel/thing-type side.
-     */
-    public @SerializedName("GUI_INVERTER_POWER") String inverterPowerGeneration;
-
-    /**
-     * Battery power in W (+values loading, -values unloading)
-     */
-    public @SerializedName("GUI_BAT_DATA_POWER") String batteryPower;
-
-    /**
-     * Battery current (A).
-     */
-    public @SerializedName("GUI_BAT_DATA_CURRENT") String batteryCurrent;
-
-    /**
-     * Battery voltage (V).
-     */
-    public @SerializedName("GUI_BAT_DATA_VOLTAGE") String batteryVoltage;
-
-    /**
-     * Battery charge rate (%).
-     */
-    public @SerializedName("GUI_BAT_DATA_FUEL_CHARGE") String batteryFuelCharge;
-
-    /**
-     * Encoded system state.
-     */
-    public @SerializedName("STAT_STATE") String systemState;
-
-    @Override
-    public String toString() {
-        return "SenecHomeEnergy [housePowerConsumption=" + housePowerConsumption + ", inverterPowerGeneration="
-                + inverterPowerGeneration + ", batteryPower=" + batteryPower + ", batteryVoltage=" + batteryVoltage
-                + ", batteryCurrent=" + batteryCurrent + ", batteryFuelCharge=" + batteryFuelCharge + ", systemState="
-                + systemState + "]";
-    }
-}
diff --git a/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/json/SenecHomeGrid.java b/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/json/SenecHomeGrid.java
deleted file mode 100644 (file)
index 87fd844..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * Copyright (c) 2010-2024 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.senechome.internal.json;
-
-import java.io.Serializable;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Json model of senec home devices: This sub model contains grid related power values.
- *
- * Section "PM1OBJ1" (Enfluri Netz Werte)
- *
- * @author Steven Schwarznau - Initial Contribution
- */
-public class SenecHomeGrid implements Serializable {
-
-    private static final long serialVersionUID = -7479338321370375451L;
-
-    /**
-     * grid value indicating the current power draw (for values larger zero) or supply (for negative values)
-     */
-    public @SerializedName("P_TOTAL") String currentGridValue;
-
-    /**
-     * grid voltage for each phase
-     */
-    public @SerializedName("U_AC") String[] currentGridVoltagePerPhase;
-
-    /**
-     * grid current for each phase
-     */
-    public @SerializedName("I_AC") String[] currentGridCurrentPerPhase;
-
-    /**
-     * grid power for each phase, draw (for values larger zero) or supply (for negative values)
-     */
-    public @SerializedName("P_AC") String[] currentGridPowerPerPhase;
-
-    /**
-     * grid frequency
-     */
-    public @SerializedName("FREQ") String currentGridFrequency;
-
-    @Override
-    public String toString() {
-        return "SenecHomeGrid [currentGridValue=" + currentGridValue + ", gridVoltagePerPhase= "
-                + currentGridVoltagePerPhase + ", currentGridCurrentPerPhase= " + currentGridCurrentPerPhase
-                + ", currentGridPowerPerPhase= " + currentGridPowerPerPhase + ", currentGridFrequency="
-                + currentGridFrequency + "]";
-    }
-}
diff --git a/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/json/SenecHomePower.java b/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/json/SenecHomePower.java
deleted file mode 100644 (file)
index b203670..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * Copyright (c) 2010-2024 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.senechome.internal.json;
-
-import java.io.Serializable;
-import java.util.Arrays;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Json model of senec home devices: This sub model provides the current power statistics by the inverter.
- *
- * Section "PV1" in Senec JSON.
- *
- * @author Steven Schwarznau - Initial Contribution
- */
-public class SenecHomePower implements Serializable {
-
-    private static final long serialVersionUID = -7092741166288342343L;
-
-    /**
-     * Power limitation (%).
-     */
-    public @SerializedName("POWER_RATIO") String powerLimitation;
-
-    /**
-     * Current DC current per MPP (A).
-     */
-    public @SerializedName("MPP_CUR") String[] currentPerMpp;
-
-    /**
-     * Current DC power per MPP (W)
-     */
-    public @SerializedName("MPP_POWER") String[] powerPerMpp;
-
-    /**
-     * Current DC tension per MPP (V).
-     */
-    public @SerializedName("MPP_VOL") String[] voltagePerMpp;
-
-    @Override
-    public String toString() {
-        return "SenecHomePower [powerLimitation=" + powerLimitation + ", mppCur=" + Arrays.toString(currentPerMpp)
-                + ", mppPower=" + Arrays.toString(powerPerMpp) + ", mppVol=" + Arrays.toString(voltagePerMpp) + "]";
-    }
-}
diff --git a/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/json/SenecHomeResponse.java b/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/json/SenecHomeResponse.java
deleted file mode 100644 (file)
index 7c23982..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * Copyright (c) 2010-2024 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.senechome.internal.json;
-
-import java.io.Serializable;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Json model of senec home devices rebuilt by analyzing the api.
- *
- * @author Steven Schwarznau - Initial Contribution
- */
-public class SenecHomeResponse implements Serializable {
-
-    private static final long serialVersionUID = -2672622188872750438L;
-
-    public @SerializedName("PV1") SenecHomePower power = new SenecHomePower();
-    public @SerializedName("ENERGY") SenecHomeEnergy energy = new SenecHomeEnergy();
-    public @SerializedName("PM1OBJ1") SenecHomeGrid grid = new SenecHomeGrid();
-    public @SerializedName("BMS") SenecHomeBattery battery = new SenecHomeBattery();
-    public @SerializedName("TEMPMEASURE") SenecHomeTemperature temperature = new SenecHomeTemperature();
-    public @SerializedName("WALLBOX") SenecHomeWallbox wallbox = new SenecHomeWallbox();
-
-    @Override
-    public String toString() {
-        return "SenecHomeResponse [power=" + power + ", energy=" + energy + ", grid=" + grid + ", battery" + battery
-                + "temperature" + temperature + "wallbox" + wallbox + "]";
-    }
-}
diff --git a/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/json/SenecHomeStatistics.java b/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/json/SenecHomeStatistics.java
deleted file mode 100644 (file)
index 25816f8..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * Copyright (c) 2010-2024 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.senechome.internal.json;
-
-import java.io.Serializable;
-import java.util.Arrays;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Json model of senec home devices: This sub model provides the current statistics by the inverter.
- *
- * Section "STATISTIC" in Senec JSON.
- *
- * @author Korbinian Probst - Initial Contribution
- */
-public class SenecHomeStatistics implements Serializable {
-
-    private static final long serialVersionUID = -1102310892637495823L;
-
-    /**
-     * total Wh charged to the battery (kWh)
-     */
-    public @SerializedName("LIVE_BAT_CHARGE") String liveBatCharge;
-
-    /**
-     * total Wh discharged from the battery (kWh)
-     */
-    public @SerializedName("LIVE_BAT_DISCHARGE") String liveBatDischarge;
-
-    /**
-     * total Wh imported from grid (kWh)
-     */
-    public @SerializedName("LIVE_GRID_IMPORT") String liveGridImport;
-
-    /**
-     * total Wh supplied to the grid (kWh)
-     */
-    public @SerializedName("LIVE_GRID_EXPORT") String liveGridExport;
-
-    /**
-     * Total house consumption (kWh)
-     */
-    public @SerializedName("LIVE_HOUSE_CONS") String liveHouseConsumption;
-
-    /**
-     * Total Wh produced (kWh)
-     */
-    public @SerializedName("LIVE_PV_GEN") String livePowerGenerator;
-
-    /**
-     * Total Wh provided to Wallbox (Wh)
-     */
-    public @SerializedName("LIVE_WB_ENERGY") String[] liveWallboxEnergy;
-
-    @Override
-    public String toString() {
-        return "SenecHomeStatistics [liveBatCharge=" + liveBatCharge + ", liveBatDischarge=" + liveBatDischarge
-                + ", liveGridImport=" + liveGridImport + ", liveGridExport=" + liveGridExport
-                + ", liveHouseConsumption=" + liveHouseConsumption + ", livePowerGen=" + livePowerGenerator
-                + ", liveWallboxEnergy=" + Arrays.toString(liveWallboxEnergy) + "]";
-    }
-}
diff --git a/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/json/SenecHomeTemperature.java b/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/json/SenecHomeTemperature.java
deleted file mode 100644 (file)
index d35ec4d..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Copyright (c) 2010-2024 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.senechome.internal.json;
-
-import java.io.Serializable;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Senec Temperature information from "TEMPMEASURE" section.
- *
- * @author Erwin Guib - Initial Contribution
- */
-public class SenecHomeTemperature implements Serializable {
-
-    private static final long serialVersionUID = 5300207918289980752L;
-
-    /**
-     * Battery temperature (°C).
-     */
-    public @SerializedName("BATTERY_TEMP") String batteryTemperature;
-
-    /**
-     * Case temperature (°C).
-     */
-    public @SerializedName("CASE_TEMP") String caseTemperature;
-
-    /**
-     * MCU Temperature (°C).
-     */
-    public @SerializedName("MCU_TEMP") String mcuTemperature;
-
-    @Override
-    public String toString() {
-        return "SenecHomeTemperature{" + "batteryTemperature='" + batteryTemperature + '\'' + ", caseTemperature='"
-                + caseTemperature + '\'' + ", mcuTemperature='" + mcuTemperature + '\'' + '}';
-    }
-}
diff --git a/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/json/SenecHomeWallbox.java b/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/json/SenecHomeWallbox.java
deleted file mode 100644 (file)
index 8843678..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * Copyright (c) 2010-2024 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.senechome.internal.json;
-
-import java.io.Serializable;
-import java.util.Arrays;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Senec wallbox specific data from "WALLBOX" section.
- *
- * @author Erwin Guib - Initial Contribution
- */
-public class SenecHomeWallbox implements Serializable {
-
-    private static final long serialVersionUID = -664163242812451235L;
-
-    /**
-     * Encoded wallbox state.
-     */
-    public @SerializedName("STATE") String[] state;
-
-    /**
-     * L1 Charging current per wallbox (A).
-     */
-    public @SerializedName("L1_CHARGING_CURRENT") String[] l1ChargingCurrent;
-
-    /**
-     * L2 Charging current per wallbox (A).
-     */
-    public @SerializedName("L2_CHARGING_CURRENT") String[] l2ChargingCurrent;
-
-    /**
-     * L3 Charging current per wallbox (A).
-     */
-    public @SerializedName("L3_CHARGING_CURRENT") String[] l3ChargingCurrent;
-
-    /**
-     * Charging power per wallbox (W).
-     */
-    public @SerializedName("APPARENT_CHARGING_POWER") String[] chargingPower;
-
-    @Override
-    public String toString() {
-        return "SenecWallbox{" + "l1ChargingCurrent=" + Arrays.toString(l1ChargingCurrent) + ", l2ChargingCurrent="
-                + Arrays.toString(l2ChargingCurrent) + ", l3ChargingCurrent=" + Arrays.toString(l3ChargingCurrent)
-                + '}';
-    }
-}