[Solved] Conditional item formatting

  • Platform information:
    • Hardware: Raspeberry PI 3
    • OS: _Raspbian
    • Java Runtime Environment: Not relevant
    • openHAB version:2.4
  • Issue of the topic: Conditional format based on item value

Would like to expose in Sitemap one of two prhase (“Present”, “Not Present”) depending from the item status value (ON or OFF)

I have the following in
Switch Elenio_C6 “Samsung A5 / Elenio” { channel=“network:pingdevice:elenio_cell:online” }
Text item=Elenio_C6 label=“Elenio è [%s]” icon=“network”
Didn’t find any Transformation rule for this
How To?

Use MAP transformation.


Switch Elenio_C6 “Samsung A5 / Elenio [MAP(present.map):%s]” { channel=“network:pingdevice:elenio_cell:online” }

Create map file

OFF=Not Present


Thanks, your suggestion, not only solved my problem but made me also better understand MAP principles

1 Like

Glad to hear you’ve solved the problem and understand a bit more about MAP.:+1:

If you would, please mark the post solved by clicking the square box on the post that provided the solution and edit the title to start with [Solved]. This will help other with a similar issue find a quick solution.