]> git.basschouten.com Git - openhab-addons.git/commitdiff
[senechome] implement more data points (3.0) (#8875)
authorKorbinian Probst <27731930+KorbinianP@users.noreply.github.com>
Tue, 3 Nov 2020 07:33:08 +0000 (08:33 +0100)
committerGitHub <noreply@github.com>
Tue, 3 Nov 2020 07:33:08 +0000 (23:33 -0800)
* 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 <kp.droid.dev@gmail.com>
CODEOWNERS
bundles/org.openhab.binding.senechome/README.md
bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/SenecHomeBindingConstants.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/json/SenecHomeEnergy.java
bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/json/SenecHomeGrid.java
bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/json/SenecHomeResponse.java
bundles/org.openhab.binding.senechome/src/main/java/org/openhab/binding/senechome/internal/json/SenecHomeStatistics.java [new file with mode: 0644]
bundles/org.openhab.binding.senechome/src/main/resources/OH-INF/thing/thing-types.xml

index 1a4e6e29fb6b61f083c314c78d190b9edfd297a3..98c606c95fb6100a3c260758646c34981edd6bea 100644 (file)
 /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
index 5fc2e66501ea690442297f9d4fbef4ddb268d326..c76ed302680114c74f2b8248879dfc96e8952340 100644 (file)
@@ -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 %%]"         <heating> { channel="senechome:senechome:pvbattery:powerLimitation" }
-Switch SenecPowerLimitationState "Power limitation active"             <switch> { channel="senechome:senechome:pvbattery:powerLimitationState" }
-Number SenecHouseConsumption     "Current power consumption [%d W]"    <energy> { channel="senechome:senechome:pvbattery:houseConsumption" }
-Number SenecEnergyProduction     "Energy generated by pv [%d W]"       <energy> { channel="senechome:senechome:pvbattery:energyProduction" }
-Number SenecBatteryPower         "Energy processed by battery [%d W]"  <energy> { channel="senechome:senechome:pvbattery:batteryPower" }
-Number SenecBatteryFuelCharge    "State of Charge [%d %%]"       <batterylevel> { channel="senechome:senechome:pvbattery:batteryFuelCharge" }
-String SenecBatteryState         "Current action [%s]"                   <text> { channel="senechome:senechome:pvbattery:batteryState" }
-Number SenecGridPower            "Grid power level [%d W]"             <energy> { channel="senechome:senechome:pvbattery:gridPower" }
-Number SenecGridPowerDraw        "Power draw from grid [%d W]"         <energy> { channel="senechome:senechome:pvbattery:gridPowerDraw" }
-Number SenecGridPowerSupply      "Power supply to grid [%d W]"         <energy> { channel="senechome:senechome:pvbattery:gridPowerSupply" }
+Number SenecPowerLimitation      "pv generator limit [%d %%]"                <heating> { channel="senechome:senechome:pvbattery:powerLimitation" }
+Switch SenecPowerLimitationState "Power limitation active"                    <switch> { channel="senechome:senechome:pvbattery:powerLimitationState" }
+Number SenecHouseConsumption     "Current power consumption [%d W]"           <energy> { channel="senechome:senechome:pvbattery:houseConsumption" }
+Number SenecEnergyProduction     "Energy generated by pv [%d W]"              <energy> { channel="senechome:senechome:pvbattery:energyProduction" }
+Number SenecBatteryPower         "Energy processed by battery [%d W]"         <energy> { channel="senechome:senechome:pvbattery:batteryPower" }
+Number SenecBatteryFuelCharge    "State of Charge [%d %%]"              <batterylevel> { channel="senechome:senechome:pvbattery:batteryFuelCharge" }
+String SenecBatteryState         "Current action [%s]"                          <text> { channel="senechome:senechome:pvbattery:batteryState" }
+Number SenecBatteryStateValue    "Current action [%d]"                          <text> { channel="senechome:senechome:pvbattery:batteryStateValue" }
+Number SenecGridPower            "Grid power level [%d W]"                    <energy> { channel="senechome:senechome:pvbattery:gridPower" }
+Number SenecGridPowerDraw        "Power draw from grid [%d W]"                <energy> { channel="senechome:senechome:pvbattery:gridPowerDraw" }
+Number SenecGridPowerSupply      "Power supply to grid [%d W]"                <energy> { channel="senechome:senechome:pvbattery:gridPowerSupply" }
+Number SenecGridPowerPh1         "Power draw from grid on Phase 1 [%d W]"     <energy> { channel="senechome:senechome:pvbattery:gridPowerPhase1" }
+Number SenecGridPowerPh2         "Power draw from grid on Phase 2 [%d W]"     <energy> { channel="senechome:senechome:pvbattery:gridPowerPhase2" }
+Number SenecGridPowerPh3         "Power draw from grid on Phase 3 [%d W]"     <energy> { channel="senechome:senechome:pvbattery:gridPowerPhase3" }
+Number SenecGridCurrentPh1       "Current draw from grid on Phase 1 [%.2f A]" <energy> { channel="senechome:senechome:pvbattery:gridCurrentPhase1" }
+Number SenecGridCurrentPh2       "Current draw from grid on Phase 2 [%.2f A]" <energy> { channel="senechome:senechome:pvbattery:gridCurrentPhase2" }
+Number SenecGridCurrentPh3       "Current draw from grid on Phase 3 [%.2f A]" <energy> { channel="senechome:senechome:pvbattery:gridCurrentPhase3" }
+Number SenecGridVoltagePh1       "Voltage Level on Phase 1 [%d V]"            <energy> { channel="senechome:senechome:pvbattery:gridVoltagePhase1" }
+Number SenecGridVoltagePh2       "Voltage Level on Phase 2 [%d V]"            <energy> { channel="senechome:senechome:pvbattery:gridVoltagePhase2" }
+Number SenecGridVoltagePh3       "Voltage Level on Phase 3 [%d V]"            <energy> { channel="senechome:senechome:pvbattery:gridVoltagePhase3" }
+Number SenecGridFrequency        "Grid Frequency [%.2f Hz]"                   <energy> { channel="senechome:senechome:pvbattery:gridFrequency" }
+Number SenecBatteryVoltage       "Battery Voltage [%.1f V]"                   <energy> { channel="senechome:senechome:pvbattery:batteryVoltage" }
+Number SenecLiveBatCharge        "Live Bat Charge [%d kWh]"                   <energy> { channel="senechome:senechome:pvbattery:liveBatCharge" }
+Number SenecLiveBatDischarge     "Live Bat Discharge [%d kWh]"                <energy> { channel="senechome:senechome:pvbattery:liveBatDischarge" }
+Number SenecLiveGridImport       "Live Grid Import [%d kWh]"                  <energy> { channel="senechome:senechome:pvbattery:liveGridImport" }
+Number SenecLiveGridExport       "Live Grid Export [%d kWh]"                  <energy> { 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
index c02c7a147ecad6512bfa0c176edf38692c5c3ef2..33addd852a55037968e130d5947472325de96ade 100644 (file)
@@ -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";
 }
