[homematic] For non HmIP dimmers stateDescription values must be corrected too (#9434)

Older HM dimmers are using a maximum values of 1.0. But also for these
devices the values must be corrected.

Signed-off-by: Martin Herbst <develop@mherbst.de>
This commit is contained in:
Martin Herbst 2020-12-25 21:30:43 +01:00 committed by GitHub
parent a7ac71f1e0
commit 9cc0ff436f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -279,8 +279,9 @@ public class HomematicTypeGeneratorImpl implements HomematicTypeGenerator {
BigDecimal min = MetadataUtils.createBigDecimal(dp.getMinValue());
BigDecimal max = MetadataUtils.createBigDecimal(dp.getMaxValue());
BigDecimal step = MetadataUtils.createBigDecimal(dp.getStep());
if (ITEM_TYPE_DIMMER.equals(itemType) && dp.getMaxValue().doubleValue() == 1.01d) {
// For dimmers with a max value of 1.01 the values must be corrected
if (ITEM_TYPE_DIMMER.equals(itemType)
&& (max.compareTo(new BigDecimal("1.0")) == 0 || max.compareTo(new BigDecimal("1.01")) == 0)) {
// For dimmers with a max value of 1.01 or 1.0 the values must be corrected
min = MetadataUtils.createBigDecimal(0);
max = MetadataUtils.createBigDecimal(100);
step = MetadataUtils.createBigDecimal(1);