Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[omnikinverter] Add extra parameters (temperature, AC frequency, AC current, AC voltage and total hours running) #14244

Merged
merged 20 commits into from
Feb 2, 2023
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
a1ea5f7
[omnikinverter] Added temprature sensor
leansoft Jan 18, 2023
1abbcec
[Omnikinverter] Bugfix for wrong channeltype item-type
leansoft Jan 18, 2023
a67dbea
Update bundles/org.openhab.binding.omnikinverter/src/main/java/org/op…
leansoft Jan 19, 2023
1ac65fb
Update bundles/org.openhab.binding.omnikinverter/README.md
leansoft Jan 19, 2023
f5e4567
Update bundles/org.openhab.binding.omnikinverter/src/main/java/org/op…
leansoft Jan 19, 2023
a7a0249
Update bundles/org.openhab.binding.omnikinverter/src/main/resources/O…
leansoft Jan 19, 2023
9a37972
Update bundles/org.openhab.binding.omnikinverter/src/main/resources/O…
leansoft Jan 19, 2023
4dd77b4
[omnikinverter] README.md alignment fix
leansoft Jan 19, 2023
8b99c49
[omnikinverter] Fixed typo
leansoft Jan 19, 2023
b6b422a
[omnikinverter] Added test coverage for temperature
leansoft Jan 19, 2023
a834fda
[omnikinverter] Added extra data for AC and hours running
leansoft Jan 19, 2023
ebb6178
Update bundles/org.openhab.binding.omnikinverter/src/main/resources/O…
leansoft Jan 19, 2023
f30f30f
Update bundles/org.openhab.binding.omnikinverter/src/main/resources/O…
leansoft Jan 19, 2023
d5d80a0
[omnikinverter] Updated readme for new parameters
leansoft Jan 19, 2023
108ec4c
[omnikinverter] Updated things-types to use System State Channel Types
leansoft Jan 19, 2023
9e08e04
[omnikinverter] Formatting
leansoft Jan 19, 2023
f25b9b2
[omnikinverter] Changes as requested bij PR (#2)
leansoft Jan 24, 2023
5002298
Merge branch 'openhab:main' into main
leansoft Jan 24, 2023
7c92d5b
[Omnikinverter] Fixes for small iteration (#3)
leansoft Feb 2, 2023
625007c
Merge branch 'openhab:main' into main
leansoft Feb 2, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 25 additions & 14 deletions bundles/org.openhab.binding.omnikinverter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,31 @@ No autodiscovery available

## Channels

| Channel Type Id | Item Type | Description |
|:---------------|:--------------|:------------------------------------------------------------------------------------------------------------------|
| power | Number:Power | The instantaneous power generation for feed 1 to the grid, in Watt by default (**deprecated**; same as powerAC1) |
| powerAC1 | Number:Power | The instantaneous power generation for feed 1 to the grid, in Watt by default |
| powerAC2 | Number:Power | The instantaneous power generation for feed 2 to the grid, in Watt by default |
| powerAC3 | Number:Power | The instantaneous power generation for feed 3 to the grid, in Watt by default |
| currentPV1 | Number:Current | The current generation for input string 1, in ampere by default |
| currentPV2 | Number:Current | The current generation for input string 2, in ampere by default |
| currentPV3 | Number:Current | The current generation for input string 3, in ampere by default |
| voltagePV1 | Number:Voltage | The voltage on input string 1, in volt by default |
| voltagePV2 | Number:Voltage | The voltage on input string 2, in volt by default |
| voltagePV3 | Number:Voltage | The voltage on input string 3, in volt by default |
| energyToday | Number:Energy | The amount of energy generated today, in kWh by default |
| energyTotal | Number:Energy | The total amount of energy generated, in kWh by default |
| Channel Type Id | Item Type | Description |
|:----------------|:-------------------------|:-----------------------------------------------------------------------------------------------------------------|
| power | Number:Power | The instantaneous power generation for feed 1 to the grid, in Watt by default (**deprecated**; same as powerAC1) |
| powerAC1 | Number:Power | The instantaneous power generation for feed 1 to the grid, in Watt by default |
| powerAC2 | Number:Power | The instantaneous power generation for feed 2 to the grid, in Watt by default |
| powerAC3 | Number:Power | The instantaneous power generation for feed 3 to the grid, in Watt by default |
| voltageAC1 | Number:ElectricPotential | The voltage for feed 1 to the grid, in Volt by default |
| voltageAC2 | Number:ElectricPotential | The voltage for feed 2 to the grid, in Volt by default |
| voltageAC3 | Number:ElectricPotential | The voltage for feed 3 to the grid, in Volt by default |
| currentAC1 | Number:ElectricCurrent | The current for feed 1 to the grid, in ampere by default |
| currentAC2 | Number:ElectricCurrent | The current for feed 2 to the grid, in ampere by default |
| currentAC3 | Number:ElectricCurrent | The current for feed 3 to the grid, in ampere by default |
| frequencyAC1 | Number:Frequency | The frequrence of feed 1 of the grid, in hertz by default |
| frequencyAC2 | Number:Frequency | The frequrence of feed 2 of the grid, in hertz by default |
| frequencyAC3 | Number:Frequency | The frequrence of feed 3 of the grid, in hertz by default |
| currentPV1 | Number:ElectricCurrent | The current generation for input string 1, in ampere by default |
| currentPV2 | Number:ElectricCurrent | The current generation for input string 2, in ampere by default |
| currentPV3 | Number:ElectricCurrent | The current generation for input string 3, in ampere by default |
| voltagePV1 | Number:ElectricPotential | The voltage on input string 1, in volt by default |
| voltagePV2 | Number:ElectricPotential | The voltage on input string 2, in volt by default |
| voltagePV3 | Number:ElectricPotential | The voltage on input string 3, in volt by default |
| energyToday | Number:Energy | The amount of energy generated today, in kWh by default |
| energyTotal | Number:Energy | The total amount of energy generated, in kWh by default |
| temperature | Number:Temperature | The temperature from the sensor |
| hoursTotal | Number:Time | The totale amount of running hours |
leansoft marked this conversation as resolved.
Show resolved Hide resolved

## Full Example

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,23 @@ public class OmnikInverterBindingConstants {
public static final String CHANNEL_POWER_AC2 = "powerAC2";
public static final String CHANNEL_POWER_AC3 = "powerAC3";

public static final String CHANNEL_VOLTAGE_AC1 = "voltageAC1";
public static final String CHANNEL_VOLTAGE_AC2 = "voltageAC2";
public static final String CHANNEL_VOLTAGE_AC3 = "voltageAC3";

public static final String CHANNEL_CURRENT_AC1 = "currentAC1";
public static final String CHANNEL_CURRENT_AC2 = "currentAC2";
public static final String CHANNEL_CURRENT_AC3 = "currentAC3";

public static final String CHANNEL_FREQUENCY_AC1 = "frequencyAC1";
public static final String CHANNEL_FREQUENCY_AC2 = "frequencyAC2";
public static final String CHANNEL_FREQUENCY_AC3 = "frequencyAC3";

public static final String CHANNEL_ENERGY_TODAY = "energyToday";

public static final String CHANNEL_ENERGY_TOTAL = "energyTotal";

public static final String CHANNEL_TEMPERATURE = "temperature";

public static final String CHANNEL_HOURS_TOTAL = "hoursTotal";
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,23 +87,23 @@ public double getCurrentPV3() {
}

/**
* @return the amperage for AC1
* @return the current for AC1
*/
public double getAmperageAC1() {
public double getCurrentAC1() {
return getShort(45, 10);
}

/**
* @return the amperage for AC2
* @return the current for AC2
*/
public double getAmperageAC2() {
public double getCurrentAC2() {
return getShort(47, 10);
}

/**
* @return the amperage for AC3
* @return the current for AC3
*/
public double getAmperageAC3() {
public double getCurrentAC3() {
return getShort(49, 10);
}

Expand Down Expand Up @@ -141,7 +141,7 @@ public double getFrequencyAC1() {
* @deprecated
*/
public double getPower() {
return getShort(59, 1);
return getPowerAC1();
}

/**
Expand Down Expand Up @@ -194,4 +194,20 @@ public double getEnergyToday() {
public double getTotalEnergy() {
return getInt(71, 10);
}

/**
*
* @return the current temperature in Celsius
*/
public double getTemperature() {
return getShort(31, 10);
}
leansoft marked this conversation as resolved.
Show resolved Hide resolved

/**
*
* @return the total amount of hours the inverter produced energy
*/
public double getHoursTotal() {
return getInt(75, 1);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import javax.measure.quantity.ElectricCurrent;
import javax.measure.quantity.ElectricPotential;
import javax.measure.quantity.Frequency;
import javax.measure.quantity.Power;

import org.eclipse.jdt.annotation.NonNullByDefault;
Expand All @@ -30,6 +31,7 @@
import org.openhab.binding.omnikinverter.internal.OmnikInverterConfiguration;
import org.openhab.binding.omnikinverter.internal.OmnikInverterMessage;
import org.openhab.core.library.types.QuantityType;
import org.openhab.core.library.unit.SIUnits;
import org.openhab.core.library.unit.Units;
import org.openhab.core.thing.ChannelUID;
import org.openhab.core.thing.Thing;
Expand Down Expand Up @@ -92,6 +94,9 @@ private void updateData() {

updateStatus(ThingStatus.ONLINE);

/**
* AC
**/
QuantityType<Power> powerQuantity = new QuantityType<>(message.getPower(), Units.WATT);
updateState(OmnikInverterBindingConstants.CHANNEL_POWER, powerQuantity);

Expand All @@ -104,6 +109,43 @@ private void updateData() {
QuantityType<Power> powerQuantity3 = new QuantityType<>(message.getPowerAC3(), Units.WATT);
updateState(OmnikInverterBindingConstants.CHANNEL_POWER_AC3, powerQuantity3);

QuantityType<ElectricPotential> voltageQuantity1 = new QuantityType<>(message.getVoltageAC1(),
Units.VOLT);
updateState(OmnikInverterBindingConstants.CHANNEL_VOLTAGE_AC1, voltageQuantity1);

QuantityType<ElectricPotential> voltageQuantity2 = new QuantityType<>(message.getVoltageAC2(),
Units.VOLT);
updateState(OmnikInverterBindingConstants.CHANNEL_VOLTAGE_AC2, voltageQuantity2);

QuantityType<ElectricPotential> voltageQuantity3 = new QuantityType<>(message.getVoltageAC3(),
Units.VOLT);
updateState(OmnikInverterBindingConstants.CHANNEL_VOLTAGE_AC3, voltageQuantity3);

QuantityType<ElectricCurrent> currentQuantity1 = new QuantityType<>(message.getCurrentAC1(),
Units.AMPERE);
updateState(OmnikInverterBindingConstants.CHANNEL_CURRENT_AC1, currentQuantity1);

QuantityType<ElectricCurrent> currentQuantity2 = new QuantityType<>(message.getCurrentAC2(),
Units.AMPERE);
updateState(OmnikInverterBindingConstants.CHANNEL_CURRENT_AC2, currentQuantity2);

QuantityType<ElectricCurrent> currentQuantity3 = new QuantityType<>(message.getCurrentAC3(),
Units.AMPERE);
updateState(OmnikInverterBindingConstants.CHANNEL_CURRENT_AC3, currentQuantity3);

QuantityType<Frequency> frequencyQuantity1 = new QuantityType<>(message.getFrequencyAC1(), Units.HERTZ);
updateState(OmnikInverterBindingConstants.CHANNEL_FREQUENCY_AC1, frequencyQuantity1);

QuantityType<Frequency> frequencyQuantity2 = new QuantityType<>(message.getFrequencyAC2(), Units.HERTZ);
updateState(OmnikInverterBindingConstants.CHANNEL_FREQUENCY_AC2, frequencyQuantity2);

QuantityType<Frequency> frequencyQuantity3 = new QuantityType<>(message.getFrequencyAC3(), Units.HERTZ);
updateState(OmnikInverterBindingConstants.CHANNEL_FREQUENCY_AC3, frequencyQuantity3);

/**
* PV
**/

QuantityType<ElectricCurrent> pvAmp1 = new QuantityType<>(message.getCurrentPV1(), Units.AMPERE);
updateState(OmnikInverterBindingConstants.CHANNEL_CURRENT_PV1, pvAmp1);

Expand All @@ -122,11 +164,20 @@ private void updateData() {
QuantityType<ElectricPotential> pvVoltage3 = new QuantityType<>(message.getVoltagePV3(), Units.VOLT);
updateState(OmnikInverterBindingConstants.CHANNEL_VOLTAGE_PV3, pvVoltage3);

/**
* MISC
**/
updateState(OmnikInverterBindingConstants.CHANNEL_ENERGY_TODAY,
new QuantityType<>(message.getEnergyToday(), Units.KILOWATT_HOUR));

updateState(OmnikInverterBindingConstants.CHANNEL_ENERGY_TOTAL,
new QuantityType<>(message.getTotalEnergy(), Units.KILOWATT_HOUR));

updateState(OmnikInverterBindingConstants.CHANNEL_TEMPERATURE,
new QuantityType<>(message.getTemperature(), SIUnits.CELSIUS));

updateState(OmnikInverterBindingConstants.CHANNEL_HOURS_TOTAL,
new QuantityType<>(message.getHoursTotal(), Units.HOUR));
}
} catch (UnknownHostException | NoRouteToHostException | ConnectException e) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getMessage());
Expand Down
Loading