Hi All,
I’ve noticed a strange arithmetic problem with decimals which started when I upgraded from 2.5M1 to 2.5M2. Hoping someone can shed some light!
I have a simple rule set to detect changes in humidity. If the humidity increases more than 4.5%, then turn on the bathroom fan. Prior to upgrading, this worked well, but ever since M2, the calculation no longer works.
I started logging the results and noticed the rule is returning a value of ‘0,’ even when the result should be a decimal. In the 2nd row of the log below, the previous value was 78.57 and the new value is 80.80, so it should have returned 2.23. However, the log shows ‘0’
Thanks!
rule "Shower Lights & Fan"
when
Item HumiditySensorCurrentLevel changed
then
if (((HumiditySensorCurrentLevel.state as Number)-(HumiditySensorCurrentLevel.previousState.state as Number)) > 4.5)
{
ShowerStatus.sendCommand(ON)
FanStatus.sendCommand(ON)
}
logInfo("Shower auto lights", "Humidity Difference - New: " + HumiditySensorCurrentLevel.state as Number +
" -- Previous: " + HumiditySensorCurrentLevel.previousState.state as Number + " -------- " + ((HumiditySensorCurrentLevel.state as Number)-(HumiditySensorCurrentLevel.previousState.state as Number)) )
end
2019-11-07 20:17:48.408 [INFO ] [home.model.script.Shower auto lights] - Humidity Difference - New: 79.28 -- Previous: 57.57 -------- 21.71
2019-11-10 19:46:00.637 [INFO ] [home.model.script.Shower auto lights] - Humidity Difference - New: 78.57 -- Previous: 78.57 -------- 0.00
2019-11-10 19:51:26.892 [INFO ] [home.model.script.Shower auto lights] - Humidity Difference - New: 80.80 -- Previous: 78.57 -------- 0.00
2019-11-10 20:07:03.701 [INFO ] [home.model.script.Shower auto lights] - Humidity Difference - New: 79.20 -- Previous: 79.2 -------- 0.00
2019-11-10 20:13:04.997 [INFO ] [home.model.script.Shower auto lights] - Humidity Difference - New: 75.98 -- Previous: 79.2 -------- 0.00
2019-11-10 20:22:57.496 [INFO ] [home.model.script.Shower auto lights] - Humidity Difference - New: 72.84 -- Previous: 72.84 -------- 0.00
2019-11-10 20:43:24.333 [INFO ] [home.model.script.Shower auto lights] - Humidity Difference - New: 69.63 -- Previous: 72.84 -------- -3.21