I iterate over all my Shelly devices for two specific items (qualitiy of signal, operating temperature). Some of my shellies do not provide operating temperature, thus there is no item defined for that thing. The widget in general works fine.
What I try to work around is a missing function like “if exist item xyz”.
In the following yaml code you see that I have an oh-repeater
within an oh-repeater
and that the name of the item consists of two repeater names.
- component: oh-repeater
config:
for: rItem
fragment: true
in:
- Signalstarke
- Geratetemperatur
sourceType: array
slots:
default:
- component: f7-col
config:
style:
font-weight: normal
white-space: nowrap
width: 20%
slots:
default:
- component: Label
config:
text: "=(!!items[loop.rThing.name + '_' + loop.rItem]) ? items[loop.rThing.name + '_' + loop.rItem].state : 'x'"
However, none of the following works:
"=(!!items[loop.rThing.name + '_' + loop.rItem]) ? items[loop.rThing.name + '_' + loop.rItem].state : 'x'"
"=(!!items[loop.rThing.name + '_' + loop.rItem].state) ? items[loop.rThing.name + '_' + loop.rItem].state : 'x'"
"=(items[loop.rThing.name + '_' + loop.rItem]) ? items[loop.rThing.name + '_' + loop.rItem].state : 'x'"
"=(items[loop.rThing.name + '_' + loop.rItem].state) ? items[loop.rThing.name + '_' + loop.rItem].state : 'x'"
Does anybody has a tip for me?