From: Korbinian Probst <27731930+KorbinianP@users.noreply.github.com> Date: Tue, 3 Nov 2020 07:33:08 +0000 (+0100) Subject: [senechome] implement more data points (3.0) (#8875) X-Git-Url: https://git.basschouten.com/?a=commitdiff_plain;h=067a8f795359793ccd8528a098281a877d4b6dc2;p=openhab-addons.git [senechome] implement more data points (3.0) (#8875) * Add KorbinianP to CODEOWNERS for senechome * Implement Current, Voltage and Power for all three Phases * Bugfix last commit, values are inside array * Implement Grid Frequency * Fix name of currentGridVoltagePerPhase * Extend README.md with new parameters * Implement SenecBatteryStateValue for easier comparison of values in rules * Implement new statistic data points and battery voltage batteryVoltage liveBatCharge liveBatDischarge liveGridExport * Bugfix item types * Implement Review findings, change channelBatteryStateValue to QuantityType * Revert change of channelBatteryStateValue from DecimalType to QuantityType Signed-off-by: Korbinian Probst --- diff --git a/CODEOWNERS b/CODEOWNERS index 1a4e6e29fb..98c606c95f 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -209,7 +209,7 @@ /bundles/org.openhab.binding.sagercaster/ @clinique /bundles/org.openhab.binding.samsungtv/ @paulianttila /bundles/org.openhab.binding.satel/ @druciak -/bundles/org.openhab.binding.senechome/ @vctender +/bundles/org.openhab.binding.senechome/ @vctender @KorbinianP /bundles/org.openhab.binding.seneye/ @nikotanghe /bundles/org.openhab.binding.sensebox/ @hakan42 /bundles/org.openhab.binding.sensibo/ @seime diff --git a/bundles/org.openhab.binding.senechome/README.md b/bundles/org.openhab.binding.senechome/README.md index 5fc2e66501..c76ed30268 100644 --- a/bundles/org.openhab.binding.senechome/README.md +++ b/bundles/org.openhab.binding.senechome/README.md @@ -30,34 +30,66 @@ The property `limitationTresholdValue` is used as threshold for channel `powerLi ## Channels -| Channel | Type | Description | -|----------------------|---------|--------------------------------------------------------------------------| -| powerLimitation | percent | How much is your pv generator limited (0% if not limited anyway) | -| powerLimitationState | ON/OFF | Power limitation active (based on configuration) | -| houseConsumption | watt | Current power consumption of your house/living | -| energyProduction | watt | Energy generated by your pv / inverter | -| batteryPower | watt | Energy processed by batterie itself, for example while charging | -| batteryFuelCharge | percent | Fuel charge of your battery (0 - 100%) | -| batteryState | | text describing current action of battery (e.g. CHARGING) | -| gridPower | watt | Grid power level, negative for supply, positive values for drawing power | -| gridPowerDraw | watt | absolute power level of power draw, zero while supplying | -| gridPowerSupply | watt | absolute power level of power supply, zero while drawing | +| Channel | Type | Description | +|-----------------------|-----------|--------------------------------------------------------------------------| +| powerLimitation | percent | How much is your pv generator limited (0% if not limited anyway) | +| powerLimitationState | ON/OFF | Power limitation active (based on configuration) | +| houseConsumption | watt | Current power consumption of your house/living | +| energyProduction | watt | Energy generated by your pv / inverter | +| batteryPower | watt | Energy processed by batterie itself, for example while charging | +| batteryFuelCharge | percent | Fuel charge of your battery (0 - 100%) | +| batteryState | | Text describing current action of battery (e.g. CHARGE) | +| batteryStateValue | | Value describing current action of battery (e.g. 14) | +| gridPower | watt | Grid power level, negative for supply, positive values for drawing power | +| gridPowerDraw | watt | Absolute power level of power draw, zero while supplying | +| gridPowerSupply | watt | Absolute power level of power supply, zero while drawing | +| gridPowerPhase1 | watt | Grid power level on Phase 1, negative for supply, positive for drawing | +| gridPowerPhase2 | watt | Grid power level on Phase 2, negative for supply, positive for drawing | +| gridPowerPhase3 | watt | Grid power level on Phase 3, negative for supply, positive for drawing | +| gridCurrentPhase1 | ampere | Grid current on Phase 1, always a positive number | +| gridCurrentPhase2 | ampere | Grid current on Phase 2, always a positive number | +| gridCurrentPhase3 | ampere | Grid current on Phase 3, always a positive number | +| gridVoltagePhase1 | volt | Grid voltage on Phase 1 | +| gridVoltagePhase2 | volt | Grid voltage on Phase 2 | +| gridVoltagePhase3 | volt | Grid voltage on Phase 3 | +| gridFrequency | hertz | Grid frequency | +| SenecBatteryVoltage | volt | Battery Voltage | +| SenecLiveBatCharge | watt hour | Live Bat Charge | +| SenecLiveBatDischarge | watt hour | Live Bat Discharge | +| SenecLiveGridImport | watt hour | Live Grid Import | +| SenecLiveGridExport | watt hour | Live Grid Export | ## Items Sample: ``` -Number SenecPowerLimitation "pv generator limit [%d %%]" { channel="senechome:senechome:pvbattery:powerLimitation" } -Switch SenecPowerLimitationState "Power limitation active" { channel="senechome:senechome:pvbattery:powerLimitationState" } -Number SenecHouseConsumption "Current power consumption [%d W]" { channel="senechome:senechome:pvbattery:houseConsumption" } -Number SenecEnergyProduction "Energy generated by pv [%d W]" { channel="senechome:senechome:pvbattery:energyProduction" } -Number SenecBatteryPower "Energy processed by battery [%d W]" { channel="senechome:senechome:pvbattery:batteryPower" } -Number SenecBatteryFuelCharge "State of Charge [%d %%]" { channel="senechome:senechome:pvbattery:batteryFuelCharge" } -String SenecBatteryState "Current action [%s]" { channel="senechome:senechome:pvbattery:batteryState" } -Number SenecGridPower "Grid power level [%d W]" { channel="senechome:senechome:pvbattery:gridPower" } -Number SenecGridPowerDraw "Power draw from grid [%d W]" { channel="senechome:senechome:pvbattery:gridPowerDraw" } -Number SenecGridPowerSupply "Power supply to grid [%d W]" { channel="senechome:senechome:pvbattery:gridPowerSupply" } +Number SenecPowerLimitation "pv generator limit [%d %%]" { channel="senechome:senechome:pvbattery:powerLimitation" } +Switch SenecPowerLimitationState "Power limitation active" { channel="senechome:senechome:pvbattery:powerLimitationState" } +Number SenecHouseConsumption "Current power consumption [%d W]" { channel="senechome:senechome:pvbattery:houseConsumption" } +Number SenecEnergyProduction "Energy generated by pv [%d W]" { channel="senechome:senechome:pvbattery:energyProduction" } +Number SenecBatteryPower "Energy processed by battery [%d W]" { channel="senechome:senechome:pvbattery:batteryPower" } +Number SenecBatteryFuelCharge "State of Charge [%d %%]" { channel="senechome:senechome:pvbattery:batteryFuelCharge" } +String SenecBatteryState "Current action [%s]" { channel="senechome:senechome:pvbattery:batteryState" } +Number SenecBatteryStateValue "Current action [%d]" { channel="senechome:senechome:pvbattery:batteryStateValue" } +Number SenecGridPower "Grid power level [%d W]" { channel="senechome:senechome:pvbattery:gridPower" } +Number SenecGridPowerDraw "Power draw from grid [%d W]" { channel="senechome:senechome:pvbattery:gridPowerDraw" } +Number SenecGridPowerSupply "Power supply to grid [%d W]" { channel="senechome:senechome:pvbattery:gridPowerSupply" } +Number SenecGridPowerPh1 "Power draw from grid on Phase 1 [%d W]" { channel="senechome:senechome:pvbattery:gridPowerPhase1" } +Number SenecGridPowerPh2 "Power draw from grid on Phase 2 [%d W]" { channel="senechome:senechome:pvbattery:gridPowerPhase2" } +Number SenecGridPowerPh3 "Power draw from grid on Phase 3 [%d W]" { channel="senechome:senechome:pvbattery:gridPowerPhase3" } +Number SenecGridCurrentPh1 "Current draw from grid on Phase 1 [%.2f A]" { channel="senechome:senechome:pvbattery:gridCurrentPhase1" } +Number SenecGridCurrentPh2 "Current draw from grid on Phase 2 [%.2f A]" { channel="senechome:senechome:pvbattery:gridCurrentPhase2" } +Number SenecGridCurrentPh3 "Current draw from grid on Phase 3 [%.2f A]" { channel="senechome:senechome:pvbattery:gridCurrentPhase3" } +Number SenecGridVoltagePh1 "Voltage Level on Phase 1 [%d V]" { channel="senechome:senechome:pvbattery:gridVoltagePhase1" } +Number SenecGridVoltagePh2 "Voltage Level on Phase 2 [%d V]" { channel="senechome:senechome:pvbattery:gridVoltagePhase2" } +Number SenecGridVoltagePh3 "Voltage Level on Phase 3 [%d V]" { channel="senechome:senechome:pvbattery:gridVoltagePhase3" } +Number SenecGridFrequency "Grid Frequency [%.2f Hz]" { channel="senechome:senechome:pvbattery:gridFrequency" } +Number SenecBatteryVoltage "Battery Voltage [%.1f V]" { channel="senechome:senechome:pvbattery:batteryVoltage" } +Number SenecLiveBatCharge "Live Bat Charge [%d kWh]" { channel="senechome:senechome:pvbattery:liveBatCharge" } +Number SenecLiveBatDischarge "Live Bat Discharge [%d kWh]" { channel="senechome:senechome:pvbattery:liveBatDischarge" } +Number SenecLiveGridImport "Live Grid Import [%d kWh]" { channel="senechome:senechome:pvbattery:liveGridImport" } +Number SenecLiveGridExport "Live Grid Export [%d kWh]" { channel="senechome:senechome:pvbattery:liveGridExport" } ``` ## Sitemap @@ -74,9 +106,25 @@ Text label="Power Grid"{ Default item=SenecBatteryPower Default item=SenecBatteryFuelCharge Default item=SenecBatteryState + Default item=SenecBatteryStateValue Default item=SenecGridPower Default item=SenecGridPowerDraw Default item=SenecGridPowerSupply + Default item=SenecGridPowerPh1 + Default item=SenecGridPowerPh2 + Default item=SenecGridPowerPh3 + Default item=SenecGridCurrentPh1 + Default item=SenecGridCurrentPh2 + Default item=SenecGridCurrentPh3 + Default item=SenecGridVoltagePh1 + Default item=SenecGridVoltagePh2 + Default item=SenecGridVoltagePh3 + Default item=SenecGridFrequency + Default item=SenecBatteryVoltage + Default item=SenecLiveBatCharge + Default item=SenecLiveBatDischarge + Default item=SenecLiveGridImport + Default item=SenecLiveGridExport } } ``` \ No newline at end of file diff --git a/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/SenecHomeBindingConstants.java b/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/SenecHomeBindingConstants.java index c02c7a147e..33addd852a 100644 --- a/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/SenecHomeBindingConstants.java +++ b/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/SenecHomeBindingConstants.java @@ -30,6 +30,7 @@ public class SenecHomeBindingConstants { public static final String CHANNEL_SENEC_POWER_LIMITATION = "powerLimitation"; public static final String CHANNEL_SENEC_POWER_LIMITATION_STATE = "powerLimitationState"; public static final String CHANNEL_SENEC_BATTERY_STATE = "batteryState"; + public static final String CHANNEL_SENEC_BATTERY_STATE_VALUE = "batteryStateValue"; public static final String CHANNEL_SENEC_POWER_CONSUMPTION = "houseConsumption"; public static final String CHANNEL_SENEC_ENERGY_PRODUCTION = "energyProduction"; public static final String CHANNEL_SENEC_BATTERY_POWER = "batteryPower"; @@ -37,4 +38,19 @@ public class SenecHomeBindingConstants { public static final String CHANNEL_SENEC_GRID_POWER = "gridPower"; public static final String CHANNEL_SENEC_GRID_POWER_SUPPLY = "gridPowerSupply"; public static final String CHANNEL_SENEC_GRID_POWER_DRAW = "gridPowerDraw"; + public static final String CHANNEL_SENEC_GRID_POWER_PH1 = "gridPowerPhase1"; + public static final String CHANNEL_SENEC_GRID_POWER_PH2 = "gridPowerPhase2"; + public static final String CHANNEL_SENEC_GRID_POWER_PH3 = "gridPowerPhase3"; + public static final String CHANNEL_SENEC_GRID_CURRENT_PH1 = "gridCurrentPhase1"; + public static final String CHANNEL_SENEC_GRID_CURRENT_PH2 = "gridCurrentPhase2"; + public static final String CHANNEL_SENEC_GRID_CURRENT_PH3 = "gridCurrentPhase3"; + public static final String CHANNEL_SENEC_GRID_VOLTAGE_PH1 = "gridVoltagePhase1"; + public static final String CHANNEL_SENEC_GRID_VOLTAGE_PH2 = "gridVoltagePhase2"; + public static final String CHANNEL_SENEC_GRID_VOLTAGE_PH3 = "gridVoltagePhase3"; + public static final String CHANNEL_SENEC_GRID_FREQUENCY = "gridFrequency"; + public static final String CHANNEL_SENEC_LIVE_BAT_CHARGE = "liveBatCharge"; + public static final String CHANNEL_SENEC_LIVE_BAT_DISCHARGE = "liveBatDischarge"; + public static final String CHANNEL_SENEC_LIVE_GRID_IMPORT = "liveGridImport"; + public static final String CHANNEL_SENEC_LIVE_GRID_EXPORT = "liveGridExport"; + public static final String CHANNEL_SENEC_BATTERY_VOLTAGE = "batteryVoltage"; } diff --git a/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/SenecHomeHandler.java b/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/SenecHomeHandler.java index d8fce1a05b..393485c82a 100644 --- a/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/SenecHomeHandler.java +++ b/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/SenecHomeHandler.java @@ -25,6 +25,10 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import javax.measure.quantity.Dimensionless; +import javax.measure.quantity.ElectricCurrent; +import javax.measure.quantity.ElectricPotential; +import javax.measure.quantity.Energy; +import javax.measure.quantity.Frequency; import javax.measure.quantity.Power; import org.eclipse.jdt.annotation.NonNullByDefault; @@ -32,6 +36,7 @@ import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jetty.client.HttpClient; import org.openhab.binding.senechome.internal.json.SenecHomeResponse; import org.openhab.core.cache.ExpiringCache; +import org.openhab.core.library.types.DecimalType; import org.openhab.core.library.types.OnOffType; import org.openhab.core.library.types.QuantityType; import org.openhab.core.library.types.StringType; @@ -156,6 +161,110 @@ public class SenecHomeHandler extends BaseThingHandler { getSenecValue(response.energy.batteryFuelCharge).setScale(0, RoundingMode.HALF_UP), SmartHomeUnits.PERCENT)); + Channel channelGridCurrentPhase1 = getThing() + .getChannel(SenecHomeBindingConstants.CHANNEL_SENEC_GRID_CURRENT_PH1); + updateState(channelGridCurrentPhase1.getUID(), new QuantityType( + getSenecValue(response.grid.currentGridCurrentPerPhase[0]).setScale(2, RoundingMode.HALF_UP), + SmartHomeUnits.AMPERE)); + + Channel channelGridCurrentPhase2 = getThing() + .getChannel(SenecHomeBindingConstants.CHANNEL_SENEC_GRID_CURRENT_PH2); + updateState(channelGridCurrentPhase2.getUID(), new QuantityType( + getSenecValue(response.grid.currentGridCurrentPerPhase[1]).setScale(2, RoundingMode.HALF_UP), + SmartHomeUnits.AMPERE)); + + Channel channelGridCurrentPhase3 = getThing() + .getChannel(SenecHomeBindingConstants.CHANNEL_SENEC_GRID_CURRENT_PH3); + updateState(channelGridCurrentPhase3.getUID(), new QuantityType( + getSenecValue(response.grid.currentGridCurrentPerPhase[2]).setScale(2, RoundingMode.HALF_UP), + SmartHomeUnits.AMPERE)); + + Channel channelGridPowerPhase1 = getThing() + .getChannel(SenecHomeBindingConstants.CHANNEL_SENEC_GRID_POWER_PH1); + updateState(channelGridPowerPhase1.getUID(), + new QuantityType( + getSenecValue(response.grid.currentGridPowerPerPhase[0]).setScale(2, RoundingMode.HALF_UP), + SmartHomeUnits.WATT)); + + Channel channelGridPowerPhase2 = getThing() + .getChannel(SenecHomeBindingConstants.CHANNEL_SENEC_GRID_POWER_PH2); + updateState(channelGridPowerPhase2.getUID(), + new QuantityType( + getSenecValue(response.grid.currentGridPowerPerPhase[1]).setScale(2, RoundingMode.HALF_UP), + SmartHomeUnits.WATT)); + + Channel channelGridPowerPhase3 = getThing() + .getChannel(SenecHomeBindingConstants.CHANNEL_SENEC_GRID_POWER_PH3); + updateState(channelGridPowerPhase3.getUID(), + new QuantityType( + getSenecValue(response.grid.currentGridPowerPerPhase[2]).setScale(2, RoundingMode.HALF_UP), + SmartHomeUnits.WATT)); + + Channel channelGridVoltagePhase1 = getThing() + .getChannel(SenecHomeBindingConstants.CHANNEL_SENEC_GRID_VOLTAGE_PH1); + updateState(channelGridVoltagePhase1.getUID(), new QuantityType( + getSenecValue(response.grid.currentGridVoltagePerPhase[0]).setScale(2, RoundingMode.HALF_UP), + SmartHomeUnits.VOLT)); + + Channel channelGridVoltagePhase2 = getThing() + .getChannel(SenecHomeBindingConstants.CHANNEL_SENEC_GRID_VOLTAGE_PH2); + updateState(channelGridVoltagePhase2.getUID(), new QuantityType( + getSenecValue(response.grid.currentGridVoltagePerPhase[1]).setScale(2, RoundingMode.HALF_UP), + SmartHomeUnits.VOLT)); + + Channel channelGridVoltagePhase3 = getThing() + .getChannel(SenecHomeBindingConstants.CHANNEL_SENEC_GRID_VOLTAGE_PH3); + updateState(channelGridVoltagePhase3.getUID(), new QuantityType( + getSenecValue(response.grid.currentGridVoltagePerPhase[2]).setScale(2, RoundingMode.HALF_UP), + SmartHomeUnits.VOLT)); + + Channel channelGridFrequency = getThing() + .getChannel(SenecHomeBindingConstants.CHANNEL_SENEC_GRID_FREQUENCY); + updateState(channelGridFrequency.getUID(), + new QuantityType( + getSenecValue(response.grid.currentGridFrequency).setScale(2, RoundingMode.HALF_UP), + SmartHomeUnits.HERTZ)); + + Channel channelBatteryStateValue = getThing() + .getChannel(SenecHomeBindingConstants.CHANNEL_SENEC_BATTERY_STATE_VALUE); + updateState(channelBatteryStateValue.getUID(), + new DecimalType(getSenecValue(response.energy.batteryState).intValue())); + + Channel channelLiveBatCharge = getThing() + .getChannel(SenecHomeBindingConstants.CHANNEL_SENEC_LIVE_BAT_CHARGE); + updateState(channelLiveBatCharge.getUID(), + new QuantityType( + getSenecValue(response.statistics.liveBatCharge).setScale(2, RoundingMode.HALF_UP), + SmartHomeUnits.WATT_HOUR)); + + Channel channelLiveBatDischarge = getThing() + .getChannel(SenecHomeBindingConstants.CHANNEL_SENEC_LIVE_BAT_DISCHARGE); + updateState(channelLiveBatDischarge.getUID(), + new QuantityType( + getSenecValue(response.statistics.liveBatDischarge).setScale(2, RoundingMode.HALF_UP), + SmartHomeUnits.WATT_HOUR)); + + Channel channelLiveGridImport = getThing() + .getChannel(SenecHomeBindingConstants.CHANNEL_SENEC_LIVE_GRID_IMPORT); + updateState(channelLiveGridImport.getUID(), + new QuantityType( + getSenecValue(response.statistics.liveGridImport).setScale(2, RoundingMode.HALF_UP), + SmartHomeUnits.WATT_HOUR)); + + Channel channelLiveGridExport = getThing() + .getChannel(SenecHomeBindingConstants.CHANNEL_SENEC_LIVE_GRID_EXPORT); + updateState(channelLiveGridExport.getUID(), + new QuantityType( + getSenecValue(response.statistics.liveGridExport).setScale(2, RoundingMode.HALF_UP), + SmartHomeUnits.WATT_HOUR)); + + Channel channelBatteryVoltage = getThing() + .getChannel(SenecHomeBindingConstants.CHANNEL_SENEC_BATTERY_VOLTAGE); + updateState(channelBatteryVoltage.getUID(), + new QuantityType( + getSenecValue(response.energy.batteryVoltage).setScale(2, RoundingMode.HALF_UP), + SmartHomeUnits.VOLT)); + Channel channelBatteryState = getThing().getChannel(SenecHomeBindingConstants.CHANNEL_SENEC_BATTERY_STATE); updateBatteryState(channelBatteryState, getSenecValue(response.energy.batteryState).intValue()); 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 index 0c8f08d98f..e578e53fd9 100644 --- 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 @@ -31,11 +31,12 @@ public class SenecHomeEnergy implements Serializable { public @SerializedName("GUI_BAT_DATA_POWER") String batteryPower; public @SerializedName("GUI_BAT_DATA_FUEL_CHARGE") String batteryFuelCharge; public @SerializedName("STAT_STATE") String batteryState; + public @SerializedName("GUI_BAT_DATA_VOLTAGE") String batteryVoltage; @Override public String toString() { return "SenecHomeEnergy [homePowerConsumption=" + homePowerConsumption + ", inverterPowerGeneration=" + inverterPowerGeneration + ", batteryPower=" + batteryPower + ", batteryFuelCharge=" - + batteryFuelCharge + ", batteryState=" + batteryState + "]"; + + batteryFuelCharge + ", batteryState=" + batteryState + ", batteryVoltage" + batteryVoltage + "]"; } } 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 index 15f4a4ff6a..4011aaae36 100644 --- 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 @@ -17,7 +17,7 @@ import java.io.Serializable; import com.google.gson.annotations.SerializedName; /** - * Json model of senec home devices: This sub model provides the current power limitation by the inverter. + * Json model of senec home devices: This sub model provides the current power statistics by the inverter. * * @author Steven Schwarznau - Initial Contribution */ @@ -30,8 +30,31 @@ public class SenecHomeGrid implements Serializable { */ 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 + "]"; + 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/SenecHomeResponse.java b/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/json/SenecHomeResponse.java index df5e650b11..68f596da82 100644 --- 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 @@ -28,9 +28,11 @@ public class SenecHomeResponse implements Serializable { public @SerializedName("PV1") SenecHomeLimitation limitation = new SenecHomeLimitation(); public @SerializedName("ENERGY") SenecHomeEnergy energy = new SenecHomeEnergy(); public @SerializedName("PM1OBJ1") SenecHomeGrid grid = new SenecHomeGrid(); + public @SerializedName("STATISTIC") SenecHomeStatistics statistics = new SenecHomeStatistics(); @Override public String toString() { - return "SenecHomeResponse [limitation=" + limitation + ", energy=" + energy + ", grid=" + grid + "]"; + return "SenecHomeResponse [limitation=" + limitation + ", energy=" + energy + ", grid=" + grid + ", statistics=" + + statistics + "]"; } } 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 new file mode 100644 index 0000000000..a32ee50941 --- /dev/null +++ b/bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/json/SenecHomeStatistics.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2010-2020 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 provides the current statistics by the inverter. + * + * @author Korbinian Probst - Initial Contribution + */ +public class SenecHomeStatistics implements Serializable { + + private static final long serialVersionUID = -7479338432170375451L; + + /** + * total Wh charged to the battery + */ + public @SerializedName("LIVE_BAT_CHARGE") String liveBatCharge; + + /** + * total Wh discharged from the battery + */ + public @SerializedName("LIVE_BAT_DISCHARGE") String liveBatDischarge; + + /** + * total Wh imported from grid + */ + public @SerializedName("LIVE_GRID_IMPORT") String liveGridImport; + + /** + * total Wh supplied to the grid + */ + public @SerializedName("LIVE_GRID_EXPORT") String liveGridExport; + + @Override + public String toString() { + return "SenecHomeStatistics [liveBatCharge=" + liveBatCharge + ", liveBatDischarge= " + liveBatDischarge + + ", liveGridImport= " + liveGridImport + ", liveGridExport= " + liveGridExport + "]"; + } +} diff --git a/bundles/org.openhab.binding.senechome/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.senechome/src/main/resources/OH-INF/thing/thing-types.xml index e468d88eca..9c22dff0f8 100644 --- a/bundles/org.openhab.binding.senechome/src/main/resources/OH-INF/thing/thing-types.xml +++ b/bundles/org.openhab.binding.senechome/src/main/resources/OH-INF/thing/thing-types.xml @@ -17,9 +17,25 @@ + + + + + + + + + + + + + + + + @@ -82,6 +98,13 @@ + + Number + + Battery + + + Number:Power @@ -110,4 +133,108 @@ + + Number:Power + + Energy + + + + + Number:Power + + Energy + + + + + Number:Power + + Energy + + + + + Number:ElectricCurrent + + Current + + + + + Number:ElectricCurrent + + Current + + + + + Number:ElectricCurrent + + Current + + + + + Number:ElectricPotential + + Voltage + + + + + Number:ElectricPotential + + Voltage + + + + + Number:ElectricPotential + + Voltage + + + + + Number:Frequency + + Frequency + + + + + Number:Energy + + Energy + + + + + Number:Energy + + Energy + + + + + Number:Energy + + Energy + + + + + Number:Energy + + Energy + + + + + Number:ElectricPotential + + Voltage + +