Skip to content

Commit

Permalink
[fronius] Added Ohmpilot thing and channel realpowersum for thing met…
Browse files Browse the repository at this point in the history
…er (#11835)

* Added support for fronius ohmpilot and added smart meter power sum.

Signed-off-by: urmet0 <hannes.spenger@gmail.com>
  • Loading branch information
urmet0 authored Feb 8, 2022
1 parent b54e102 commit ac32260
Show file tree
Hide file tree
Showing 11 changed files with 490 additions and 18 deletions.
45 changes: 40 additions & 5 deletions bundles/org.openhab.binding.fronius/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@ It supports Fronius inverters and Fronius Smart Meter. Tested with a Fronius Sym
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `bridge` | The Bridge |
| `powerinverter` | Fronius Galvo, Symo and other Fronius inverters in combination with the Fronius Datamanager 1.0 / 2.0 or Fronius Datalogger. You can add multiple inverters that depend on the same datalogger with different device ids. (Default 1) |
| `meter` | Fronius Smart Meter. You can add multiple smart meters with different device ids. (The default id = 0) |
| `meter` | Fronius Smart Meter. You can add multiple smart meters with different device ids. (The default id = 0)
| `ohmpilot` | Fronius Ohmpilot. (The default id = 0)


## Discovery

There is no discovery implemented. You have to create your things manually and specify the hostname or IP address of the Datalogger and the device id.

## Binding Configuration

The binding has no configuration options, all configuration is done at `bridge`, `powerinverter` or `meter` level.
The binding has no configuration options, all configuration is done at `bridge`, `powerinverter`, `meter` or `ohmpilot` level.

## Thing Configuration

Expand All @@ -41,6 +43,12 @@ The binding has no configuration options, all configuration is done at `bridge`,
| ---------- | ----------------------------------------------- |
| `deviceId` | The identifier of your smart meter (Default: 0) |

### Ohmpilot Thing Configuration

| Parameter | Description |
| ---------- | ----------------------------------------------- |
| `deviceId` | The identifier of your ohmpilot (Default: 0) |

## Channels

### Channels for `powerinverter` Thing
Expand Down Expand Up @@ -77,6 +85,7 @@ The binding has no configuration options, all configuration is done at `bridge`,
| `powerrealphase1` | Number:Power | Real Power on Phase 1 |
| `powerrealphase2` | Number:Power | Real Power on Phase 2 |
| `powerrealphase3` | Number:Power | Real Power on Phase 3 |
| `powerrealsum` | Number:Power | Real Power summed up |
| `powerfactorphase1` | Number | Power Factor on Phase 1 |
| `powerfactorphase2` | Number | Power Factor on Phase 2 |
| `powerfactorphase3` | Number | Power Factor on Phase 3 |
Expand All @@ -85,16 +94,33 @@ The binding has no configuration options, all configuration is done at `bridge`,
| |


### Channels for `ohmpilot` Thing

| Channel ID | Item Type | Description |
| ----------------------- | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `energyrealsumconsumed` | Number:Energy | Real Energy consumed |
| `powerrealsum` | Number:Power | Real Power |
| `temperaturechannel1` | Number:Temperature | Temperature |
| `errorcode` | Number | Device error code |
| `statecode` | Number | Device state code<br />`0` up and running <br />`1` keep minimum temperature <br />`2` legionella protection <br />`3` critical fault<br />`4` fault<br />`5` boost mode |
| |


## Properties

The `meter` thing has the following properties:
### The `meter` thing has the following properties:

| Property | Description |
| -------- | ------------------------------ |
| `modelId` | The model name of the meter |
| `serialNumber` | The serial number of the meter |

### The `ohmpilot` thing has the following property:

| Property | Description |
| -------- | ------------------------------ |
| `model` | The model name of the meter |
| `serial` | The serial number of the meter |
| `modelId` | The model name of the ohmpilot |
| `serialNumber` | The serial number of the ohmpilot |

## Full Example

Expand All @@ -104,6 +130,7 @@ demo.things:
Bridge fronius:bridge:mybridge [hostname="192.168.66.148", refreshInterval=5] {
Thing powerinverter myinverter [deviceId=1]
Thing meter mymeter [deviceId=0]
Thing ohmpilot myohmpilot [deviceId=0]
}
```

Expand Down Expand Up @@ -136,9 +163,17 @@ Number:Voltage Meter_VoltagePhase3 { channel="fronius:meter:mybridge:mymeter:vol
Number:Power Meter_PowerPhase1 { channel="fronius:meter:mybridge:mymeter:powerrealphase1" }
Number:Power Meter_PowerPhase2 { channel="fronius:meter:mybridge:mymeter:powerrealphase2" }
Number:Power Meter_PowerPhase3 { channel="fronius:meter:mybridge:mymeter:powerrealphase3" }
Number:Power Meter_PowerSum { channel="fronius:meter:mybridge:mymeter:powerrealsum" }
Number Meter_PowerFactorPhase1 { channel="fronius:meter:mybridge:mymeter:powerfactorphase1" }
Number Meter_PowerFactorPhase2 { channel="fronius:meter:mybridge:mymeter:powerfactorphase2" }
Number Meter_PowerFactorPhase3 { channel="fronius:meter:mybridge:mymeter:powerfactorphase3" }
Number:Energy Meter_EnergyConsumed { channel="fronius:meter:mybridge:mymeter:energyrealsumconsumed" }
Number:Energy Meter_EnergyProduced { channel="fronius:meter:mybridge:mymeter:energyrealsumproduced" }
Number:Energy Ohmpilot_EnergyConsumed { channel="fronius:ohmpilot:mybridge:myohmpilot:energyrealsumconsumed" }
Number:Power Ohmpilot_PowerSum { channel="fronius:ohmpilot:mybridge:myohmpilot:powerrealsum" }
Number:Temperature Ohmpilot_Temperature { channel="fronius:ohmpilot:mybridge:myohmpilot:temperaturechannel1" }
Number Ohmpilot_State { channel="fronius:ohmpilot:mybridge:myohmpilot:statecode" }
Number Ohmpilot_Errorcode { channel="fronius:ohmpilot:mybridge:myohmpilot:errorcode" }
```
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* @author Thomas Rokohl - Initial contribution
* @author Peter Schraffl - Added device status and error status channels
* @author Thomas Kordelle - Added inverter power, battery state of charge and PV solar yield
* @author Hannes Spenger - Added ohmpilot & meter power sum
*/
@NonNullByDefault
public class FroniusBindingConstants {
Expand All @@ -32,6 +33,7 @@ public class FroniusBindingConstants {
public static final ThingTypeUID THING_TYPE_INVERTER = new ThingTypeUID(BINDING_ID, "powerinverter");
public static final ThingTypeUID THING_TYPE_BRIDGE = new ThingTypeUID(BINDING_ID, "bridge");
public static final ThingTypeUID THING_TYPE_METER = new ThingTypeUID(BINDING_ID, "meter");
public static final ThingTypeUID THING_TYPE_OHMPILOT = new ThingTypeUID(BINDING_ID, "ohmpilot");

// List of all Channel ids
public static final String INVERTER_DATA_CHANNEL_DAY_ENERGY = "inverterdatachanneldayenergy";
Expand All @@ -49,8 +51,6 @@ public class FroniusBindingConstants {
public static final String POWER_FLOW_P_LOAD = "powerflowchannelpload";
public static final String POWER_FLOW_P_AKKU = "powerflowchannelpakku";
public static final String POWER_FLOW_P_PV = "powerflowchannelppv";
public static final String METER_MODEL = "model";
public static final String METER_SERIAL = "serial";
public static final String METER_ENABLE = "enable";
public static final String METER_LOCATION = "location";
public static final String METER_CURRENT_AC_PHASE_1 = "currentacphase1";
Expand All @@ -62,11 +62,17 @@ public class FroniusBindingConstants {
public static final String METER_POWER_PHASE_1 = "powerrealphase1";
public static final String METER_POWER_PHASE_2 = "powerrealphase2";
public static final String METER_POWER_PHASE_3 = "powerrealphase3";
public static final String METER_POWER_SUM = "powerrealsum";
public static final String METER_POWER_FACTOR_PHASE_1 = "powerfactorphase1";
public static final String METER_POWER_FACTOR_PHASE_2 = "powerfactorphase2";
public static final String METER_POWER_FACTOR_PHASE_3 = "powerfactorphase3";
public static final String METER_ENERGY_REAL_SUM_CONSUMED = "energyrealsumconsumed";
public static final String METER_ENERGY_REAL_SUM_PRODUCED = "energyrealsumproduced";
public static final String OHMPILOT_POWER_REAL_SUM = "powerrealsum";
public static final String OHMPILOT_ENERGY_REAL_SUM_CONSUMED = "energyrealsumconsumed";
public static final String OHMPILOT_ENERGY_SENSOR_TEMPERATURE_CHANNEL_1 = "temperaturechannel1";
public static final String OHMPILOT_ERROR_CODE = "errorcode";
public static final String OHMPILOT_STATE_CODE = "statecode";

/*
* part of POWERFLOW_REALTIME_DATA using Symo Gen24
Expand All @@ -86,4 +92,5 @@ public class FroniusBindingConstants {
public static final String INVERTER_REALTIME_DATA_URL = "http://%IP%/solar_api/v1/GetInverterRealtimeData.cgi?Scope=Device&DeviceId=%DEVICEID%&DataCollection=CommonInverterData";
public static final String POWERFLOW_REALTIME_DATA = "http://%IP%/solar_api/v1/GetPowerFlowRealtimeData.fcgi";
public static final String METER_REALTIME_DATA_URL = "http://%IP%/solar_api/v1/GetMeterRealtimeData.cgi?Scope=Device&DeviceId=%DEVICEID%&DataCollection=MeterRealtimeData";
public static final String OHMPILOT_REALTIME_DATA_URL = "http://%IP%/solar_api/v1/GetOhmPilotRealtimeData.cgi?Scope=Device&DeviceId=%DEVICEID%";
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import org.openhab.binding.fronius.internal.handler.FroniusBridgeHandler;
import org.openhab.binding.fronius.internal.handler.FroniusMeterHandler;
import org.openhab.binding.fronius.internal.handler.FroniusOhmpilotHandler;
import org.openhab.binding.fronius.internal.handler.FroniusSymoInverterHandler;
import org.openhab.core.thing.Bridge;
import org.openhab.core.thing.Thing;
Expand All @@ -33,6 +34,7 @@
* handlers.
*
* @author Thomas Rokohl - Initial contribution
* @author Hannes Spenger - Added ohmpilot
*/
@Component(service = ThingHandlerFactory.class, configurationPid = "binding.fronius")
public class FroniusHandlerFactory extends BaseThingHandlerFactory {
Expand All @@ -44,6 +46,7 @@ public class FroniusHandlerFactory extends BaseThingHandlerFactory {
add(THING_TYPE_INVERTER);
add(THING_TYPE_BRIDGE);
add(THING_TYPE_METER);
add(THING_TYPE_OHMPILOT);
}
};

Expand All @@ -62,6 +65,8 @@ protected ThingHandler createHandler(Thing thing) {
return new FroniusBridgeHandler((Bridge) thing);
} else if (thingTypeUID.equals(THING_TYPE_METER)) {
return new FroniusMeterHandler(thing);
} else if (thingTypeUID.equals(THING_TYPE_OHMPILOT)) {
return new FroniusOhmpilotHandler(thing);
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* Copyright (c) 2010-2022 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.fronius.internal.api;

import com.google.gson.annotations.SerializedName;

/**
* The {@link OhmpilotRealtimeBody} is responsible for storing
* the "body" node of the JSON response
*
* @author Hannes Spenger - Initial contribution
*/
public class OhmpilotRealtimeBodyDTO {
@SerializedName("Data")
private OhmpilotRealtimeBodyDataDTO data;

public OhmpilotRealtimeBodyDataDTO getData() {
if (data == null) {
data = new OhmpilotRealtimeBodyDataDTO();
}
return data;
}

public void setData(OhmpilotRealtimeBodyDataDTO data) {
this.data = data;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/**
* Copyright (c) 2010-2022 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.fronius.internal.api;

import com.google.gson.annotations.SerializedName;

/**
* The {@link OhmpilotRealtimeBodyData} is responsible for storing
* the "data" node of the JSON response
*
* @author Hannes Spenger - Initial contribution
*/
public class OhmpilotRealtimeBodyDataDTO {
@SerializedName("Details")
private OhmpilotRealtimeDetailsDTO details;
@SerializedName("EnergyReal_WAC_Sum_Consumed")
private double energyRealWACSumConsumed;
@SerializedName("PowerReal_PAC_Sum")
private double powerPACSum;
@SerializedName("Temperature_Channel_1")
private double temperatureChannel1;
@SerializedName("CodeOfError")
private int errorCode;
@SerializedName("CodeOfState")
private int stateCode;

public OhmpilotRealtimeDetailsDTO getDetails() {
if (details == null) {
details = new OhmpilotRealtimeDetailsDTO();
}
return details;
}

public void setDetails(OhmpilotRealtimeDetailsDTO details) {
this.details = details;
}

public double getEnergyRealWACSumConsumed() {
return energyRealWACSumConsumed;
}

public void setEnergyRealWACSumConsumed(double energyRealWACSumConsumed) {
this.energyRealWACSumConsumed = energyRealWACSumConsumed;
}

public double getPowerPACSum() {
return powerPACSum;
}

public void setPowerPACSum(double powerPACSum) {
this.powerPACSum = powerPACSum;
}

public double getTemperatureChannel1() {
return temperatureChannel1;
}

public void setTemperatureChannel1(double temperatureChannel1) {
this.temperatureChannel1 = temperatureChannel1;
}

public int getErrorCode() {
return errorCode;
}

public void setErrorCode(int errorCode) {
this.errorCode = errorCode;
}

public int getStateCode() {
return stateCode;
}

public void setStateCode(int stateCode) {
this.stateCode = stateCode;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/**
* Copyright (c) 2010-2022 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.fronius.internal.api;

import com.google.gson.annotations.SerializedName;

/**
* The {@link OhmpilotRealtimeDetails} is responsible for storing
* the "body" node of the JSON response
*
* @author Hannes Spenger - Initial contribution
*/
public class OhmpilotRealtimeDetailsDTO {
@SerializedName("Hardware")
private String hardware;
@SerializedName("Manufacturer")
private String manufacturer;
@SerializedName("Model")
private String model;
@SerializedName("Serial")
private String serial;
@SerializedName("Software")
private String software;

public String getHardware() {
return hardware;
}

public void setHardware(String hardware) {
this.hardware = hardware;
}

public String getManufacturer() {
return manufacturer;
}

public void setManufacturer(String manufacturer) {
this.manufacturer = manufacturer;
}

public String getModel() {
return model;
}

public void setModel(String model) {
this.model = model;
}

public String getSerial() {
return serial;
}

public void setSerial(String serial) {
this.serial = serial;
}

public String getSoftware() {
return software;
}

public void setSoftware(String software) {
this.software = software;
}
}
Loading

0 comments on commit ac32260

Please sign in to comment.