Dynamic icons with mapped item states

How can I “force” itemValue() function to return “original” item state instead of mapped item’s state?
.item:

String		Mondphase	"Mondphase [MAP(astro.map):%s]"	<mymoon>	(gAstro)		{ channel = "astro:moon:local:phase#name" }

.map

WAXING_CRESCENT=zunehmender Halbmond
FIRST_QUARTER=erstes Viertel

HABPanelwidget

<span><widget-icon iconset="'custom-icon'" icon="'mymoon'" size="28" state="itemValue('Mondphase')" /></span>

HABPanel tries to open

mymoon-zunehmender Halbmond.svg

instead of

mymoon-waxing_crescent.svg

I double checked with REST API: WAXING_CRESCENT is the correct state.
However: sitemap (App or BasicUI) show correct icons

Could somebody please confirm, that this is not a bug in HABpanel?
Based on the above config HABpanel creates html code with a mapped item state:

<img ... ng-src="/icon/mymoon?format=svg&amp;state=zunehmender Mond" src="/icon/mymoon?format=svg&amp;state=zunehmender Mond" ... ;">

However, Basic UI creates html code with original unmapped state:

<img data-icon="mymoon" src="../icon/mymoon?state=WAXING_GIBBOUS&amp;format=svg&amp;anyFormat=true">

Yes, dynamic icons are selected based on raw, unmapped Item state.
It looks like your HABpanel widget is incorrect.

many thanks!
I am lost. I have been searching for my error a few days now.
Do you know where the error is when using this tag?

<widget-icon iconset="'custom-icon'" icon="'mymoon'" size="28" state="itemState('Mondphase')" />

Well clearly you don’t to call icons by the (mapped) state seen by HABpanel, you need to specify the raw state, I don’t know how that’s done.
What’s the default here?
This looks helpful

yes, I follow exactly the same path. The main difference is, that my item states are mapped and I do not know how to specify to use unmapped (raw) item states.
@ysc: Yannick, sorry for bothering you. Could you please give me a hint how to force HABpanel to return raw item states?

<widget-icon iconset="'custom-icon'" icon="'mymoon'" size="28" state="itemState('Mondphase')" />

is returning mapped states.
Many thanks in advance

No problem, it’s relatively obscure, see here:

The second boolean “ignoreTransform” argument to itemState will ignore the transformations when set to true. It is false by default if omitted.

So state="itemState('Mondphase', true)"

2 Likes

I am ashamed. I really read that post but I have overseen this. Many thanks for that :thumbsup: - now everything is working perfectly.