Background

Hi Yannick, I know you made a nice disclaimer of no support :slight_smile: However, I have been struggling with dynamic icon syntax in your example for many hours, trying to find a solution. Else your template works great! My dynamic icons are also working well in habpanel dummy widget. So I believe the only issue is with the syntax.

I have custom dynamic icons in ā€œclassicā€ folder, named dmotion.svg, dmotion-red.svg etc.
The item definition is:

String Pir01 "PIR1 [%s]" <dmotion> (gPirs, gPirsOutside)

And the widget template is as yours above, I only adjusted the first ng-init=ā€˜model part like this and the main issue is obviously at the end … ā€œiconā€: ā€œdmotionā€, ā€œstateā€: itemState(Pir01) }’>:

<div ng-init='model={"name": "PIR01", "item": "Pir01", "hidelabel": false, "hideonoff": false, "iconset": "eclipse-smarthome-classic", "icon": "dmotion", "state": itemState(Pir01) }'>
    <widget-switch
        style="position: absolute;
               background: rgba(0,0,0,0);
               border-radius: 20px;
               top: 520px; left: 500px;
               width: 60px; height: 80px"
        ng-model="model" />
  </div>

I tried all possible versions ( ā€œstateā€: itemState(ā€˜Pir01’); ā€œstateā€: ā€œitemState(Pir01)ā€; ā€œstateā€: itemState(ā€œPir01ā€) etc.) but no luck :frowning:
Sometimes only the main icon works but not changed acc. to itemState, sometimes obviously wrong syntax so no icon displayed at all. I would really appreciate any help…

Thanks!