Dynamic icons in habpanel

Tags: #<Tag:0x00007f1741c805c8>

Sorry…
Simple question…
Does Habpanel make use of dynamic icons like basicUi ? I cant seem to get them to work.
That is for custom icons.

Using Openhab2.2

Greets
Kim

  1. What are you trying to do?
  2. What have you done so far?
  3. Any code you might want to share so we can all debug

Yes they work. Have you named them correctly?

I tried to read the guide. To be honest I found it pretty useless for my short question, so I thought I would rather just tried to write it myself… Anyway, I see I did wrong, which I´m sorry for…

  1. I´m trying to use dynamic icons within Habpanel.

  2. I have created a dummy widget, applied an item to the widget, and inserted a custom icon svg file into the widget as well. THe widget is working, (it´s an simple network icon. black for offline and green for online. The widget state is changing just fine to away and home).

Regarding the icons I have tried almost all sorts of combination ie: network-online.svg/network-offline.svg etc. as well as changing my mapping and item file to suit the icons. The results are the same, habpanel uses the network.svg all the time, no matter what I do. Thats why I thought that maybe habpanel dont use dynamic icons like BasicUI does.

  1. Sure, here goes:

unifi.items

Contact  kimsPhone           "Kim's S7  [MAP(unifi.map):%s]"    <network>        { channel="unifi:client:home:kimsPhone:online" }

unifi.map

OPEN=away
CLOSED=home

3 icon files placed in /icons/classic folder
network.svg
network-away.svg
network-home.svg

Habpanel dont change to network-home.svg icon when the state is changing. And I simply fail to see why.

Two screenshots showing the state change, but same icon.

network%20widget%20away
network%20widget%20home

This is driving me nuts!

I believe I do. But to be honest, I have no longer any idea. I have tried everything, but simply cant get it to change. I tried without mapping as well as using the original state. I tried on/off, 0/1 etc…
It´s probably some dump mistake I did somewhere, I simply cant see. Been struggling with this for some days now.

According to the item documentation, the dynamic icon uses the actual item state and not the mapped state.

So, for your contact you would need you icons named:

network.svg
network-OPEN.svg
network-CLOSED.svg

Not sure whether you need upper or lower case for the OPEN/CLOSE but the unifi binding shows upper case.

If that doesn’t work, do what I do when I can’t get something to work and take it right back to basics. Create a Test switch item in your HABpanel which has a set of dynamic icons that you know work and test it. If that works then use your own icons (renamed the same as the working icons) and test that. This will show that the icons are ok.

Got it working now.
I think is was a sum of severa things, such as a chase in Habpanel/openhabian as well. After changing icons names to
cu_network.svg
cu_network-open.svg
cu_network-clsoed.svg

And rebooting openhabian. It is working just as it should.

Thanks for any help on this matter.

Greets
Kim

1 Like

Hi, I didn’t understand how to manage the dynamic custom icons in HABPanel.
I have switches, each of which indicates the status of an object with the ON / OFF property.
If I use the classic icon set and select the SWITCH icon it all works.
However, I would like to create custom icons that indicate the property that is visually monitored, just like the classic icon.

What is the procedure to do it?

Thanks bye!

Hi Squid, thanks for the tutorial. I followed it but unfortunately I can’t get it to work.
For example:
In the Hab panel I created a dummy widget pointing to the MoonPhaseName item. In the Icon selection menu I selected “custom icon”, in the icon text field I wrote “moonphase”.
In the box / etc / openhabian2 / icons / classic I have inserted the icons:

moonphase-first_quarter.svg
moonphase-full.svg
moonphase-new.svg
moonphase-third_quarter.svg
moonphase-waning_crescent.svg
moonphase-waning_gibbous.svg
moonphase-waxing_crescent.svg
moonphase-waxing_gibbous.svg

If I run the panel I see the widget with the icon of the missing image and the name of the moon phase:
WANING_CRESCENT

If I analyze the missing icon I see that the url is:

https://home.myopenhab.org/icon/moonphase?format=svg&state=WANING_CRESCENT

opening it in a new tab the system responds:

HTTP ERROR 404
Problem accessing / icon / moonphase. Reason:

Not Found

I understand that this example is more complex than my ON / OFF but I think the basic problem is the same, that is that something escapes me or that my OpenHAB has a crooked moon!
(in Italy to say that someone has a crooked moon means that he has a very bad day and that he is therefore nervous and behaves badly. I would say he fits perfectly!)

2 Things…

1.Is this set correctly in PaperUI?

  1. Custom Icons in HABPanel Template Widget

hello, where do I find that configuration panel? I searched the system configuration but I can’t find it.
I have something similar in Configuration> Services, but there are only Basic UI and HABPanel, I miss Classic UI, I install it from ibindings or I can’t see it from the cloud ??

For point 2, I did everything from the GUI, it does not generate the various files for me, at least not in the known folders.

Thanks

yes, I had not installed classic ui

Done, but it’s the same:

https://home.myopenhab.org/icon/moonphase?format=svg&state=WANING_CRESCENT

HTTP ERROR 404
Problem accessing /icon/moonphase. Reason:

Not Found

You must always have a default icon , moonphase.svg , even if you don’t expect to use it.

1 Like

yes, perfect, that was it!

Thanks