Create JAG/TI WIndChill sensor

Seems to work for me

{% set temperature = 25 %}

The temperature is {{ temperature }}. 
The calculated value is {{ (13.12 + (0.6215 * temperature ) + 
(0.3965 * ( temperature - 28.676 )) * (temperature * 0.16)) | round(2) }}.
1 Like

yes, works here too.

but when i replace {{temperature}} with {{states.sensor.br_temperature.state}} this is displayed:

Error rendering template: TemplateSyntaxError: expected token ':', got '}'

{{ (13.12 + (0.6215 * {{states.sensor.br_temperature.state}} ) + 
(0.3965 * ({{states.sensor.br_temperature.state}} - 28.676 )) * ({{states.sensor.br_temperature.state}} * 0.16)) | round(2) }}

spot the error…

Remove the {{ }} around the variables.

i tried that:

{{ (13.12 + (0.6215 * states.sensor.br_temperature.state ) + 
(0.3965 * (states.sensor.br_temperature.state - 28.676 )) * (states.sensor.br_temperature.state * 0.16)) | round(2) }}

but then nothing at all is displayed in the result window.

If the state is missing (wrong name, not set, etc) then the variables are evaluates blank.

sure, but it is there:

strange, the state is correct, the math is correct (using your temperature statement ), and yet there’s no result combining the two.

I think that it’s not working because we were missing the conversion 13.12 + (0.6125 * float(states.sensor.br_temperature.state)..... Jinja could be more strict than expected.

BIngo!

Now thesis obviously incorrect (freezing 2 degrees celsius at the moment), but the math is passing, thanks you very very much!

while this has become a template sensor formatting thread, please let me ask you another boggling question:
why does:

- platform: rest
  resource: http://192.168.xxx.xxx/api/dmH4lHTTsBu1gzhEuVkbV52AwSQpojSYxaxM9pQq/sensors/2
  value_template: "{{ as_timestamp(value_json.state.lastupdated) | timestamp_custom ('%H:%M') }}"
  name: 'Update Dimmer switch'

show the time in the desired format: 19

and

    hue_dimmer_switch_1_updated:
      friendly_name: 'Dimmer switch1 update'
      value_template: "{{states.sensor.hue_dimmer_switch_1.attributes.last_updated | timestamp_custom ('%H:%M')}}"

show (no matter what i change in the timestamp formatting, or even delete it):

1022

the latter 2 are the same sensors with either states.sensor.hue_dimmer_switch_1.attributes.last_updated or states.sensor.hue_dimmer_switch_1.last_updated

the timestamp doesn’t work in these sensors?

btw this is better:

"{{ (13.12 + 0.6215*float(states.sensor.br_temperature.state) + 0.3965*float(states.sensor.br_temperature.state) - 28.676) * float(states.sensor.br_wind_gust.state)*0.16) | round(2) }}"

yields: 33

which feels more appropriate right now :wink:

Thanks again! Also learned that the starting and ending () are necessary for the | round(2) to work correctly. Magic.

Have a final solution worked out and also created another formula, the Steadman.

29

both sensors for you to use and adapt as you need to localize:

- platform: template
  sensors:
    jagti_windchill:
      value_template: "{{ (13.12 + 0.6215*float(states.sensor.br_temperature.state) + 
                        0.3965*(float(states.sensor.br_temperature.state) - 28.676) *
                  (float(states.sensor.br_wind_speed.state)*3.6)*0.16) | round(2) }}"
      unit_of_measurement: "°C"
      friendly_name: Jag/Ti WindChill

# Tchill(°C) = 13,12 + 0,6215*Tair + 0.3965*(Tair - 28,676)*S10m0,16
# S10m = windspeed (km/h) at anemometer_height = 10 m, Tair in °C

    steadman_windchill:
      value_template: "{{ (1.41 - 1.162*float(states.sensor.br_wind_speed.state) + 
                        0.98*float(states.sensor.br_temperature.state) + 
                        0.124*float(states.sensor.br_wind_speed.state)**2 +
                        0.0185*float(states.sensor.br_wind_speed.state)*
                        float(states.sensor.br_temperature.state)) | round(2) }}"
      unit_of_measurement: "°C"
      friendly_name: Steadman WindChill

# Tchill(°C) = 1.41 - 1.162*S + 0.98*Tair+0.0124*S2 + 0.0185*S*Tair
# Tair in °C en S= in m/s.
1 Like

I guess that we should add those sensors to the documentation.

