New and need help understanding why this doesnt work

hello I am trying to create a custom sensor in the config.yaml file.
it is

 - name: BK Can Run Dryer
      device_class: power
      state_class: measurement
      state: >
        {% if (states ('sensor.????l_???_????') | float(0)*1000| int)  <= 1500) and (states ('sensor.????_?????') | float(0)*1000 | int) >= 1500 %}
        'yes 1'
        {%else%}
        'No'
        {% endif %}

I want the sensor state to be yes or no so I can have a card that says yes or no when the arguments are right.
everything seems fine the yaml passes and the Jinja works.
but the issue is that the sensor does not show up in homeassistant.
Any help would be so grateful
Cheers

Hello and welcome to the forum. Could you please edit your post and format your pasted config by following these instructions: https://community.home-assistant.io/t/how-to-help-us-help-you-or-how-to-ask-a-good-question/114371#oneone-format-it-properly-16

You have specified a sensor device class of power, which requires a numeric state yet your template is supplying yes 1 or No. Which are not numeric.

Remove the device_class line.

Thank you tom_I, I also had to take out the state class for it to finally work but thank you again.
I originally had two more and functions on the same line but it didnt seem to work with more than one and on the line. Is this how things work or is there a work around?

Oh, yeah I missed that one.

Can you show what you were trying to do?

Thanks again tom_I
here is what I was trying to do.

   - name: BK Can Run Dryer
      state: >
        {% if (states ('sensor.????????') | float(0)*1000| int)  < 0 and (states ('sensor.????????????') | float(0)*1000 | int) <= 0 and (states ('sensor.?????????????') | float(0)*1000| int)  <= 1500  and (states ('?????????????????') | float(0)*1000 | int) >= 1500 %}
        'yes 1'
        {%elif (states ('sensor.???????') | float(0)*1000| int)  < 0 and (states ('sensor.?????????????') | float(0)*1000 | int) <= 0 and (states ('sensor.???????????????') | float(0)*1000| int)  >= 3500  and (states ('???????????????') | float(0)*1000 | int) >= 3500 %}
        'yes 2'
        {%else%}
        'No'
        {% endif %} 

so each if has 4 parts that need to be true for it to be allowed to work, but it seems to not like it?
Thank yo for your help, it is much appreciated.

It’s unclear how many distinct entities are involved in the template’s comparison. Please post the template using meaningful entity_ids instead of sensor.????????.

thankyou 123 Taras, I see how it could be confusing, there are 4 entities.

- name: BK Can Run Dryer
      state: >
        {% if (states ('sensor.1') | float(0)*1000| int)  < 0 and (states ('sensor.2') | float(0)*1000 | int) <= 0 and (states ('sensor.3') | float(0)*1000| int)  <= 1500  and (states ('sensor.4') | float(0)*1000 | int) >= 1500 %}
        'yes 1'
        {%elif (states ('sensor.1') | float(0)*1000| int)  < 0 and (states ('sensor.2') | float(0)*1000 | int) <= 0 and (states ('sensor.3') | float(0)*1000| int)  >= 3500  and (states ('sensor.4') | float(0)*1000 | int) >= 3500 %}
        'yes 2'
        {%else%}
        'No'
        {% endif %} 

thanks for your time

You have some indention issues, you have a space in states(), it should not be states (), you don’t need to convert numbers to integers, there are more parentheses than you need, you could do with an availability template and some refinements to the layout to make it easier to read:

- name: BK Can Run Dryer
  state: >
    {% if states('sensor.1') | float(0) * 1000  < 0 and 
          states('sensor.2') | float(0) * 1000 <= 0 and 
          states('sensor.3') | float(0) * 1000  <= 1500 and 
          states('sensor.4') | float(0) * 1000 >= 1500 %}
      yes 1
    {% elif states('sensor.1') | float(0) * 1000 < 0 and
            states('sensor.2') | float(0) * 1000 <= 0 and
            states('sensor.3') | float(0) * 1000 >= 3500 and
            states('sensor.4') | float(0) * 1000 >= 3500 %}
      yes 2
    {% else %}
      No
    {% endif %} 
  availability: >
    {{ has_value('sensor.1') and 
       has_value('sensor.2') and 
       has_value('sensor.3') and 
       has_value('sensor.4') }}