Skip to content

Commit

Permalink
[senechome] Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: lsiepel <[email protected]>
Signed-off-by: Lukas Pindl <[email protected]>
  • Loading branch information
BigFood2307 and lsiepel authored Oct 5, 2024
1 parent e75d468 commit b732452
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
6 changes: 3 additions & 3 deletions bundles/org.openhab.binding.senechome/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Also allows for turning the battery into safe charging mode or storage mode.
- not equipped battery packs will return 0 for all ...Pack channels
- currently channels for the first wallbox are implemented (senec could handle 4 wallboxes)
- Senec disables http access at ~30.08.2023
- Lithium Storage Mode is intended (according to the manual) for disassembly and transport. It is untested if it has any side effects.
- The chargeMode `STORAGE` also known as Lithium Storage Mode is intended (according to the manual) for disassembly and transport. It is untested if it has any side effects.

## Thing Configuration

Expand Down Expand Up @@ -60,8 +60,8 @@ The property `limitationTresholdValue` is used as threshold for channel `powerLi
| batteryFuelCharge | percent | Fuel charge of your battery (0 - 100%) |
| systemState | | Text describing current action of the senec home system (e.g. CHARGE) |
| systemStateValue | | Value describing current action of the senec home system (e.g. 14) |
| safeChargeMode | OFF/CHARGE/ | In safeChargeMode, the battery will try to fill as quickly as possible |
| | STORAGE | in liStorageMode, the battery will try to reach 25% SOC |
| chargeMode | OFF/CHARGE/ | In `CHARGE` mode, the battery will try to fill as quickly as possible |
| | STORAGE | in `STORAGE` mode, the battery will try to reach 25% SOC |
| gridPower | watt | Grid power level, negative for supply, positive values for drawing power |
| gridPowerDraw | watt | Absolute power level of power draw, zero while supplying |
| gridPowerSupply | watt | Absolute power level of power supply, zero while drawing |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ public SenecHomeResponse getStatistics()

String dataToSend = gson.toJson(new SenecHomeResponse());
ContentResponse response = postRequest(dataToSend);
String responseString = response.getContentAsString();
return Objects.requireNonNull(gson.fromJson(responseString, SenecHomeResponse.class));
return Objects.requireNonNull(gson.fromJson(response.getContentAsString(), SenecHomeResponse.class));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* used across the whole binding.
*
* @author Steven Schwarznau - Initial contribution
* @author Lukas Pindl - Update for writing to safeChargeMode
* @author Lukas Pindl - Update for writing to chargeMode
*/
@NonNullByDefault
public class SenecHomeBindingConstants {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
*
* @author Steven Schwarznau - Initial contribution
* @author Erwin Guib - added more channels, added some convenience methods to reduce code duplication
* @author Lukas Pindl - Update for writing to safeChargeMode
* @author Lukas Pindl - Update for writing to chargeMode
*/
@NonNullByDefault
public class SenecHomeHandler extends BaseThingHandler {
Expand Down Expand Up @@ -361,7 +361,6 @@ protected void updateChargeState(String channelName, String senecValueCharge, St
protected void updateDecimalState(String channelName, String senecValue) {
Channel channel = getThing().getChannel(channelName);
if (channel != null) {

BigDecimal value = getSenecValue(senecValue);
updateState(channel.getUID(), new DecimalType(value.intValue()));
}
Expand Down

0 comments on commit b732452

Please sign in to comment.