For the JAG/TI sensor there is a small typo; iT should be **0.16 (double asterisk).
Anyway thanks for this, very helpfull.

HI,
I was looking for the error but couldn’t find it. Not sure this is the correction needed though? I thought ** meant factorization? According to the documentation it should be multiplication by 0.16?

Cheers,Marius

cool. and indeed, and then be able to use them only pointing to the needed variables, without having to do with the ugly math… :wink: just like the Mold-indicator. Need some Python for that don’t we?

I was talking about adding them as examples to the template sensor docs.

1 Like

sure, if it would be of help to the fellow community, let;s do! (the python sensor would be nice to have though)

added some fun to the sensors, and showing the both entities they are made of also. Might be possible to have these show up as extra_data_template, havent tried yet:

sensor.jagti_windchill:
  extra_badge:
    - entity_id: sensor.br_wind_speed
    - entity_id: sensor.br_temperature
  templates:
    theme: >
      if (entity.state < 0) return 'blue'; else return 'green';

sensor.steadman_windchill:
  extra_badge:
    - entity_id: sensor.br_wind_speed
    - entity_id: sensor.br_temperature
  templates:
    theme: >
      if (entity.state < 0) return 'blue'; else return 'green';

05

According to documentation the 0.16 is an exponent, not a multiplier.

The correct formula according to wikipedia is:
13.12 + 0.6215*T - 11.37*V**0.16 + 0.3965*T*V**0.16

So the template should look something like this:

{{
(13.12 +
0.6215*float(states.sensor.yr_temperature.state) -
11.37*(float(states.sensor.yr_wind_speed.state)*3.6)**0.16 +
0.3965*float(states.sensor.yr_temperature.state)*(float(states.sensor.yr_wind_speed.state)*3.6)**0.16) | round(2)
}}

I’ve tested this against this page, and it seems to give the same values:
http://www.meteobeverwijk.nl/info/windchill.aspx

Note also that the wind chill formula is only valid for temperatures below +10C and wind speed above 3.0 mph (4.8 km/h / 1.34 m/s) so the template should also add some logic operations.

thanks for getting back to this. I have found several formulas of the same Jag/Ti also … Implemented the one you mention for some time now, forgot to mention here.

Depending on the various climatological conditions, the end results differ more. Or less, is is shown today.

I use them all 3 and test for myself before walking the dogs ;=)

- platform: template
  sensors:
    jagti_windchill:
      value_template: "{{ (13.12 + 0.6215*float(states.sensor.br_temperature.state) + 
                        0.3965*(float(states.sensor.br_temperature.state) - 28.676) *
                  (float(states.sensor.br_wind_speed.state)*3.6)**0.16) | round(2) }}"
      unit_of_measurement: "°C"
      friendly_name: Jag/Ti Wchill

# Tchill(°C) = 13,12 + 0,6215*Tair + 0.3965*(Tair - 28,676)*S10m0,16
# S10m = windspeed (km/h) at anemometer_height = 10 m, Tair in °C


    jagti_windchill_2:
      value_template: "{{(13.12 +0.6215*float(states.sensor.br_temperature.state) -
                          11.37*(float(states.sensor.br_wind_speed.state)*3.6)**0.16 +
                       0.3965*float(states.sensor.br_temperature.state)*
                   (float(states.sensor.br_wind_speed.state)*3.6)**0.16) | round(2) }}"
      unit_of_measurement: "°C"
      friendly_name: Jag/Ti Wchill v2

#G  =13,12+0,6215*T-11,37*(W*3,6)^0,16+0,3965*T*(W*3,6)^0,16

#Invoerveld T = Temperatuur in Graden Celsius
#Invoerveld W = Wind in meter / seconde

    steadman_windchill:
      value_template: "{{ (1.41 - 1.162*float(states.sensor.br_wind_speed.state) + 
                        0.98*float(states.sensor.br_temperature.state) + 
                        0.124*float(states.sensor.br_wind_speed.state)**2 +
                        0.0185*float(states.sensor.br_wind_speed.state)*
                        float(states.sensor.br_temperature.state)) | round(2) }}"
      unit_of_measurement: "°C"
      friendly_name: Steadman Wchill
      
# Tchill(°C) = 1.41 - 1.162*S + 0.98*Tair+0.0124*S2 + 0.0185*S*Tair
# Tair in °C en S= in m/s.

10

after testing this for several weeks, and the double Jagti sensor above, i must conclude they are the same, though with ‘old’ and ‘new’ officials calculations…
To lazy to really check, but i will ditch the old one :wink:

Thanks!
Marius