Skip to content

Instantly share code, notes, and snippets.

@c4software
Created November 1, 2022 10:54
Show Gist options
  • Save c4software/4f192a2223ae939a69168246a39e2448 to your computer and use it in GitHub Desktop.
Save c4software/4f192a2223ae939a69168246a39e2448 to your computer and use it in GitHub Desktop.
Home Assistant - Calcul de la température ressentie
- platform: template
sensors:
salon_temperature_ressentie:
friendly_name: 'Ressenti T° Salon'
value_template: >-
{% set T = ((states.sensor.netatmo_maison_salon_temperature.state|float)*1.8)+32 %}
{% set RH = states.sensor.netatmo_maison_salon_humidity.state|float %}
{% set STEADMAN_HI = 0.5 * (T + 61.0 + ((T-68.0)*1.2) + (RH*0.094)) %}
{% if STEADMAN_HI >= 80 %}
{% set ROTHFUSZ_HI = -42.379 + 2.04901523*T + 10.14333127*RH - 0.22475541*T*RH - 0.00683783*T*T - 0.05481717*RH*RH + 0.00122874*T*T*RH + 0.00085282*T*RH*RH - 0.00000199*T*T*RH*RH %}
{% set HI = ROTHFUSZ_HI %}
{% if RH < 13 and 80 < T < 112 %}
{% set ADJUSTMENT = ((13-RH)/4)*((17-(T-95)|abs)/17)**0.5 %}
{% set HI = HI - ADJUSTMENT %}
{% elif RH > 85 and 80 < T < 87 %}
{% set ADJUSTMENT = ((RH-85)/10) * ((87-T)/5) %}
{% set HI = HI + ADJUSTMENT %}
{% endif %}
{% else %}
{% set HI = STEADMAN_HI %}
{% endif %}
{% set HI_C = (HI-32)/1.8 %}
{{- HI_C|round(1) -}}
unit_of_measurement: '°C'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment