Multiscrape conditional IF

Hi,
I’d like to change the value of the weewx_heat_index sensor read by multiscrape if the value is ‘N/A’ and is set to the value of another sensor already read, namely weewx_outside_temperature.
Is this possible?
This is the multiscrape yaml config file.

resource: http://www.banfi-gaslini.it/weewx/alexa.html
  scan_interval: 300
  
  sensor:
    - unique_id: weewx_outside_temperature
      name: Temperatura Esterna
      unit_of_measurement: "°C"
      select: "body > div:nth-child(1) > table > tbody > tr:nth-child(1) > td.stats_data"
      value_template: '{{ (((value.split("°")[0]) | replace(",", ".")) | float )}}'

    - unique_id: weewx_heat_index
      name: Heat Index
      unit_of_measurement: "°C"
      select: "body > div:nth-child(1) > table > tbody > tr:nth-child(4) > td.stats_data"
      value_template: >-
        {% if weewx_heat_index == 'N/A' %}
          {{ weewx_outside_temperature }}
        {% else %}
          {{ (((value.split("°")[0]) | replace(",", ".")) | float ) }}
        {% endif %}

What am I doing wrong? The weewx_heat_index sensor value is always “unavailable.” The selector is correct.

thnks!!!

I’m not sure how much the integration is supposed to do here, but what are you trying to get with the above template line?

If you’re trying to get the state of sensor defined just above it, you need something like

          {{ states('sensor.weewx_outside_temperature') | float(0) }}

If you end up with a value of 0, that means that sensor.weewx_outside_temperature is returning a non-numeric value (i.e. has a problem).

With
{{ weewx_outside_temperature }}
I think I’m assigning the value of weewx_outside_temperature to the weewx_heat_index sensor.

OK, but with
{{ states(‘sensor.weewx_outside_temperature’) | float(0) }}
If the sensor value is already 0.0, what result do I get?
0.0 °C is still a valid temperature.

You get 0.0…

but is it possible to do an IF inside the multiscrape configuration file?
tnks!