Try to use own (status) icon for a switch-item (on|off) in dashboard/widget

Hi,
just “fighting” with a small issue.

I habe a switch, in the dashboard I create “Dummy”-widget and use the switch icon as the symbol.
This icon is showing correctly the actuall status (red or green) (and no action when try to press this icon, this is what I want).

Now I will change the switch icon to own status icons,
i create myswitch-on.svg, myswitch-off.svg (and also try with .png), but will not work.
I put the files into the (correct) folder: /etc/openhab2/icons/classic (and 664 rights)

What have I to choose as “Symbol” source,
“Userdefined Symbol” or “userdefined URL” ?
And what have I to use as the name, I think "myswitch. only.

But is not working :frowning:

Or is a own dynamic icon not usable here / in this widget ?
Where is my mistake ?

you need to have “myswitch.svg”, “myswitch-on.svg”, “myswitch-off.svg”

1 Like

Thx for the hint,
now:
using “userdefined icon” and svg-format: working
using “userdefined icon” and png-format: NOT working (hint: png seems not allowed here!)
using “userdefined url” and svg–format: NOT working (no status switch, always show NAME.svg
using “userdefined url” and png-format: NOT working (no status switch, always show NAME.png

So can it be correct, that only “userdefined icon” with .svg is working in the dashbaord/widget ?
I use this URL in “userdefined URL”: :8080/icon/.svg

This might help

Thx for the hint, I tried:
I put it in the “userdefined URL”, but only the NAME.png is shown, not the status-icon (-on or -off)
(and I replace the port to my 8080, I think this is correct for me also here)

More thorough exploration of icon picker service here.

Hi,
thanks for your support,
I tryto understand but I’m unshure what the result is?’
Should it works (correct staus from own png icons in the dashboard configured) or not possible?

I try again few “versions” but also get only the default icon to displayed … no status-change …

I’m not sure what you are trying to achieve with URLs, after -

It does also depend where you look, while this issue is outstanding

Seems I dont understand it corectly …

I want to use (if possible) png-icons in the dashboard, and they should “show” the status from the item.
As I wrote, for svg files it’s working (userdefinde-icon), but .png not.

And own icons can be defined in the userdefined-icon and userdefinde-url, should both possible with dynamic icons ? (name.png, name-on.png and name-off.png)

I don’t think this happened yet

OK, thx.
So I have to use own svg file … A hint in the onlione docu about this will be usefull (Items | openHAB).

(and I find out, that i can change the color from the svg file inside the “code” (xml?) from the svg-file :wink: )

The whole current Items doc is pretty useless for details about MainUI usage. Doc author volunteers always welcome.

So far as I know, there is no enhancement issue logged for PNG support.

I believe this was fixed in Fix multiple issues by ghys · Pull Request #566 · openhab/openhab-webui · GitHub ( Fix #490 - Add anyFormat=true to fetch icons).

As always, the browser’s developer tools are your friends when debugging such issues, in particular what happens in the Network tab when you switch the item on and off - the requests for the icon should appear and you’ll see what the actual response is.