|
29 | 29 | import org.eclipse.jdt.annotation.Nullable;
|
30 | 30 | import org.openhab.binding.evcc.internal.api.EvccAPI;
|
31 | 31 | import org.openhab.binding.evcc.internal.api.EvccApiException;
|
32 |
| -import org.openhab.binding.evcc.internal.api.dto.Battery; |
33 |
| -import org.openhab.binding.evcc.internal.api.dto.Loadpoint; |
34 |
| -import org.openhab.binding.evcc.internal.api.dto.PV; |
35 |
| -import org.openhab.binding.evcc.internal.api.dto.Plan; |
36 |
| -import org.openhab.binding.evcc.internal.api.dto.Result; |
37 |
| -import org.openhab.binding.evcc.internal.api.dto.Vehicle; |
| 32 | +import org.openhab.binding.evcc.internal.api.dto.*; |
38 | 33 | import org.openhab.core.i18n.TimeZoneProvider;
|
39 | 34 | import org.openhab.core.library.CoreItemFactory;
|
40 | 35 | import org.openhab.core.library.types.DateTimeType;
|
@@ -712,7 +707,12 @@ private void updateChannelsGeneral() {
|
712 | 707 | }
|
713 | 708 | boolean gridConfigured = this.gridConfigured;
|
714 | 709 | if (gridConfigured) {
|
715 |
| - float gridPower = ((result.getGrid().getPower() == null) ? 0.0f : result.getGrid().getPower()); |
| 710 | + // handling gridPower prior to changes in evcc version 0.133.0 |
| 711 | + float gridPower = ((result.getGridPower() == null) ? 0.0f : result.getGridPower()); |
| 712 | + Grid grid = result.getGrid(); |
| 713 | + if (grid != null) { |
| 714 | + gridPower = ((grid.getPower() == null) ? 0.0f : grid.getPower()); |
| 715 | + } |
716 | 716 | channel = new ChannelUID(uid, CHANNEL_GROUP_ID_GENERAL, CHANNEL_GRID_POWER);
|
717 | 717 | updateState(channel, new QuantityType<>(gridPower, Units.WATT));
|
718 | 718 | }
|
|
0 commit comments