[SOLVED] Dynamic Icons in Openhab 2.4 lost their flexibility again

For dynamic icons, status of item must be matched with icon filename as “icon-[status]”. Otherwise, default icon is shown always. But, when openhab 2.3 update came, their was flexibility such that only initial part status of string item is used to determine icon type.

See example below to understand:
String door_status “Door [%s]” {mqtt="…"}

This works perfectly if input is either “OPEN” or “CLOSED”

When i updated my arduino code to attach timestamp at end eg “CLOSED at 2:30 pm”, dynamic icon stopped working.
But after updating to openhab 2.3, this problem was solved completely !!
Dynamic icon worked perfectly with timestamp also.

But as i updated to OoenHab 2.4, this limitation again arosed. I don’t know why this flexibility is reverted. Anyone knowing about this, please tell.

I know the alternative (less perfect), using visibility attribute in sitemap with duplicate enteries of same item with different icons.

1 Like

This is the wrong approach to report data
You should create 2 topic:
arduino/report/door_status: CLOSED
arduino/report/door_status_changed:2:30pm (Or better an actual timestamp)

1 Like

I think this is a side effect of a bug that was fixed. Dynamic icons for states that include a space were broken in 2.3 and fixed in 2.4. So in effect, during 2.3 you were taking advantage of a bug.

The way you were using dynamic icons is was not documented and not the expected behavior. The documented behavior is that the last part of the icon’s file name must match the full Item’s state.

1 Like