[SOLVED] Rule If/else showing different icons

Hello to all of u,

hope you guys can help.
With a rule and my netatmo weather station I can calculate the absolute humidity outside and inside.

afoutdoor.postUpdate(afout)
afindoor.postUpdate(afin)

From this point I need your help, I want to compare the values and show the result by an icon.
The rule should be something like, if the indoor value is bigger than the outdoor so I need to open the window.
How is the setup to show the openhab Icon for a closed window and for a open window.

You could use a virtual contact Item for this.

Contact OpenTheWindows <window>

The window icon will dynamically change within the sitemap, depending on the state of the contact item.

rule "Compare humidity value"
when
    Item afoutdoor received update or
    Item afindoor received update
then
    if(afindoor.state > afoutdoor.state){
         OpenTheWindows.postUpdate(Open)
    }
    else{
        OpenTheWindows.postUpdate(Closed)
    }
end

thank u.
It looks quite simple, but doesn’t work for me :frowning:

I got this error:
The name ‘Open’ cannot be resolved to an item or type; line 39, column 36, length 4

Any idea?

Maybe writing with uppercase “OPEN” and “CLOSED”

Thx.