Problem with yaml

Hello everyone,

Am fairly new here and have a problem with yaml.
I’m trying to make a comparison:
I the following things:

  • a variable: {{states.variable.volume_music_kitchen.state}} this one
    has a value of 0.13
  • an artibute of the volume of a media player:
    {{}} it has
    also the value 0.13
  • a comparison:

But the result of the comparison is false (see photo)
What am I doing wrong here?

Thanks for your response.

The convention in HA is that states are always string. Attributes can be other data types. So you often need to convert them to matching types when doing comparisons. In your case you are comparing a string to a float which will always be false. Try the following:

{{ is_state_attr("", "volume_level", states("variable.volume_music_kitchen") | float(0) ) }}

EDIT: Fixed “fancy” quotes

Thank you very much for your response.

That’s how it works perfectly!!