Change icon based on state Number/Sting

hey guys,

i want to change a icon based on ITEM “number” or “string”.
So i did the following:

ITEM:

Number EGFlursmoke “Rauchmelder [MAP(HM-Sec-SD.map):%d]” (smoke) (gEGFlurRauchmelder)
{homematic=“address=NEQXXXXXXX, channel=1, parameter=STATE”}

MAP:

0=OK
1=Feuer
-=-Fehler bei der Initialisierung-

ICON “/webapps/images/”:

cp shield.png smoke.png
cp shield-1.png smoke-0.png
cp shield-0.png smoke-1.png

SITEMAP:

Frame label=“Rauchmelder”{
Text item=EGFlursmoke valuecolor=[“0”=“green”, “1”=“red”]
Text item=EGFlurRauchmelderBattery
}

Item state via REST:

> <item>
> <type>NumberItem</type>
> <name>EGFlursmoke</name>
> <state>0.00</state>
> <link>http://openhabip/rest/items/EGFlursmoke</link>
> </item>				

So, now the if i check the GUI it displays only the “smoke.png”

Any Ideas?

Hey, I would need to test your scenario later.
I have working dynamic icons for Switch items + Text elements and Dimmer items + Slider elements in my setup.
I’m using icons from the classic icon set as well as my own icons.

I would need to build an example with a Number or Switch item.

What I can see at first glance:

  • you never mention the icon “smoke”
  • if you are on OH2 (I believe so as you mention the REST interface) you are placing your icons in the wrong folder. They need to go into <oh-config>/icons/classic/.

Please also try with provided icons like qualityofservice

Hi,

o, i see thas was a format problem by copy and paste :slight_smile:

Number EGFlursmoke “Rauchmelder [MAP(HM-Sec-SD.map):%d]” <smoke> (gEGFlurRauchmelder)
{homematic=“address=NEQXXXXXXX, channel=1, parameter=STATE”}

This System is on OH1.8.3

I can’t help with openHAB 1.8. In openHAB 2.0 a problem with dynamic icons was solved a few months back. Maybe you should think about switching before investing more time in your old setup.

http://docs.openhab.org/tutorials/migration

Your Homematic can easily added via paperui or manually in configuration files, just as you havve it now (a few changes are needed). Please see http://docs.openhab.org/addons/bindings/homematic/readme.html

Hi,

this “old” Setup works perfect :slight_smile: …I also have OH2 but as long it´s BETA i´ll not change my “live” System.