]> git.basschouten.com Git - openhab-addons.git/commitdiff
[digitalstrom] fix ClassCastException (#9214)
authorJ-N-K <J-N-K@users.noreply.github.com>
Fri, 4 Dec 2020 01:20:43 +0000 (02:20 +0100)
committerGitHub <noreply@github.com>
Fri, 4 Dec 2020 01:20:43 +0000 (17:20 -0800)
* fix ClassCastException
* fix spotless

Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/handler/CircuitHandler.java

index 150423bffe16e0045cf8089f36cde8437525b288..e315acddcbef96ea73cf2b019decc7d140f9020d 100644 (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.");
                 }
 
             }