Fix state updates for numbers with dimension (#20034)

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
Jacob Laursen
2026-01-11 21:57:04 +01:00
committed by GitHub
parent a70b0b2b4f
commit a4169262d3
@@ -73,7 +73,6 @@ import org.openhab.core.types.Command;
import org.openhab.core.types.RefreshType;
import org.openhab.core.types.State;
import org.openhab.core.types.StateDescription;
import org.openhab.core.types.StateDescriptionFragment;
import org.openhab.core.types.StateOption;
import org.openhab.core.types.UnDefType;
import org.openhab.core.types.util.UnitUtils;
@@ -293,7 +292,7 @@ public class HomekitAccessoryHandler extends HomekitBaseAccessoryHandler {
if (acceptedItemType.startsWith(CoreItemFactory.NUMBER)) {
String[] itemTypeParts = acceptedItemType.split(":");
if (itemTypeParts.length > 1
&& getStateDescription(channel) instanceof StateDescriptionFragment stateDescription
&& getStateDescription(channel) instanceof StateDescription stateDescription
&& UnitUtils.parseUnit(stateDescription.getPattern()) instanceof Unit<?> channelUnit
&& itemTypeParts[1].equalsIgnoreCase(UnitUtils.getDimensionName(channelUnit))) {
yield QuantityType.valueOf(value.getAsNumber().doubleValue(), channelUnit);