[homekit] fix minValue, maxValue (#9300)
Signed-off-by: Eugen Freiter <freiter@gmx.de>pull/9309/head
parent
7edfbc6391
commit
ade041d5f0
|
@ -193,9 +193,19 @@ public class HomekitTaggedItem {
|
|||
public <T> T getConfiguration(String key, T defaultValue) {
|
||||
if (configuration != null) {
|
||||
final @Nullable Object value = configuration.get(key);
|
||||
if (value != null && value.getClass().equals(defaultValue.getClass())) {
|
||||
return (T) value;
|
||||
if (value != null) {
|
||||
if (value.getClass().equals(defaultValue.getClass())) {
|
||||
return (T) value;
|
||||
}
|
||||
// fix for different handling of numbers via .items and via mainUI, see #1904
|
||||
if ((value instanceof BigDecimal) && (defaultValue instanceof Double)) {
|
||||
return (T) Double.valueOf(((BigDecimal) value).doubleValue());
|
||||
}
|
||||
if ((value instanceof Double) && (defaultValue instanceof BigDecimal)) {
|
||||
return (T) BigDecimal.valueOf(((Double) value).doubleValue());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue