Change color of older values from DateTime-items in sitemap

Hi, i have a DateTime-item showing on my sitemap, which gets the (now) timestamp from a rule, when there is movement inside my house.

How can i change the color of this item, when the timestamp gets older?

Maybe like this: movement in the last hour --> green, 1-2 hours --> blue, 3-12 --> yellow, older 12 hours --> red

I know this (and already use it) for temperature (number items), but is this also available for DateTime-Items?

All I can say is give it a try and see if it works. If it doesn’t work the same way you did the temp color changes the answer will be no, it’s not possible.

That’s very difficult to do, because the valuecolor= parameters in your sitemap are fixed and unchangeable.

Your requirement has a moving target - what “an hour ago” means exactly, constantly changes as time moves on.

You might be able to use the visibility= option to show or hide one of a number of different sitemap lines, each with a different fixed colour.
The magic part is that visibility= can refer to a different Item than the one you are displaying.

All you need to do then is have this control Item updated every so often to work out how old the timestamp is at that moment. You could give it values like “old” and “older”, or “red” and “green”

You’d need individual control Items for each timestamp you wanted to display like this.

I think i have to add an extra dummy item, which contains the minutes or hours since the last update… I already have this for my xiaomi temp sensors running, so it will be not too much work to adapt this for the presence detection as well.

Now i did the same like with my temp sensors and it is working.

But how can i write this in the sitemap in a shorter way?

I know this way, if the valuecolor is generated from the given item.

valuecolor=[ < 10="red", < 20="orange", < 30="yellow", < =100="green"]

But i have to use another item, like this:

valuecolor=[PM_EG_Speis_Praesenz_time_since <= "120" = "green", PM_EG_Speis_Praesenz_time_since > 121 = "red"]

Do i have to write the other item-name for every value? I want to use many colors, this will be a very very large line…

As @rossko57 stated you need to use the visibility option. Create an separate line for each color (where all values would have the same color) and make the line visible only if the other item has the desired state.

But that is even more work… I already have it up and running. I have a rule, which updates an extra time_since-item every minute. And so i can change the color of the main-item with the value of my “time_since”-item.

What would be the advantage of visibility??? I now only have one line in my sitemap, which is changing the color.

But: I have to write the name of the “time_since”-item for every value again… So my question is, if i could shorten that… Because i have about 15 presence detection sensors and that is a lot to write inside the sitemap…

I’m impressed. I did not think that worked, using a different Item’s state in valuecolor.

Anyway, yes you have to spell it out. There are no shortcuts.

I’m sorry, however to my present understanding the valuecolor would not work with a different items state. If that is working the visibility option has NO advantage!