Dear all,
I am starting with Openhab and trying to create my first own widgets.
What do I want to do: I just want to show the analyzer if I click on an icon. A “direct statement” to the item is working, but not when I try to link it to a corresponding property.
But when I replace “RollladenArbeitszimmerVorne_Pos” with the corresponding item from the props selection (“Rollladen Arbeitszimmer vorne, Position (RollladenArbeitszimmerVorne_Pos)”), nothing is shown in the analyzer page.
I searched and tried quite a lot, but I don’t have a clue how to get it running. If someone could help I would be very happy.
BR
Wolf
This is an obscure, but known, limitation at the moment. The expression parser, the piece of the UI that lets you use dynamic code in the widgets, doesn’t work for yaml arrays (any part of the yaml where lines start with a - ).
The solution is to bypass the yaml array syntax, and just set the actionAnalyzerItems property to an array directly using an expression. Because the expression parser is based on javascript, an array is a comma-separated list of values between [ and ]. Since you’ve only got one value at the moment that you want, it’s a fairly simple expression:
many thanks for you quick reply! And your explanation helped me a lot!!
At first I wanted to state that this was one of the solutions I tried without success . But then I was more persistent and found out, that only refreshing of the browser page was showing the intended result. Unfortunately, I have to set then the props for testing every time, but it is working now !
Do you have a tip when this step of refreshing is mandatory? Otherwise I will do that in the future more often or as soon as I expect different results.
Refreshing the widget editor page is almost never necessary, in my experience. I frequently use the Redraw button in the lower right corner (or just press ctrl + r) but that does not cause the chosen properties to reset.
Pretty much the only times I ever find that I have to refresh the widget editor page are: 1) when I want to reset the variables in the widget back to null so that I can test how the widget handles its startup condition, or 2) when there’s been some interruption to the event stream for that window and the items stop responding. It sounds like maybe that second one was your issue, but it is not common, so you shouldn’t have to do it regularly.