Dynamic icon not working for String item

You’ll have to set the Item metadata on the Item. Probably the easiest way to do it will be to create a test Item, configure the metadata through the UI, and then look at the code tab to see the proper field names and formatting.

I don’t use items files any more and there is enough in OH 3 now that is controlled through metadata that I can’t even imagine trying to do it all in .items files. Each Item would be 20+ lines of code or more to do it all.