Can't use json in operator: template in custom button card

Hi,
Want to use operator template in custom button card

value: {{'Vu+' in state_attr('media_player.tele', 'source')}} 

is correct in developer tools template and the answer is true or false
but operator_template in custom button card don’t understand this syntax.

I saw than the correct syntax is [[[ … ]]]
I tried translate my jinja whitout succes

     - operator: template
        value: >
          [[[ return states['media_player.tele'].attributes.source ===  'Vu+' ]]]

Do you know the correct form ?
Thank’s

Found the solution

- operator: template
  value: |
     [[[  
      return  (states['media_player.tele'].attributes.source == "Vu+")
     ]]]
 

The exact form would be

return  (states['media_player.tele'].attributes.source.includes ( "Vu+"))

(I don’t find how I can mark it as solved)

1 Like