I’m in the process of making a widget that displays the status of multiple items where the first part of the item name is common. Is it possible to use one prop as a variable for part of the item name?
Can’t really find any documentation on how the
component: Label
text:
works, and I don’t know if this at all is possible.
The following line seems to build the correct expression, but it is printed and not run as an expression:
text: ="items."+[props.roomName]+"_Humidity.state"
Complete code:
First F7-row displays correctly, but the second F7-row is how I’m hoping it can be done with the right YAML-know-how
uid: widget_klimadata
tags: []
props:
parameters:
- context: item
label: Temperatur
name: temp
required: false
type: TEXT
default: 25
- context: text
label: Roomname
name: roomName
required: false
type: TEXT
default: Hobby
- context: text
label: Text color
name: textColor
required: false
type: TEXT
default: lightgreen
- context: text
label: Text size
name: textSize
required: false
type: TEXT
default: 12px
parameterGroups: []
timestamp: Dec 6, 2024, 5:53:39 AM
component: f7-card
config: {}
slots:
content:
- component: f7-row
config:
color-theme: red
slots:
default:
- component: f7-col
slots:
default:
- component: Label
config:
style:
font-size: =props.textSize
color: =props.textColor
text: '= "Rh: " + items.Hobby_Humidity.displayState'
- component: f7-row
config:
color-theme: red
slots:
default:
- component: f7-col
slots:
default:
- component: Label
config:
style:
font-size: =props.textSize
color: =props.textColor
text: ="items."+[props.roomName]+"_Humidity.displayState"