HABPanel Widget Frontdoor 3 States

Hi,

i am pretty new with openHab. I did set up the server and added some KNX Devices. Now, i want my Front door as a HABPanel Widget. I have two binary contacts, first one is for the door if it’s open or closed, the other one is for Locked or unlocked.
What i have is a rule, that makes one datapoint from those two:

when
    Item contact_haustuer_oc changed or
    Item contact_haustuer_lock changed

then
    lichtbarindirekt.sendCommand(ON)
    if((contact_haustuer_oc.state == CLOSED) && (contact_haustuer_lock.state == OPEN))     haustuer3state.sendCommand(2)
    if((contact_haustuer_oc.state == CLOSED) && (contact_haustuer_lock.state == CLOSED))   haustuer3state.sendCommand(1)
    if((contact_haustuer_oc.state == OPEN)   && (contact_haustuer_lock.state == CLOSED))   haustuer3state.sendCommand(0)
    if((contact_haustuer_oc.state == OPEN)   && (contact_haustuer_lock.state == OPEN))     haustuer3state.sendCommand(0)
end

What i need is a Widget, that shows me a Text, like “Open, Closed, Locked” and changes the Background from Red, Orange and Green.

I have no idea, how to start.

Thanks for your Help.

Thomas

Take a look at the other widgets in habpanel. There is a nice one doing exactly what you describe. It’s called Xiamoi sensor widget or something like the.