[fronius] Add additional Inverter DC channels (#12867)

* [fronius] Add additional Inverter DC channels
* [fronius] Update channel description and translations
* [fronius] Add calculated DC Power channels

Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
This commit is contained in:
jimtng 2022-06-07 16:11:06 +10:00 committed by GitHub
parent 22ebb9809b
commit 25d9315197
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 130 additions and 2 deletions

View File

@ -59,12 +59,19 @@ The binding has no configuration options, all configuration is done at `bridge`,
| Channel ID | Item Type | Description |
| ------------------------------------ | ------------------------ | ----------------------------------------------------------------------------------------------------------------- |
| `inverterdatachannelpac` | Number:Power | Power generated |
| `inverterdatachannelpac` | Number:Power | AC Power generated |
| `inverterdatachannelpdc` | Number:Power | DC Power calculated from DC voltage * DC current |
| `inverterdatachannelpdc2` | Number:Power | DC Power 2 calculated from DC voltage 2 * DC current 2 |
| `inverterdatachannelpdc3` | Number:Power | DC Power 3 calculated from DC voltage 3 * DC current 3 |
| `inverterdatachannelfac` | Number:Frequency | AC frequency |
| `inverterdatachanneliac` | Number:ElectricCurrent | AC current |
| `inverterdatachannelidc` | Number:ElectricCurrent | DC current |
| `inverterdatachannelidc2` | Number:ElectricCurrent | DC current 2 |
| `inverterdatachannelidc3` | Number:ElectricCurrent | DC current 3 |
| `inverterdatachanneluac` | Number:ElectricPotential | AC voltage |
| `inverterdatachanneludc` | Number:ElectricPotential | DC voltage |
| `inverterdatachanneludc2` | Number:ElectricPotential | DC voltage 2 |
| `inverterdatachanneludc3` | Number:ElectricPotential | DC voltage 3 |
| `inverterdatachanneldayenergy` | Number:Energy | Energy generated on current day |
| `inverterdatachannelyear` | Number:Energy | Energy generated in current year |
| `inverterdatachanneltotal` | Number:Energy | Energy generated overall |
@ -73,7 +80,7 @@ The binding has no configuration options, all configuration is done at `bridge`,
| `powerflowchannelpgrid` | Number:Power | Grid Power (+ from grid, - to grid) |
| `powerflowchannelpload` | Number:Power | Load Power (+ generator, - consumer) |
| `powerflowchannelpakku` | Number:Power | Battery Power (+ charge, - discharge) |
| `powerflowchannelppv` | Number:Power | Solar Power (+ production) |
| `powerflowchannelppv` | Number:Power | Solar Power (+ production) |
| `powerflowautonomy` | Number:Dimensionless | The current relative autonomy in % |
| `powerflowselfconsumption` | Number:Dimensionless | The current relative self consumption in % |
| `powerflowinverter1power` | Number:Power | Current power of inverter 1, null if not running (+ produce/export, - consume/import) |

View File

@ -44,8 +44,15 @@ public class FroniusBindingConstants {
public static final String INVERTER_DATA_CHANNEL_FAC = "inverterdatachannelfac";
public static final String INVERTER_DATA_CHANNEL_IAC = "inverterdatachanneliac";
public static final String INVERTER_DATA_CHANNEL_IDC = "inverterdatachannelidc";
public static final String INVERTER_DATA_CHANNEL_IDC2 = "inverterdatachannelidc2";
public static final String INVERTER_DATA_CHANNEL_IDC3 = "inverterdatachannelidc3";
public static final String INVERTER_DATA_CHANNEL_UAC = "inverterdatachanneluac";
public static final String INVERTER_DATA_CHANNEL_UDC = "inverterdatachanneludc";
public static final String INVERTER_DATA_CHANNEL_UDC2 = "inverterdatachanneludc2";
public static final String INVERTER_DATA_CHANNEL_UDC3 = "inverterdatachanneludc3";
public static final String INVERTER_DATA_CHANNEL_PDC = "inverterdatachannelpdc";
public static final String INVERTER_DATA_CHANNEL_PDC2 = "inverterdatachannelpdc2";
public static final String INVERTER_DATA_CHANNEL_PDC3 = "inverterdatachannelpdc3";
public static final String INVERTER_DATA_CHANNEL_DEVICE_STATUS_ERROR_CODE = "inverterdatadevicestatuserrorcode";
public static final String INVERTER_DATA_CHANNEL_DEVICE_STATUS_STATUS_CODE = "inverterdatadevicestatusstatuscode";

View File

@ -30,6 +30,10 @@ public class InverterRealtimeBodyData {
private ValueUnit iac;
@SerializedName("IDC")
private ValueUnit idc;
@SerializedName("IDC_2")
private ValueUnit idc2;
@SerializedName("IDC_3")
private ValueUnit idc3;
@SerializedName("PAC")
private ValueUnit pac;
@SerializedName("TOTAL_ENERGY")
@ -38,6 +42,10 @@ public class InverterRealtimeBodyData {
private ValueUnit uac;
@SerializedName("UDC")
private ValueUnit udc;
@SerializedName("UDC_2")
private ValueUnit udc2;
@SerializedName("UDC_3")
private ValueUnit udc3;
@SerializedName("YEAR_ENERGY")
private ValueUnit yearEnergy;
@SerializedName("DeviceStatus")
@ -110,6 +118,14 @@ public class InverterRealtimeBodyData {
this.idc = idc;
}
public ValueUnit getIdc2() {
return idc2;
}
public ValueUnit getIdc3() {
return idc3;
}
public ValueUnit getUac() {
return uac;
}
@ -125,4 +141,12 @@ public class InverterRealtimeBodyData {
public void setUdc(ValueUnit udc) {
this.udc = udc;
}
public ValueUnit getUdc2() {
return udc2;
}
public ValueUnit getUdc3() {
return udc3;
}
}

View File

@ -96,10 +96,24 @@ public class FroniusSymoInverterHandler extends FroniusBaseThingHandler {
return getQuantityOrZero(inverterData.getIac(), Units.AMPERE);
case FroniusBindingConstants.INVERTER_DATA_CHANNEL_IDC:
return getQuantityOrZero(inverterData.getIdc(), Units.AMPERE);
case FroniusBindingConstants.INVERTER_DATA_CHANNEL_IDC2:
return getQuantityOrZero(inverterData.getIdc2(), Units.AMPERE);
case FroniusBindingConstants.INVERTER_DATA_CHANNEL_IDC3:
return getQuantityOrZero(inverterData.getIdc3(), Units.AMPERE);
case FroniusBindingConstants.INVERTER_DATA_CHANNEL_UAC:
return getQuantityOrZero(inverterData.getUac(), Units.VOLT);
case FroniusBindingConstants.INVERTER_DATA_CHANNEL_UDC:
return getQuantityOrZero(inverterData.getUdc(), Units.VOLT);
case FroniusBindingConstants.INVERTER_DATA_CHANNEL_UDC2:
return getQuantityOrZero(inverterData.getUdc2(), Units.VOLT);
case FroniusBindingConstants.INVERTER_DATA_CHANNEL_UDC3:
return getQuantityOrZero(inverterData.getUdc3(), Units.VOLT);
case FroniusBindingConstants.INVERTER_DATA_CHANNEL_PDC:
return calculatePower(inverterData.getUdc(), inverterData.getIdc());
case FroniusBindingConstants.INVERTER_DATA_CHANNEL_PDC2:
return calculatePower(inverterData.getUdc2(), inverterData.getIdc2());
case FroniusBindingConstants.INVERTER_DATA_CHANNEL_PDC3:
return calculatePower(inverterData.getUdc3(), inverterData.getIdc3());
case FroniusBindingConstants.INVERTER_DATA_CHANNEL_DAY_ENERGY:
// Convert the unit to kWh for backwards compatibility with non-quantity type
return getQuantityOrZero(inverterData.getDayEnergy(), Units.KILOWATT_HOUR).toUnit("kWh");
@ -199,4 +213,17 @@ public class FroniusSymoInverterHandler extends FroniusBaseThingHandler {
String location = FroniusBindingConstants.getInverterDataUrl(ip, deviceId);
return collectDataFromUrl(InverterRealtimeResponse.class, location);
}
/**
* Calculate the power value from the given voltage and current channels
*
* @param voltage the voltage ValueUnit
* @param current the current ValueUnit
* @return {QuantityType<>} the power value calculated by multiplying voltage and current
*/
private QuantityType<?> calculatePower(ValueUnit voltage, ValueUnit current) {
QuantityType<?> qtyVoltage = getQuantityOrZero(voltage, Units.VOLT);
QuantityType<?> qtyCurrent = getQuantityOrZero(current, Units.AMPERE);
return qtyVoltage.multiply(qtyCurrent).toUnit(Units.WATT);
}
}

View File

@ -61,6 +61,10 @@ channel-type.fronius.iac.label = AC Current
channel-type.fronius.iac.description = AC current
channel-type.fronius.idc.label = DC Current
channel-type.fronius.idc.description = DC current
channel-type.fronius.idc2.label = DC Current 2
channel-type.fronius.idc2.description = DC current 2
channel-type.fronius.idc3.label = DC Current 3
channel-type.fronius.idc3.description = DC current 3
channel-type.fronius.inverter1Power.label = Inverter 1 Power
channel-type.fronius.inverter1Power.description = Inverter 1 Power
channel-type.fronius.inverter1Soc.label = Inverter 1 State of Charge
@ -90,6 +94,12 @@ channel-type.fronius.pPv.label = Solar Plant Power
channel-type.fronius.pPv.description = Current Solar Plant Power
channel-type.fronius.pac.label = AC Power
channel-type.fronius.pac.description = AC power
channel-type.fronius.pdc.label = DC Power
channel-type.fronius.pdc.description = DC power
channel-type.fronius.pdc2.label = DC Power 2
channel-type.fronius.pdc2.description = DC power 2
channel-type.fronius.pdc3.label = DC Power 3
channel-type.fronius.pdc3.description = DC power 3
channel-type.fronius.powerflow_rel_autonomy.label = Autonomy
channel-type.fronius.powerflow_rel_autonomy.description = The current relative autonomy in %, NULL if no smart meter is connected
channel-type.fronius.powerflow_rel_selfconsumption.label = Self Consumption
@ -100,5 +110,9 @@ channel-type.fronius.uac.label = AC Voltage
channel-type.fronius.uac.description = AC voltage
channel-type.fronius.udc.label = DC Voltage
channel-type.fronius.udc.description = DC voltage
channel-type.fronius.udc2.label = DC Voltage 2
channel-type.fronius.udc2.description = DC voltage 2
channel-type.fronius.udc3.label = DC Voltage 3
channel-type.fronius.udc3.description = DC voltage 3
channel-type.fronius.year_energy.label = Year Energy
channel-type.fronius.year_energy.description = Energy generated in current year

View File

@ -14,14 +14,21 @@
<channels>
<channel id="inverterdatachannelpac" typeId="pac"/>
<channel id="inverterdatachannelpdc" typeId="pdc"/>
<channel id="inverterdatachannelpdc2" typeId="pdc2"/>
<channel id="inverterdatachannelpdc3" typeId="pdc3"/>
<channel id="inverterdatachanneldayenergy" typeId="day_energy"/>
<channel id="inverterdatachanneltotal" typeId="total_energy"/>
<channel id="inverterdatachannelyear" typeId="year_energy"/>
<channel id="inverterdatachannelfac" typeId="fac"/>
<channel id="inverterdatachanneliac" typeId="iac"/>
<channel id="inverterdatachannelidc" typeId="idc"/>
<channel id="inverterdatachannelidc2" typeId="idc2"/>
<channel id="inverterdatachannelidc3" typeId="idc3"/>
<channel id="inverterdatachanneluac" typeId="uac"/>
<channel id="inverterdatachanneludc" typeId="udc"/>
<channel id="inverterdatachanneludc2" typeId="udc2"/>
<channel id="inverterdatachanneludc3" typeId="udc3"/>
<channel id="inverterdatadevicestatuserrorcode" typeId="devicestatus_errorcode"/>
<channel id="inverterdatadevicestatusstatuscode" typeId="devicestatus_statuscode"/>
<channel id="powerflowchannelpgrid" typeId="pGrid">
@ -157,6 +164,24 @@
<description>AC power</description>
<state pattern="%f W" readOnly="true"></state>
</channel-type>
<channel-type id="pdc">
<item-type>Number:Power</item-type>
<label>DC Power</label>
<description>DC power</description>
<state pattern="%f W" readOnly="true"></state>
</channel-type>
<channel-type id="pdc2">
<item-type>Number:Power</item-type>
<label>DC Power 2</label>
<description>DC power 2</description>
<state pattern="%f W" readOnly="true"></state>
</channel-type>
<channel-type id="pdc3">
<item-type>Number:Power</item-type>
<label>DC Power 3</label>
<description>DC power 3</description>
<state pattern="%f W" readOnly="true"></state>
</channel-type>
<channel-type id="total_energy">
<item-type>Number:Energy</item-type>
<label>Total Energy</label>
@ -190,6 +215,18 @@
<description>DC current</description>
<state pattern="%.2f A" readOnly="true"></state>
</channel-type>
<channel-type id="idc2">
<item-type>Number:ElectricCurrent</item-type>
<label>DC Current 2</label>
<description>DC current 2</description>
<state pattern="%.2f A" readOnly="true"></state>
</channel-type>
<channel-type id="idc3">
<item-type>Number:ElectricCurrent</item-type>
<label>DC Current 3</label>
<description>DC current 3</description>
<state pattern="%.2f A" readOnly="true"></state>
</channel-type>
<channel-type id="uac">
<item-type>Number:ElectricPotential</item-type>
<label>AC Voltage</label>
@ -202,6 +239,18 @@
<description>DC voltage</description>
<state pattern="%.1f V" readOnly="true"></state>
</channel-type>
<channel-type id="udc2">
<item-type>Number:ElectricPotential</item-type>
<label>DC Voltage 2</label>
<description>DC voltage 2</description>
<state pattern="%.1f V" readOnly="true"></state>
</channel-type>
<channel-type id="udc3">
<item-type>Number:ElectricPotential</item-type>
<label>DC Voltage 3</label>
<description>DC voltage 3</description>
<state pattern="%.1f V" readOnly="true"></state>
</channel-type>
<channel-type id="devicestatus_errorcode">
<item-type>Number</item-type>