Dynamic Icon (Switch) with Transformation OPEN/CLOSED

Hello I am new to OpenHAB and have the problem, to use the dynamic icons. In my overview I would like to state the status of each Device in my Network via the FritzBox. For each item I use the “switch”-Icon. Depending on the status of the item OPEN/CLOSED I transform it to Offline/Online. In that case the Icon (Switch) is not going to switch between green and red.

This was no solution for me: Dymamic Icons for Ranged values

Icon selection is always based on Item state.
Transformation for UI display is therefore irrelevant to icons.
What is the actual state of your Item?
If it is really OPEN/CLOSED then you need to use icons with filename-open and filename-closed images.
There are no built in switch-open and switch-closed images, so that’s not going to work

Okay, thanks for your response. I saved now the SVG-Files. Is it correct to name the Icon in the sitemap as the Filename? “switchon” equal to switchon.svg

I think you mean, if you have for example myicon.svg?
In your sitemap line
Text item=xxx icon="myicon"

You can also specify it in a file-based Item definition
Contact myItem ... <myicon>
or if editing an Item in PaperUI, you put it in the category box

Note that switchon.svg is not a dynamic icon filename by itself.
It could be part of a set like
but I would not use that name in case of confusion because it ends in “on”