[SOLVED] Display calculated Item

Hello,

i’ve got the following problem. I’m calculation the Item “Wasserstand” within a rule. When I look at my event.log I see that the value has been refreshed.

2019-09-01 09:22:00.965 [vent.ItemStateChangedEvent] - Wasserstand changed from 192 to 193

But I can’t display it at my sitemap. Whats wrong with my code? The value is empty in my sitemap. Depth and ZTime is shown.

Item:

Number Depth “Depth” (gRTL) {channel=“mqtt:topic:brokerhome:sensoren:Depth”}
String ZTime “ZTime” (gRTL) { channel=“mqtt:topic:brokerhome:sensoren:ZTime”}
Number Wasserstand “Wassserstand in cm” (gRTL)

Rule:

rule “BerechneWasserstand”
when
Item Depth received update or Time cron “0 */5 * * * ?”
then
Wasserstand.postUpdate(257-(Depth.state as DecimalType))
end

Sitemap:

Frame label=“Zisterne” {
Text item=Wasserstand label=“Wasserstand in cm” icon=“flow”
Text item=Depth label=“Abstand zum Wasser in cm” icon=“flow”
Text item=ZTime label=“Zeit” icon=“clock”
}
}

You don’t need to give labels in both sitemap and Item definition. The UI will use the Item label by default, or use the sitemap label if given (which can be different, so sometimes you might want to do that).

Part of the label is a formatter [this part]
This almost always needs to be given to get an Item’s value to display in a sitemap. No [format], no display.
Some bindings can make suggestions about format behind the scenes, these will show up in display unless you define a [format] in Item or sitemap.

Okay, so your calculated Item has no binding and no [format], that’s why nothing shows.
I would make Item definition
Number Wasserstand “Wassserstand [%d cm]” <flow> (gRTL)
and sitemap line
Text item=Wasserstand

Thanks rossko57!!! :slight_smile: