Is an expression like this possible?

Hello.

I am using the ‘semanticHomeMenu_Scenes’ widget by hmerk, but I would like to change the colour of the border for the scene card that has been pressed.

The widget contains the following prop settings as created by hmerk that I would like to use:

sceneUID
colorScheme

I have created the following item that has the ‘state’ set when activating scenes:

home_status

One of the states I set it to is ‘scene_im_home’

Here is the yaml statement I added to the widget with an expression that will set the border of the card to blue when home_status == “scene_im_home”, otherwise set the border to black.

    --f7-card-outline-border-color: "=items.home_status.state == 'scene_im_home' ? 'blue' : 'black'"

What I would like to do is use the props to evaluate the sceneUID with home_status and set the border colour to colorScheme, however it does not work.

    --f7-card-outline-border-color: "=items.home_status.state == =props.sceneUID ? =props.colorScheme : 'black'"

Any suggestions? Or is this even possible to use the prop variables this way in an expression?
I have tried putting the =props.sceneUID in single quotes, and tried using it without the = sign but no luck.

Thanks
Craig

You don’t want to put it in quotes because then the value is the string props.colorScheme not whatever value that variable holds.

Without the = should work, because this is the proper form. The = at the start of the expression is not some modifier for items.home_status.state, it’s just the symbol that tells the widget code that particular yaml property should be parsed as an expression and not just treated as a string. So, you only need the extra = at the very beginning.

So, assuming that the colorScheme state has been set properly, then the correct expression is:

--f7-card-outline-border-color: "=items.home_status.state == 'scene_im_home' ? props.colorScheme : 'black'"

If that does not work then you have to check what the value of the colorScheme property is.

Hi Justin.

Thanks for setting this on the correct path, I knew it should be simple but I was over thinking it… This is the expression I am using that works setting the border colour depending on the scene selection.

    --f7-card-outline-border-color: "=items.home_status.state == props.sceneUID ? props.colorScheme : 'black'"

Craig