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;
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;
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";
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);
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 {
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);
}
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)
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);
*/
package org.openhab.binding.senechome.internal;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
/**
* The {@link SenecSystemStatus} class defines available Senec specific
* system states.
* @author Steven Schwarznau - Initial contribution
*
*/
+@NonNullByDefault
public enum SenecSystemStatus {
INITIALSTATE(0, "INITIAL STATE"),
*/
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"),
--- /dev/null
+/**
+ * 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) + '}';
+ }
+}
--- /dev/null
+/**
+ * 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 + "]";
+ }
+}
--- /dev/null
+/**
+ * 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 + "]";
+ }
+}
--- /dev/null
+/**
+ * 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) + "]";
+ }
+}
--- /dev/null
+/**
+ * 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 + "]";
+ }
+}
--- /dev/null
+/**
+ * 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) + "]";
+ }
+}
--- /dev/null
+/**
+ * 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 + '\'' + '}';
+ }
+}
--- /dev/null
+/**
+ * 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)
+ + '}';
+ }
+}
+++ /dev/null
-/**
- * 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) + '}';
- }
-}
+++ /dev/null
-/**
- * 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 + "]";
- }
-}
+++ /dev/null
-/**
- * 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 + "]";
- }
-}
+++ /dev/null
-/**
- * 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) + "]";
- }
-}
+++ /dev/null
-/**
- * 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 + "]";
- }
-}
+++ /dev/null
-/**
- * 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) + "]";
- }
-}
+++ /dev/null
-/**
- * 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 + '\'' + '}';
- }
-}
+++ /dev/null
-/**
- * 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)
- + '}';
- }
-}