Create "sensor" from two existing ones

Yes here are some of the sensors YR creates.

And as mentioned earlier sensor.weather_temperature and sensor.weather_wind_speed is the ones @rkarlsba is looking for

image

Well, what’s wrong with this?

  • platform: template
    sensors:
    windchill:
    value_template: >-
    “{{ (13.12 + (0.6215 * sensor.weather_temperature)) - (11.37 * (sensor.wind_speed * 3.6) ** 0.16 + (0.3965 * sensor.weather_temperature) ** 0.16) | float }}”

Every sensor you use must be “states.(entit_id).state | float”, e.g. “states.sensor.weather.temperature.state | float”

Doing so however returns a result below zero, so I guess there’s an error in the formula as well.

{{ states.yr.weather_temperature.state | float }}
{{ states.sensor.weather_temperature.state | float }}

Both give me ‘Error rendering template: UndefinedError: ‘None’ has no attribute ‘state’’

…and

For loop example:
{% for state in states.sensor -%}
{%- if loop.first %}The {% elif loop.last %} and the {% else %}, the {% endif -%}
{{ state.name | lower }} is {{state.state_with_unit}}
{%- endfor %}.

Says

For loop example:
The cpu temperature is 44.39 °C, the hygrometer på pi is 21.1 %, the termometer på pi is 27.0 °C, the windchill is unknown, the yr humidity is 84.5 %, the yr precipitation is 0.3 mm, the yr pressure is 1007.2 hPa, the yr symbol is 13, the yr temperature is -2.1 °C and the yr wind speed is 3.7 m/s.

And then
{{ states.sensor.weather_temperature | float }}

Tells me 0.0

Here is a thread about humidity and temp to calculate chill effect Heat Index / Apparent Temperature / Feels Like Temperature

Here is a link that describes both humid chill index and wind chill index http://www.physlink.com/Reference/Weather.cfm

Here is another one with only wind chill index where you can specify units depending on what sensor you are using http://www.calculator.net/wind-chill-calculator.html

Please follow the examples closely before posting.

{{ states.sensor.weather_temperature.state | float }}

It looks like you’re just trying stuff you don’t fully understand. It might be wise to read some of the documentation first.

1 Like

This is based on humidity and temperature from YR

  - platform: template
    sensors:
      chill_index:
        value_template: '{{ (((((((states.sensor.weather_temperature.state|float)*1.8)+32) + 61.0 + (((((states.sensor.weather_temperature.state|float)*1.8)+32)-68.0)*1.2) + ((states.sensor.weather_humidity.state|float)*0.094))*0.5)-32)/1.8)|round(1) }}'

Thanks, but… Technically, it works, but AFAICS the formula is wrong. Compared it with yr, and what’s on their website shows a far lower windchill than this, that is, measured in celsius

Edit: That is, it’s said to be an index - does that mean it should be added to the temperature?

check this:

@Mariusthvdb when i tried your sensors i get error:

“Could not render template Jag/Ti Wchill, the state is unknown.”

doing their job here:

37

maybe you didnt define the sensors this template sensor uses? I use platform Buienradar Buienradar - Home Assistant

1 Like

I had missed one character :stuck_out_tongue:

Now i have both on humidity and wind based on different formulas and a average based on them.

image

Looking good!

Could you please share your code?

Here it is. Using both sensors from YR.no, other sensors and code from @Mariusthvdb Mariusthvdb

  - platform: template
    sensors:
      heat_index_1:
        unit_of_measurement: '°C'
        value_template: '{{ (((((((states.sensor.weather_temperature.state|float)*1.8)+32) + 61.0 + (((((states.sensor.weather_temperature.state|float)*1.8)+32)-68.0)*1.2) + ((states.sensor.weather_humidity.state|float)*0.094))*0.5)-32)/1.8)|round(1) }}'
      jagti_windchill:
        value_template: '{{ (13.12 + 0.6215*float(states.sensor.weather_temperature.state) + 0.3965*(float(states.sensor.weather_temperature.state) - 28.676) *(float(states.sensor.weather_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.weather_temperature.state) -11.37*(float(states.sensor.weather_wind_speed.state)*3.6)**0.16 +0.3965*float(states.sensor.weather_temperature.state)*(float(states.sensor.weather_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.weather_wind_speed.state) + 0.98*float(states.sensor.weather_temperature.state) + 0.124*float(states.sensor.weather_wind_speed.state)**2 +0.0185*float(states.sensor.weather_wind_speed.state)*float(states.sensor.weather_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.
  - platform: min_max
    name: 'Medel_chill_effect'
    type: mean
    entity_ids:
      - sensor.heat_index_1
      - sensor.jagti_windchill
      - sensor.jagti_windchill_2
      - sensor.steadman_windchill
      - sensor.pws_feelslike_c
  - platform: min_max
    name: 'Medel_temp_ute'
    type: mean
    entity_ids:
      - sensor.weather_temperature
      - sensor.pws_temp_c
      - sensor.net_utomhus_temperature
1 Like