There are two different collections of item data here so it’s important to keep track of which you’re using and what that makes available to you:
- As I said above, your
loop.item object contains all of the information about the item that would be returned by a call to the item api. This includes all the basic relevant information (e.g., name, label, state, etc.). This does not inlcude any metadata unless you use the
fetchMetadata option. For each loop through the repeater, this contains only the information about the one item currently being iterated over (there is a second variable which in this case would be
loop.item_source which is an array with all the same information for all the items the repeater is looping through should you need to access some item other than the current one).
items object is a much simpler dictionary that contains only very basic information (just state and displayState essentially), but it has that information for every OH item. The keys for this dict are each of the item UIDs. So this is what you are accessing every time you use the
items["Some Item Name Here"].state syntax.
Once you get comfortable with this difference, you’ll be able to get whatever information you need to customize your calendar items however you wish.
You have two different items that you are accessing (and you’re accessing them using the two different methods described above). Based on what you posted earlier,
loop.item in this example contains information about the item
agenda0_topic. So you can access lots of information about this item: it’s state (which appears to be
"Vanessa kapper"), name (
agenda0_topic), label (? whatever you put in the label definition of the item), type (
String it seems), etc. So when you use
The title of the list item gets set to the state for
agenda0_topic - Vanessa kapper.
However, when you use
there are several steps. First you use the string of the name of the
agena0_topic item and construct a string of the name of an associated item. Now you have a string it that equals
"agenda0_dt" it is not an item, it is not an object with item information it is just a string. But you can use that string in the key of the
items dict (#2 above) to retrieve the displayState of this other item (18:00).
You should now also see why your badge disappears if your repeater doesn’t return an item. The
loop.item.name contains no information if there is no item that has been returned by the api call. If
loop.item.name contains no information then you cannot build a recognized second item name string. If you don’t have a actual item name as a string then the call to the
items dict will not return anything and the badge will have no text to display.