Hi there,
after upgrading my openHAB instance to 4.2 i encountered an issue with at least one of my rules not running correctly anymore.
From my point of view this is an issue with insufficient use of grouping in if statements appearing due to recent blockly changes.
Snippet:
This results in the following code:
var priceValue;
priceValue = event.itemState !== undefined ? parseFloat(event.itemState.toString()) : undefined;
console.info((priceValue > 2));
console.info((event.itemState !== undefined ? parseFloat(event.itemState.toString()) : undefined > 2));
The first log outputs to ‘true’ or ‘false’ as intended, while the second outputs the item value.
If memory serves me right in previously releases the ‘contextual info as number’ block would just translate to ‘parseFloat(…)’ but with the introduction of the undefined check this messes up surrounding if statements.
Anybody else seeing this?
I actually like the ‘undefined check change’ since it helped me clean up some other rules, but maybe the if statement, by default, should put the two operands into brackets to avoid running into this issue.