icons and number items

884 views
Skip to first unread message

Victor Belov

unread,
Mar 4, 2013, 7:47:37 AM3/4/13
to ope...@googlegroups.com
Hi,

Is it possible to display different icons for a number item depending
on the value? For example. I have an outside light sensor and would
like to display it with different icons (sun and moon) together with
current light level value, depending on if the value is less or bigger
then my twilight threshold.

Best regards,
Victor Belov

Thomas Eichstädt-Engelen

unread,
Mar 4, 2013, 9:19:34 AM3/4/13
to ope...@googlegroups.com
Hi Victor,

yes and no :-)

It is possible to show different icons subject to the state of an item (see lock-x.png for example). But the state must match exactly. There are no functions (like less or greater than) which could be applied to the getIcon() function. To accomplish your requirement you will have to create a rule which translates the intermediate states to the given threshold values.

Regards,

Thomas E.-E.
> --
> You received this message because you are subscribed to the Google Groups "openhab" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to openhab+u...@googlegroups.com.
> To post to this group, send email to ope...@googlegroups.com.
> Visit this group at http://groups.google.com/group/openhab?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Victor Belov

unread,
Mar 4, 2013, 9:21:43 AM3/4/13
to ope...@googlegroups.com
Hi,

Haha, I know about icons. The trick is I want to display numeric value!

Sent from my iPhone

Thomas Eichstädt-Engelen

unread,
Mar 4, 2013, 9:33:40 AM3/4/13
to ope...@googlegroups.com
hmm ...

>> I have an outside light sensor and would
>> like to display it with different icons (sun and moon) together with
>> current light level value, depending on if the value is less or bigger
>> then my twilight threshold.

like an overlay on the leftside icon (already known from iOS?) ?

If not i understood from your explanation that you'd like to show one icon of sun or moon depending on the state of the brightness value.

Kai Kreuzer

unread,
Mar 4, 2013, 1:41:38 PM3/4/13
to ope...@googlegroups.com
Hi,

> It is possible to show different icons subject to the state of an item (see lock-x.png for example). But the state must match exactly.

There is one exception to this rule: For Items that are based on a PercentType (e.g. Dimmer or Rollershutter). There, openHAB searches for an icon "rollershutter-<state>.png" and stops only when it finds one (or ends at 0). Example: If the current state is 74, it will check for "rollershutter-74.png", cannot find it, tries "rollershutter-73.png", cannot find it and so on until it finds "rollershutter-60.png" and uses it. That's why you can get a nicely animated rollershutter icon while it is moving. Same for dimmers - it can always display a suitable icon for every percent value.

All this does not help you for Number items, though, sorry :-)

Regards,
Kai

Victor Belov

unread,
Mar 4, 2013, 1:44:39 PM3/4/13
to ope...@googlegroups.com
Hi,

Do you think it makes sense to create an issue for that? :-)

Best regards,
Victor Belov

Kai Kreuzer

unread,
Mar 4, 2013, 1:46:33 PM3/4/13
to ope...@googlegroups.com
No, because I wouldn't know how to apply a similar concept to Number items, which could possibly habe ANY value…

Victor Belov

unread,
Mar 4, 2013, 1:51:06 PM3/4/13
to ope...@googlegroups.com
Hi,

Some kind of complex item where value comes from one item and icon
comes from another one? :-)

Best regards,
Victor Belov
Reply all
Reply to author
Forward
0 new messages