[digitalstrom] fix ClassCastException (#9214)

* fix ClassCastException
* fix spotless

Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
This commit is contained in:
J-N-K 2020-12-04 02:20:43 +01:00 committed by GitHub
parent 7a821a6c40
commit 33faa51d7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,7 +20,6 @@ import org.apache.commons.lang.StringUtils;
import org.openhab.binding.digitalstrom.internal.DigitalSTROMBindingConstants;
import org.openhab.binding.digitalstrom.internal.lib.listener.DeviceStatusListener;
import org.openhab.binding.digitalstrom.internal.lib.structure.devices.Circuit;
import org.openhab.binding.digitalstrom.internal.lib.structure.devices.Device;
import org.openhab.binding.digitalstrom.internal.lib.structure.devices.GeneralDeviceInformation;
import org.openhab.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.CachedMeteringValue;
import org.openhab.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.DeviceStateUpdate;
@ -186,13 +185,13 @@ public class CircuitHandler extends BaseThingHandler implements DeviceStatusList
public void onDeviceRemoved(GeneralDeviceInformation device) {
if (device instanceof Circuit) {
this.circuit = (Circuit) device;
if (this.getThing().getStatus().equals(ThingStatus.ONLINE)) {
if (!((Device) circuit).isPresent()) {
if (getThing().getStatus().equals(ThingStatus.ONLINE)) {
if (!circuit.isPresent()) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.NONE,
"Circuit is not present in the digitalSTROM-System.");
} else {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.NONE,
"Circuit is not avaible in the digitalSTROM-System.");
"Circuit is not available in the digitalSTROM-System.");
}
}