I have written a small widget which shows me the state of all batteries which are registered in a corresponding group.
uid: ud_batterie tags:  props: parameters: - context: item description: Die Gruppe der Batterie-Level label: Batterie Zustands Gruppe name: batLevel required: true type: TEXT filterCriteria: - value: Group name: type parameterGroups:  timestamp: Dec 10, 2021, 2:45:33 PM component: oh-list-card config: title: '="Eine Batterie Leer: " + ((items[props.batLevel].state === "OFF") ? "Nein" : "Ja")' slots: default: - component: oh-repeater config: fragment: true for: item sourceType: itemsInGroup groupItem: =props.batLevel fetchMetadata: widgetOrder,semantics,uiSemantics slots: default: - component: oh-list-item config: icon: '=(loop.item.state === "OFF") ? "f7:battery_100" : "f7:battery_0"' iconColor: '=(loop.item.state === "OFF") ? "green" : "red"' title: = loop.item.name.split('_') item: =loop.item.name badge: '=(loop.item.state === "OFF") ? "Ok" : "Wechseln"' badgeColor: '=(loop.item.state === "OFF") ? "green" : "red"'
This works also so far quite well, only I like the line
title: = loop.item.name.split('_')
no longer. Here the model is left and the knowledge about the Things behind it and their naming is accessed.
Besides, this makes the title like
a compound information, which contains the equipment (parents) and the room (grandparents).
I would like to get the parent group with the equipment and the grandparent group with the room via the model.
My model looks like this:
I read in a thread that this could be done via something like.
is supposed to work.
Unfortunately I only get “undefined”.
I would like to compose a title like
Fenster im Raum Dachboden
Can someone tell me what I have forgotten or overlooked?