The whole expression only needs to be enclosed in quotes if (as in the common ternary statement) there is a :
followed by a space somewhere in the expression. In that special case, the yaml parser thinks the expression is actually an attempt to set a new key: value
in the middle of another value and breaks. If you put the whole expression in quotes the parser knows to just treat it as a string :[space]
and all.
In this case you can use the shorthand notation:
text: =@(props.roomName + '_Humidity')
This defaults to the same result as the longer form but has one extra benefit which is that it will fallback to the state
value if the displayState
is undefined (which happens under certain circumstances).