Calculating value in sitemap

Hello,
Can I made a calculation in the sitemap configuration?

Like

Text item=(LR_Temperature-5) label="Livingroom [%.1f °C]"

You can make an Item and use a Rule to calculate & set the Item. Display that Item on your sitemap.

Thought it might be possible with out a rule…

Thanks

You could also look into transformations, a javascript transform allows arbitrary manipulations for display.

1 Like

Which one is from performance better? JavaScript transformation or rule??

@rossko57

1 Like

I really would not worry about that.
They have different effects; do you want to actually change the Item state, or only to massage it for display?

Another question is which would be easier to troubleshoot?

I found out with a calibrated device that my device is sending a 0.5°C to high temperature therefore I simply want to subtract 0.5 from this value to display it and save it to the database. The value is sent via mqtt.

So that means what is the best option

Assuming you mean using openHAB persistence, then you will have to adjust it in your Item’s state.

Have you seen the offset profile ?

1 Like