Cannot get virtual items to work

I have gotten tips about using virtual items in several threads, but cant seem to get it to work.

Items file:
Number OvenOntoday

Snippet from rule:
var int minutes = (Insight_onToday.state as DecimalType).intValue
minutes = minutes/60
logInfo(“homeautomation”, “oven has been on for " + minutes + " today”)


Text item=OvenOntoday

What i would hope was that in the app, i could see the value of minutes in the SiteOnToday item. But, not luck.


Try using:


The postUpdate action doesn’t always handle converting Numbers and primitive values (e.g. int) to a state the Item can understand.

On your sitemap what do you see for OvenOntoday?

Ah, did actually forgot to mention that i had also tried OvenOntoday.postUpdate(minutes).

But thanks! :slightly_smiling:

In my website i just see the name of the item.

It seems your sitemap lacks the necessary information to give you what you want.

Try the following:

Text item=OvenOntoday label="Oven on today [%d minutes]"

1 Like

That was it! Thank you so much!