Set a custom icon in a floorplan with an expression

  • Platform information:
    • Hardware: Pi 4
    • OS: OpenHab pi
    • Java Runtime Environment: defauult
    • openHAB version: 3.1
  • Issue of the topic: I want to have a custom icon for a device on a floorplan that changes with state.

I am able to find information in documentation about custom icons and images for use in floorplans, but I specifically want to use a custom icon that will change with state. Does anyone have an example that I can work from?

Any information is appreciated, even a link to documentation that addresses this.

Thank you.

Maybe share the code for what you have so far? Makes it easier to assist.

I do not have any code so far. I am looking for a place to start. I have a working OpenHab system and a current floorplan, but I cannot find any information on where or how to use an expression. it would be a fairly simple expression (hope to make it more complicated as I go)

I have found the following, which might be what I need:
https://www.openhab.org/docs/configuration/items.html#dynamic-icons

I expected to need an expression to link an icon to a state, but perhaps this will work for custom icons as well.

I appreciate the response and as I looked for example expresions, I came across this.

Thank you,

As suspected, that page was the correct answer, and I merely missed it as I searched initially. Thank you for the help.