Dynamic Clock Icon depending on Time?

The OH standard release has a nice dynamic icon pair for “clock off” (clock-off.png / gray) and “clock on” (clock-on.png / green).

=> does anyone have an idea how to extend this dynamic icon to cover my two possible states a) UNDEF = gray, and b) any other time value = green?

I’m thinking that the default clock icon will handle the UNDEF case (=> clock.png) but what would you suggest for the b) any other time situation? (=> maybe clock-0.png ??)

If you are using a sitemap based UI?? you could use the visibility= (and visibility with !=) to construct two alternate line displays with different colours, icons etc.

However, I do not think you can directly specify icon="iconame-whatever" because the hyphen in a name is a part of the dynamic selection system, and is thus a “reserved” (or forbidden) character in icon selection.

You can work around that by creating your own “custom” icons, perhaps clockgray.png and clockgreen.png, by copy/rename the standard parts.

Hi @rossko57 thanks for the assistance; however I think I did not explain properly what I want to do, so I will try again…

I have a couple of items of Time type. They are for the oven when it is running in program mode; and they show the elapsed number of minutes of the cooking program and the number of minutes yet to go. When the oven is in manual mode they are UNDEF.

So I want to make a customised copy of the dynamic clock icon set to handle this. The stock clock icon set has clock.png, clock-off.png, clock-on.png, but my customised version will need xclock.png, xclock-undef.png, and xclock-anyothervalue.png. The undef icon variant is probably not actually needed since the OH dynamic icon system defaults to using clock.png if the value does not explicitly match any other icon -sub-value. So my question is what icon -sub-value name “anyothervalue” would match my Time Item (cooker program elapsed time, and to go) when its value is not UNDEF.

There isn’t one.
xclock.png is the default of the set, for no matches.

I’m not enitirely convinced that xclock-undef.png (or xclock-null.png) will actually work in all or any of the UIs, because these are kinda-states, kinda-nothings.
Worth trying, of course.

Your UI choice is still secret so I do not know if the sitemap tip is any use to you.

The best option is to create (or edit) the icons yourself, and then rename it something like cu_clock-xx.png. Thats what I usually do, when I want icons openHAB doesnt have.

Make sure you got:

Or if you´re working with values:

(note… the cu_ prefix is optional. I´ve choosen this so I know its custom made :smiley: )

Oh Btw… I use .svg not .png… But the procsss is the same.

Hi @rossko57 many thanks, but I obviously still did not make my question clear. However I have in the meantime solved it by trial and error myself as follows…

Number:Time Bosch_Combi_Oven_Elapsed_Program_Time "Bosch Combi Oven Elapsed Program Time [%d min]" <xclock> {channel="homeconnect:oven:xxx:BOSCH-CMG676BS6B-yyy:elapsed_program_time"}

Where I have placed two custom dynamic icons in the conf/icons/classic folder as follows

  • xclock.png (gray clock icon) => picks up the above Item’s UNDEF state
  • xclock-0.png (green clock icon) => picks up the above Item’s “anyothervalue” state

Note: the reason why xclock-0.png picks up “anyothervalue” is because Number:Time seems to always be a number whose value is greater than zero…

1 Like

Spot on. In the case of Numbers only, the icon picker looks for the next lowest numeric iconame-nn. So iconname-0 is effectively the default for any valid number (but not of course for NULL and UNDEF, as they are not numbers, not even zero)

The icon picker takes no notice of what UoM a Number type has.

You kept secret you are working with a Number and not a DateTime :wink:

Indeed. Sorry for that :frowning: