Fix sensor and device update (#15596)

Signed-off-by: AndreasV <andreas.viborg@gmail.com>
This commit is contained in:
aviborg 2023-09-25 19:19:57 +02:00 committed by GitHub
parent 4359c732a4
commit 9c22b7b9ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 0 deletions

View 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;
}
}

View 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;
}
}