Skip to content

Commit

Permalink
[sunspec] fixed null pointer exception
Browse files Browse the repository at this point in the history
Signed-off-by: Nagy Attila Gabor <mrbig@sneaker.hu>
  • Loading branch information
mrbig committed Jan 25, 2019
1 parent f10ed7b commit 7866252
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.eclipse.smarthome.core.library.types.DecimalType;
import org.eclipse.smarthome.core.thing.ChannelUID;
import org.eclipse.smarthome.core.thing.Thing;
import org.eclipse.smarthome.core.types.UnDefType;
import org.openhab.binding.modbus.sunspec.internal.block.InverterModelBlock;
import org.openhab.binding.modbus.sunspec.internal.parser.InverterModelParser;
import org.openhab.io.transport.modbus.ModbusManager;
Expand Down Expand Up @@ -68,8 +69,9 @@ protected void handlePolledData(@NonNull ModbusRegisterArray registers) {
updateState(new ChannelUID(getThing().getUID(), GROUP_DEVICE_INFO, CHANNEL_OTHER_TEMPERATURE),
getScaled(block.getTemperatureOther(), block.getTemperatureSF()));

Integer status = block.getStatus();
updateState(new ChannelUID(getThing().getUID(), GROUP_DEVICE_INFO, CHANNEL_STATUS),
new DecimalType(block.getStatus()));
status == null ? UnDefType.UNDEF : new DecimalType(status));

// AC General group
updateState(new ChannelUID(getThing().getUID(), GROUP_AC_GENERAL, CHANNEL_AC_TOTAL_CURRENT),
Expand Down

0 comments on commit 7866252

Please sign in to comment.