]> git.basschouten.com Git - openhab-addons.git/commitdiff
Fix sensor and device update (#15596)
authoraviborg <andreas.viborg@gmail.com>
Mon, 25 Sep 2023 17:19:57 +0000 (19:19 +0200)
committerGitHub <noreply@github.com>
Mon, 25 Sep 2023 17:19:57 +0000 (19:19 +0200)
Signed-off-by: AndreasV <andreas.viborg@gmail.com>
bundles/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/local/dto/TellstickLocalDeviceDTO.java
bundles/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/local/dto/TellstickLocalSensorDTO.java

index 1480245147ce44aedb81c716f7e6729119fee2f7..56bc57c869011b0bb771d0b8a26e6401279d80c2 100644 (file)
@@ -112,4 +112,21 @@ public class TellstickLocalDeviceDTO implements Device {
     public void setType(String type) {
         this.type = type;
     }
+
+    @Override
+    public boolean equals(Object obj) {
+        // used to test if device exist
+        if (this == obj) {
+            return true;
+        }
+        if (!(obj instanceof TellstickLocalDeviceDTO other)) {
+            return false;
+        }
+        return deviceId == other.deviceId;
+    }
+
+    @Override
+    public int hashCode() {
+        return deviceId;
+    }
 }
index b3a754d105b0f9bb18220657cb7f323b03dca552..5dd17327168829946c5b680749a254cb0569e121 100644 (file)
@@ -127,4 +127,21 @@ public class TellstickLocalSensorDTO implements Device {
     public String getUUId() {
         return Integer.toString(deviceId);
     }
+
+    @Override
+    public boolean equals(Object obj) {
+        // used to test if sensor exist
+        if (this == obj) {
+            return true;
+        }
+        if (!(obj instanceof TellstickLocalSensorDTO other)) {
+            return false;
+        }
+        return deviceId == other.deviceId;
+    }
+
+    @Override
+    public int hashCode() {
+        return deviceId;
+    }
 }