(Solved) Valuecolor problems after update to OH2.2

Have been using colors to indicate if temp readings are being updated for a number of years. After the update to OH2.2 however this stopped working and all of my readings stay “green”. Did something regarding valuecolor change in OH2.2?

itemfile:

Number BU_Terras_Sensor2_TEMP_Raw { channel="rfxcom:temperaturehumidity:rfxcom_bridge:1:temperature" }

sitemap:

Text item=BU_Terras_Sensor2_TEMP valuecolor=[BU_Terras_Sensor2_Update=="NULL"="red",BU_Terras_Sensor2_Update>300="red",BU_Terras_Sensor2_Update>150="orange",BU_Terras_Sensor2_Update<=150="green"]

rulefile:

rule "BU_Terras_Sensor2"
when
    Item BU_Terras_Sensor2_TEMP_Raw received update or
    Item BU_Terras_Sensor2_TEMP_Raw received update
then
    postUpdate(BU_Terras_Sensor2_TEMP, (BU_Terras_Sensor2_TEMP_Raw.state as DecimalType) + 0)
    postUpdate(BU_Terras_Sensor2_HUM, (BU_Terras_Sensor2_HUM_Raw.state as DecimalType) + 0)
    postUpdate(BU_Terras_Sensor2_BATT, (BU_Terras_Sensor2_BATT_Raw.state as DecimalType) * 1)
    postUpdate(BU_Terras_Sensor2_SIGN, (BU_Terras_Sensor2_SIGN_Raw.state as DecimalType) * 25)   
    BU_Terras_Sensor2_Update.postUpdate( new DateTimeType() )
end

I can see values coming in, i see timestamps change but if updates stop I do not get orange or red indicators?

tia

Han

Same problem.
Setup was working before the update.
sitemap:

Text item=Update_WZ valuecolor=[>6000="red",>600="orange",<=600="green"]

rulefile:

    rule "LaCrosse2_Update"
    when
    	Item Temperature_WZ received update
    then
      postUpdate(Update_WZ, new DateTimeType())
    end

Any tip?
Daniel

I have created an issue:
https://github.com/openhab/openhab-distro/issues/632

Is the problem only with datetime items ?

Which UI has the problem ?

IOS and basic and thus problem is concerning date time items indeed

I will try to reproduce your problem in Basic UI, we have a very similar case in the demo sitemap.
I know something was recently changed with datetime.

I can confirm the problem when using DateTime diff in sitemap attributes like valuecolor.
Diff computation with “now” was done in the wrong way !
I just proposed a fix: https://github.com/eclipse/smarthome/pull/4827

Thanks for your quick response and your fix Lolodomo!
I will follow your pull request.

Just a short question regarding the DateTime compare values for valuecolor and visibility:
Are the values

Text item=Update_WZ valuecolor=[>6000="red",>600="orange",<=600="green"]

(6000, 600) in seconds ?

Yes

Great, thanks.

I’m not knowledgeable enough to understand the whole process from pull request to distribution, but this problem still exists on the latest version, correct? Seems like that in my case at least. I can see the PR was merged to master Jan 5th, any idea when this will find its way to my Pi? :slight_smile:

This fixed in the 2.3.SNAPSHOT
You can change to SNAPSHOT now or you can wait for the 2.3 stable which I understand is not too far off now.

1 Like

Latest update brought back the orginal behaviour. Thx for solving this issue