openhab-core/bundles/org.openhab.core.automation/src
J-N-K c24f0f3c6f
[automation] Fix ItemStateCondition for PercentType values (#3136)
* Fix ItemStateCondition for PercentType values

Dimmer items return their state as PercentType. The code did not properly handle PercentType because PercentType is a subclass of DecimalType. One value was converted by casting the value to DecimalType (which leads to 40 for 40%) while the other one used `.as` (which results in 0.4 for 40%). A comparison than of "state <= 50" with state = 20 is therefore executed as "20 <= 0.5"  which is not what the user would expect.

Signed-off-by: Jan N. Klug <github@klug.nrw>
2022-10-29 13:17:48 +02:00
..
main [automation] Fix ItemStateCondition for PercentType values (#3136) 2022-10-29 13:17:48 +02:00
test/java/org/openhab/core/automation [automation] Fix ItemStateCondition for PercentType values (#3136) 2022-10-29 13:17:48 +02:00