OH4, UoM, and DSL rules

  • Platform information:
    • Hardware: Raspberry Pi 4
    • OS: OpenHabian
    • Java Runtime Environment: OpenJDK 17
    • openHAB version: 4.0.0

Hi, I just upgraded to 4.0.0, and am trying to make sure I understand the consequences of the changes in UoM handling when it comes to rules. I have some rule DSL (v1) scripts that compare temperatures, e.g.,

if (outside_temperature.state < 15|°F) { ...

Will I need to remove the units from my rules after the UoM change? i.e.,

if (outside_temperature.state < 15) { ...


No, on the contrary, only rules not using UoM and making assumptions about the internal unit of an item might be affected.

For example, the Miele@home binding updates some Number:Time channels in minutes. Previously this could be cast to Numberand intValue would contain number of minutes. In 4.0 I did not add unit to those items because they are not persisted and default unit should be fine. However, default unit is now seconds, thus my badly written rules stopped working: Dishwasher price calculation automation - #13 by laursen

When implementing UoM, like you have done, everything should be fine.