index d8fce1a05b8a2f27d275ce01145276bedffb3a60..393485c82aaef69bfca332f555f152ca23769296 100644 (file)
@@ -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<ElectricCurrent>(
+                    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<ElectricCurrent>(
+                    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<ElectricCurrent>(
+                    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<Power>(
+                            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<Power>(
+                            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<Power>(
+                            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<ElectricPotential>(
+                    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<ElectricPotential>(
+                    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<ElectricPotential>(
+                    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<Frequency>(
+                            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<Energy>(
+                            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<Energy>(
+                            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<Energy>(
+                            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<Energy>(
+                            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<ElectricPotential>(
+                            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());
 
index 0c8f08d98f4c731f1384e58110ec8a1b2508260d..e578e53fd9dc1113875ccfad53ace348b81197c5 100644 (file)
@@ -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 + "]";
     }
 }
index 15f4a4ff6a8f3485a67ebb368e790bffcc238ac4..4011aaae36b3386925d495619661434eaf04b124 100644 (file)
@@ -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 + "]";
     }
 }
index df5e650b118bff88d725011faacdaac755bc3826..68f596da828ebd32d0f5c038d319422532411ca5 100644 (file)
@@ -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 (file)
index 0000000..a32ee50
--- /dev/null
@@ -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 + "]";
+    }
+}
index e468d88eca774fd9730e9ec9cab7707c0b1a0056..9c22dff0f824b5b2b351dc121a967698f7c457bf 100644 (file)
                        <channel id="batteryPower" typeId="batteryPower"/>
                        <channel id="batteryFuelCharge" typeId="batteryFuelCharge"/>
                        <channel id="batteryState" typeId="system.battery-level"/>
+                       <channel id="batteryStateValue" typeId="batteryStateValue"/>
                        <channel id="gridPower" typeId="gridPower"/>
                        <channel id="gridPowerSupply" typeId="gridPowerSupply"/>
                        <channel id="gridPowerDraw" typeId="gridPowerDraw"/>
+                       <channel id="gridPowerPhase1" typeId="gridPowerPhase1"/>
+                       <channel id="gridPowerPhase2" typeId="gridPowerPhase2"/>
+                       <channel id="gridPowerPhase3" typeId="gridPowerPhase3"/>
+                       <channel id="gridCurrentPhase1" typeId="gridCurrentPhase1"/>
+                       <channel id="gridCurrentPhase2" typeId="gridCurrentPhase2"/>
+                       <channel id="gridCurrentPhase3" typeId="gridCurrentPhase3"/>
+                       <channel id="gridVoltagePhase1" typeId="gridVoltagePhase1"/>
+                       <channel id="gridVoltagePhase2" typeId="gridVoltagePhase2"/>
+                       <channel id="gridVoltagePhase3" typeId="gridVoltagePhase3"/>
+                       <channel id="gridFrequency" typeId="gridFrequency"/>
+                       <channel id="batteryVoltage" typeId="batteryVoltage"/>
+                       <channel id="liveBatCharge" typeId="liveBatCharge"/>
+                       <channel id="liveBatDischarge" typeId="liveBatDischarge"/>
+                       <channel id="liveGridImport" typeId="liveGridImport"/>
+                       <channel id="liveGridExport" typeId="liveGridExport"/>
                </channels>
 
                <config-description>
                <state readOnly="true" pattern="%.0f %unit%"/>
        </channel-type>
 
+       <channel-type id="batteryStateValue">
+               <item-type>Number</item-type>
+               <label>Battery State Value</label>
+               <category>Battery</category>
+               <state readOnly="true" pattern="%d"/>
+       </channel-type>
+
        <channel-type id="energyProduction">
                <item-type>Number:Power</item-type>
                <label>Solar Production</label>
                <state readOnly="true" pattern="%.2f %unit%"/>
        </channel-type>
 
+       <channel-type id="gridPowerPhase1">
+               <item-type>Number:Power</item-type>
+               <label>Grid Power Phase 1</label>
+               <category>Energy</category>
+               <state readOnly="true" pattern="%.2f %unit%"/>
+       </channel-type>
+
+       <channel-type id="gridPowerPhase2">
+               <item-type>Number:Power</item-type>
+               <label>Grid Power Phase 2</label>
+               <category>Energy</category>
+               <state readOnly="true" pattern="%.2f %unit%"/>
+       </channel-type>
+
+       <channel-type id="gridPowerPhase3">
+               <item-type>Number:Power</item-type>
+               <label>Grid Power Phase 3</label>
+               <category>Energy</category>
+               <state readOnly="true" pattern="%.2f %unit%"/>
+       </channel-type>
+
+       <channel-type id="gridCurrentPhase1">
+               <item-type>Number:ElectricCurrent</item-type>
+               <label>Grid Current Phase 1</label>
+               <category>Current</category>
+               <state readOnly="true" pattern="%.2f %unit%"/>
+       </channel-type>
+
+       <channel-type id="gridCurrentPhase2">
+               <item-type>Number:ElectricCurrent</item-type>
+               <label>Grid Current Phase 2</label>
+               <category>Current</category>
+               <state readOnly="true" pattern="%.2f %unit%"/>
+       </channel-type>
+
+       <channel-type id="gridCurrentPhase3">
+               <item-type>Number:ElectricCurrent</item-type>
+               <label>Grid Current Phase 3</label>
+               <category>Current</category>
+               <state readOnly="true" pattern="%.2f %unit%"/>
+       </channel-type>
+
+       <channel-type id="gridVoltagePhase1">
+               <item-type>Number:ElectricPotential</item-type>
+               <label>Grid Voltage Phase 1</label>
+               <category>Voltage</category>
+               <state readOnly="true" pattern="%.2f %unit%"/>
+       </channel-type>
+
+       <channel-type id="gridVoltagePhase2">
+               <item-type>Number:ElectricPotential</item-type>
+               <label>Grid Voltage Phase 2</label>
+               <category>Voltage</category>
+               <state readOnly="true" pattern="%.2f %unit%"/>
+       </channel-type>
+
+       <channel-type id="gridVoltagePhase3">
+               <item-type>Number:ElectricPotential</item-type>
+               <label>Grid Voltage Phase 3</label>
+               <category>Voltage</category>
+               <state readOnly="true" pattern="%.2f %unit%"/>
+       </channel-type>
+
+       <channel-type id="gridFrequency">
+               <item-type>Number:Frequency</item-type>
+               <label>Grid Frequency</label>
+               <category>Frequency</category>
+               <state readOnly="true" pattern="%.2f %unit%"/>
+       </channel-type>
+
+       <channel-type id="liveBatCharge">
+               <item-type>Number:Energy</item-type>
+               <label>Live Bat Charge</label>
+               <category>Energy</category>
+               <state readOnly="true" pattern="%.2f %unit%"/>
+       </channel-type>
+
+       <channel-type id="liveBatDischarge">
+               <item-type>Number:Energy</item-type>
+               <label>Live Bat Discharge</label>
+               <category>Energy</category>
+               <state readOnly="true" pattern="%.2f %unit%"/>
+       </channel-type>
+
+       <channel-type id="liveGridImport">
+               <item-type>Number:Energy</item-type>
+               <label>Live Grid Import</label>
+               <category>Energy</category>
+               <state readOnly="true" pattern="%.2f %unit%"/>
+       </channel-type>
+
+       <channel-type id="liveGridExport">
+               <item-type>Number:Energy</item-type>
+               <label>Live Grid Export</label>
+               <category>Energy</category>
+               <state readOnly="true" pattern="%.2f %unit%"/>
+       </channel-type>
+
+       <channel-type id="batteryVoltage">
+               <item-type>Number:ElectricPotential</item-type>
+               <label>Battery Voltage</label>
+               <category>Voltage</category>
+               <state readOnly="true" pattern="%.2f %unit%"/>
+       </channel-type>
 </thing:thing-descriptions>