From b4f6512475e8bea7165bb5665085dd0bf78cf344 Mon Sep 17 00:00:00 2001
From: Peter Schraffl
Date: Sat, 4 Apr 2020 13:21:53 +0200
Subject: [PATCH] [fronius] Add new channels and fix documentation (#7247)
* Added status code and error code channel
* Fix documentation
Signed-off-by: Peter Schraffl
---
bundles/org.openhab.binding.fronius/README.md | 57 +++++++++++--------
.../internal/FroniusBindingConstants.java | 3 +
.../handler/FroniusSymoInverterHandler.java | 5 ++
.../resources/ESH-INF/thing/thing-types.xml | 15 +++++
4 files changed, 56 insertions(+), 24 deletions(-)
diff --git a/bundles/org.openhab.binding.fronius/README.md b/bundles/org.openhab.binding.fronius/README.md
index d53a8fd97e3ff..28d56c72c31f0 100644
--- a/bundles/org.openhab.binding.fronius/README.md
+++ b/bundles/org.openhab.binding.fronius/README.md
@@ -5,51 +5,58 @@ This binding uses the [Fronius Solar API V1](https://www.fronius.com/en/photovol
## Supported Things
-Support Fronius Galvo, Fronius Symo inverters 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 )
+Support Fronius Galvo, Fronius Symo inverters 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)
## Discovery
-There is no discovery implemented. You have to create your things manually and specify the IP of the Datalogger and the DeviceId.
+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 Thing level.
+The binding has no configuration options, all configuration is done at `bridge` or `powerinverter` level.
## Thing Configuration
-The thing has a few configuration parameters:
+### Bridge Thing Configuration
-| Parameter | Description |
-|-----------|------------------------------------------------------------------------- |
-| Ip | the ip-address of your Fronius Datalogger |
-| DeviceId | The identifier of your device ( Default: 1) |
-| refresh | Refresh interval in seconds |
+| Parameter | Description |
+|-----------------|------------------------------------------------------ |
+| hostname | The hostname or IP address of your Fronius Datalogger |
+| refreshInterval | Refresh interval in seconds |
+
+### Powerinverter Thing Configuration
+
+| Parameter | Description |
+|-----------------|------------------------------------------------------ |
+| deviceId | The identifier of your device (Default: 1) |
## Channels
| Channel ID | Item Type | Description |
|------------|--------------|------------------------- |
-| day_energy | Number | Energy generated on current day |
-| pac | Number | AC powery |
-| total_energy | Number | Energy generated overall |
-| year_energy | Number | Energy generated in current year |
-| fac | Number | AC frequency |
-| iac | Number | AC current |
-| idc | Number | DC current |
-| uac | Number | AC voltage |
-| udc | Number | DC voltage |
-| pGrid | Number | Power + from grid, - to grid |
-| pLoad | Number | Power + generator, - consumer |
-| pAkku | Number | Power + charge, - discharge |
+| inverterdatachanneldayenergy | Number | Energy generated on current day |
+| inverterdatachannelpac | Number | AC powery |
+| inverterdatachanneltotal | Number | Energy generated overall |
+| inverterdatachannelyear | Number | Energy generated in current year |
+| inverterdatachannelfac | Number | AC frequency |
+| inverterdatachanneliac | Number | AC current |
+| inverterdatachannelidc | Number | DC current |
+| inverterdatachanneluac | Number | AC voltage |
+| inverterdatachanneludc | Number | DC voltage |
+| inverterdatadevicestatuserrorcode | Number | Device error code |
+| inverterdatadevicestatusstatuscode | Number | Device status code `0` - `6` Startup `7` Running `8` Standby `9` Bootloading `10` Error |
+| powerflowchannelpgrid | Number | Power + from grid, - to grid |
+| powerflowchannelpload | Number | Power + generator, - consumer |
+| powerflowchannelpakku | Number | Power + charge, - discharge |
## Full Example
demo.things:
```
-Bridge fronius:bridge:mybridge [hostname="192.168.66.148",refreshInterval=5] {
- Thing powerinverter myinverter [ deviceId=1 ]
+Bridge fronius:bridge:mybridge [hostname="192.168.66.148", refreshInterval=5] {
+ Thing powerinverter myinverter [deviceId=1]
}
```
@@ -65,6 +72,8 @@ Number IAC { channel="fronius:powerinverter:mybridge:myinverter:inverterdatachan
Number IDC { channel="fronius:powerinverter:mybridge:myinverter:inverterdatachannelidc" }
Number UAC { channel="fronius:powerinverter:mybridge:myinverter:inverterdatachanneluac" }
Number UDC { channel="fronius:powerinverter:mybridge:myinverter:inverterdatachanneludc" }
+Number ErrorCode { channel="fronius:powerinverter:mybridge:myinverter:inverterdatadevicestatuserrorcode" }
+Number StatusCode { channel="fronius:powerinverter:mybridge:myinverter:inverterdatadevicestatusstatuscode" }
Number Grid_Power { channel="fronius:powerinverter:mybridge:myinverter:powerflowchannelpgrid" }
Number Load_Power { channel="fronius:powerinverter:mybridge:myinverter:powerflowchannelpload" }
Number Battery_Power { channel="fronius:powerinverter:mybridge:myinverter:powerflowchannelpakku" }
diff --git a/bundles/org.openhab.binding.fronius/src/main/java/org/openhab/binding/fronius/internal/FroniusBindingConstants.java b/bundles/org.openhab.binding.fronius/src/main/java/org/openhab/binding/fronius/internal/FroniusBindingConstants.java
index 634cae2ed9dd4..838a0f929263e 100644
--- a/bundles/org.openhab.binding.fronius/src/main/java/org/openhab/binding/fronius/internal/FroniusBindingConstants.java
+++ b/bundles/org.openhab.binding.fronius/src/main/java/org/openhab/binding/fronius/internal/FroniusBindingConstants.java
@@ -20,6 +20,7 @@
* used across the whole binding.
*
* @author Thomas Rokohl - Initial contribution
+ * @author Peter Schraffl - Added device status and error status channels
*/
@NonNullByDefault
public class FroniusBindingConstants {
@@ -40,6 +41,8 @@ public class FroniusBindingConstants {
public static final String InverterDataChannelIdc = "inverterdatachannelidc";
public static final String InverterDataChannelUac = "inverterdatachanneluac";
public static final String InverterDataChannelUdc = "inverterdatachanneludc";
+ public static final String InverterDataChannelDeviceStatusErrorCode = "inverterdatadevicestatuserrorcode";
+ public static final String InverterDataChannelDeviceStatusStatusCode = "inverterdatadevicestatusstatuscode";
public static final String PowerFlowpGrid = "powerflowchannelpgrid";
public static final String PowerFlowpLoad = "powerflowchannelpload";
public static final String PowerFlowpAkku = "powerflowchannelpakku";
diff --git a/bundles/org.openhab.binding.fronius/src/main/java/org/openhab/binding/fronius/internal/handler/FroniusSymoInverterHandler.java b/bundles/org.openhab.binding.fronius/src/main/java/org/openhab/binding/fronius/internal/handler/FroniusSymoInverterHandler.java
index 5c0f727d5cc13..7e16223e329c2 100644
--- a/bundles/org.openhab.binding.fronius/src/main/java/org/openhab/binding/fronius/internal/handler/FroniusSymoInverterHandler.java
+++ b/bundles/org.openhab.binding.fronius/src/main/java/org/openhab/binding/fronius/internal/handler/FroniusSymoInverterHandler.java
@@ -37,6 +37,7 @@
* sent to one of the channels.
*
* @author Thomas Rokohl - Initial contribution
+ * @author Peter Schraffl - Added device status and error status channels
*/
public class FroniusSymoInverterHandler extends FroniusBaseThingHandler {
@@ -115,6 +116,10 @@ protected Object getValue(String channelId) {
return inverterRealtimeResponse.getBody().getData().getUac();
case FroniusBindingConstants.InverterDataChannelUdc:
return inverterRealtimeResponse.getBody().getData().getUdc();
+ case FroniusBindingConstants.InverterDataChannelDeviceStatusErrorCode:
+ return inverterRealtimeResponse.getBody().getData().getDeviceStatus().getErrorCode();
+ case FroniusBindingConstants.InverterDataChannelDeviceStatusStatusCode:
+ return inverterRealtimeResponse.getBody().getData().getDeviceStatus().getStatusCode();
}
if (powerFlowResponse == null) {
return null;
diff --git a/bundles/org.openhab.binding.fronius/src/main/resources/ESH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.fronius/src/main/resources/ESH-INF/thing/thing-types.xml
index b3b7e97c824f1..de95c3158c0a0 100644
--- a/bundles/org.openhab.binding.fronius/src/main/resources/ESH-INF/thing/thing-types.xml
+++ b/bundles/org.openhab.binding.fronius/src/main/resources/ESH-INF/thing/thing-types.xml
@@ -21,6 +21,8 @@
+
+
@@ -93,6 +95,19 @@
+
+ Number
+
+ Current device error code
+
+
+
+ Number
+
+ Current device status code
+
+
+
Number