openHAB version: 3.3.0
I have a problem when creating a widget which uses OpenWeather to display Weather information.
I show Items in a table and create that table in some repeat loops (oh-repeat).
That work fine, but if I try to access the icons in OpenWeather I can’t use items[‘xyz’] as with the loop below. (where xyz is the name of the icon). If I use xyz without items the icon is displayed.
In this case it seems that items[‘Wetterinformationen_ForecastDay2_Icon’] !== Wetterinformationen_ForecastDay2_Icon.
Is there an explanation for this effect?
Can’t say for sure unless you show us exactly what you’ve tried to do, but it depends on the combination of what kind of item it is and how you’re trying to show the image. Most of the weather icon channels provide the image directly and the item is therefore an image type item. This means that the state of the item is the raw 64-bit encoded image data (and the display state is just a short form object identifier that looks like this raw type (image/png): 3018 bytes). A few icon items give you a standard icon name and expect you have an icon library from which you extract the icon of that name.
Assuming that you have the image type item then most of the time you just need to supply the name of the item. For example the oh-image component has a built in item property. If you are using that then that property just takes the name of the item and will fetch the item state (the raw image data) itself. If you try to set the item property to the state of the icon value then the widget will try to look up an item named raw type (image/png): 3018 bytes which, of course, doesn’t exist.