Skip to content

Commit

Permalink
[digitalstrom] fix ClassCastException (#9214)
Browse files Browse the repository at this point in the history
* fix ClassCastException
* fix spotless

Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
  • Loading branch information
J-N-K committed Dec 4, 2020
1 parent 7a821a6 commit 33faa51
Showing 1 changed file with 3 additions and 4 deletions.
Expand Up @@ -20,7 +20,6 @@
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;
Expand Down Expand Up @@ -186,13 +185,13 @@ public void onDeviceStateChanged(DeviceStateUpdate deviceStateUpdate) {
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.");
}

}
Expand Down

0 comments on commit 33faa51

Please sign in to comment.