Skip to content

Commit 0a92ef1

Browse files
committed
change soc to double plus other tweaks
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
1 parent 7414776 commit 0a92ef1

4 files changed

Lines changed: 19 additions & 13 deletions

File tree

bundles/org.openhab.binding.fronius/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ var froniusInverterActions = actions.thingActions('fronius', 'fronius:powerinver
202202

203203
::: tab JRuby
204204

205-
In JRuby, the action methods are attached to the the Thing object.
205+
In JRuby, the action methods are attached to the Thing object.
206206

207207
```rb
208208
my_inverter = things["fronius:powerinverter:mybridge:myinverter"]
@@ -278,7 +278,7 @@ froniusInverterActions.setBackupReservedBatteryCapacity(50);
278278

279279
:::
280280

281-
::: JRuby
281+
::: tab JRuby
282282

283283
```rb
284284
inverter = things["fronius:powerinverter:mybridge:myinverter"]

bundles/org.openhab.binding.fronius/src/main/java/org/openhab/binding/fronius/internal/FroniusBindingConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public class FroniusBindingConstants {
9898
public static final String OHMPILOT_ERROR_CODE = "errorcode";
9999
public static final String OHMPILOT_STATE_CODE = "statecode";
100100

101-
// Battery channels (map to Storage Controller fields)
101+
// Battery channels
102102
public static final String BATTERY_CAPACITY_MAXIMUM = "maximumCapacity";
103103
public static final String BATTERY_DESIGNED_CAPACITY = "designedCapacity";
104104
public static final String BATTERY_CURRENT_DC = "currentDc";

bundles/org.openhab.binding.fronius/src/main/java/org/openhab/binding/fronius/internal/api/dto/storage/StorageController.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
*/
1313
package org.openhab.binding.fronius.internal.api.dto.storage;
1414

15+
import org.eclipse.jdt.annotation.Nullable;
16+
1517
import com.google.gson.annotations.SerializedName;
1618

1719
/**
@@ -37,7 +39,7 @@ public class StorageController {
3739
private int enable;
3840

3941
@SerializedName("StateOfCharge_Relative")
40-
private int stateOfChargeRelative;
42+
private double stateOfChargeRelative;
4143

4244
@SerializedName("Status_BatteryCell")
4345
private int statusBatteryCell;
@@ -63,18 +65,15 @@ public double getDesignedCapacity() {
6365
return designedCapacity;
6466
}
6567

66-
public StorageDetails getDetails() {
67-
if (details == null) {
68-
details = new StorageDetails();
69-
}
68+
public @Nullable StorageDetails getDetails() {
7069
return details;
7170
}
7271

7372
public int getEnable() {
7473
return enable;
7574
}
7675

77-
public int getStateOfChargeRelative() {
76+
public double getStateOfChargeRelative() {
7877
return stateOfChargeRelative;
7978
}
8079

bundles/org.openhab.binding.fronius/src/main/resources/OH-INF/thing/thing-types.xml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
</config-description>
5858
</thing-type>
5959

60-
<!-- Battery Thing Type (maps to Storage Controller fields) -->
60+
<!-- Battery Thing Type -->
6161
<thing-type id="battery">
6262
<supported-bridge-type-refs>
6363
<bridge-type-ref id="bridge"/>
@@ -465,11 +465,15 @@
465465
<state pattern="%.1f %%" readOnly="true"></state>
466466
</channel-type>
467467

468-
<!-- Battery specific channel-types (map to Storage Controller fields) -->
468+
<!-- Battery specific channel-types -->
469469
<channel-type id="batteryMaximumCapacity">
470470
<item-type>Number:Energy</item-type>
471471
<label>Current Maximum Battery Capacity</label>
472472
<description>Current maximum battery capacity in Wh</description>
473+
<tags>
474+
<tag>Measurement</tag>
475+
<tag>Energy</tag>
476+
</tags>
473477
<state pattern="%.0f Wh" readOnly="true"></state>
474478
</channel-type>
475479
<channel-type id="batteryDesignedCapacity">
@@ -484,14 +488,18 @@
484488
<description>Current state of charge of the battery in percent</description>
485489
<tags>
486490
<tag>Status</tag>
487-
<tag>Power</tag>
491+
<tag>StateOfCharge</tag>
488492
</tags>
489493
<state pattern="%.1f %%" readOnly="true"></state>
490494
</channel-type>
491495
<channel-type id="batteryTemperature">
492496
<item-type>Number:Temperature</item-type>
493497
<label>Battery Cell Temperature</label>
494498
<description>Temperature of the battery cell</description>
499+
<tags>
500+
<tag>Measurement</tag>
501+
<tag>Temperature</tag>
502+
</tags>
495503
<state pattern="%.2f %unit%" readOnly="true"></state>
496504
</channel-type>
497505
<channel-type id="batteryTimestamp">
@@ -506,7 +514,6 @@
506514
<description>Status code coming from Status_BatteryCell</description>
507515
<state pattern="%d" readOnly="true"></state>
508516
</channel-type>
509-
510517
<channel-type id="batteryEnable">
511518
<item-type>Number</item-type>
512519
<label>Battery Enabled</label>

0 commit comments

Comments
 (0)