Convert sensor output to exponential values in template

I’m trying to create a template to calculate wind chill. The required formula is as follows:

35.74 + (0.6215 * T) - (35.75 * W0.16) + (0.4275 * T * W0.16)

Where T = temperature and W = wind speed in mph, based on this instructional sheet.

Over the last few days I’ve tried numerous combinations of statements to convert the wind speed but without success.

I found this, but it doesn’t really seem to directly apply.

This is the template I’m trying to use:

value_template: >
          {% set T = states('sensor.openweathermap_temperature') | float %}
          {% set W = states('sensor.openweathermap_wind_speed') | float * (10**0.16) %}
          {{ (35.74 + (0.6215 * T) - (35.75 * W) + (0.4275 * T * W)) | round(2) }}

I know I’m missing something simple, I just need a different set of eyes to point it out.

I appreciate any help you can offer!

        value_template: >
          {% set T = states('sensor.openweathermap_temperature') | float(0) %}
          {% set W = states('sensor.openweathermap_wind_speed') | float(0) %}
          {{ (35.74 + (0.6215 * T) - (35.75 * W**0.16) + (0.4275 * T * W**0.16)) | round(2) }}

That works! I didn’t realize the exponent needed to be in the formula rather than the declaration.

THANK YOU!

1 Like