Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hectorzin/b69507db0eee7ae66faa03284165c666 to your computer and use it in GitHub Desktop.
Save hectorzin/b69507db0eee7ae66faa03284165c666 to your computer and use it in GitHub Desktop.
Sensores de sensación térmica y de confort
sensor:
- platform: template
sensors:
sensacion_termica:
friendly_name: "Sensación Térmica HACS"
unit_of_measurement: "°C"
value_template: >
{% set T = (states('sensor.termostato_calefaccion') | float * 9 / 5) + 32 %}
{% set RH = states('sensor.termometro_multimedia_humidity') | float %}
{% set simple_HI = 0.5 * (T + 61.0 + ((T-68.0)*1.2) + (RH*0.094)) %}
{% if simple_HI >= 80.0 %}
{% set 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 %}
{% if RH < 13.0 and T >= 80.0 and T <= 112.0 %}
{% set HI = HI - ((13.0 - RH) / 4.0) * ((17.0 - (T - 95.0) | abs) / 17.0) | sqrt %}
{% elif RH > 85.0 and T >= 80.0 and T <= 87.0 %}
{% set HI = HI + ((RH - 85.0) / 10.0) * ((87.0 - T) / 5.0) %}
{% endif %}
{% else %}
{% set HI = simple_HI %}
{% endif %}
{{ ((HI - 32) * 5 / 9) | round(1) }}
confort_termico:
friendly_name: "Confort Térmico"
unit_of_measurement: "°C"
value_template: >
{% set tempInC = states('sensor.termostato_calefaccion') | float %}
{% set humValue = states('sensor.termometro_multimedia_humidity') | float %}
{% set confort = tempInC - (0.55 * (1 - 0.01 * humValue) * (tempInC - 14.5)) %}
{{ confort | round(2) }}
climate:
- platform: climate_template
name: "Aire Acondicionado Salón (Sensación térmica)"
unique_id: aire_acondicionado_salon_sensacion_termica
modes:
- "off"
- "cool"
min_temp: 18
max_temp: 30
precision: 0.5
temp_step: 0.5
hvac_mode_template: "{{ states('climate.aire_acondicionado') }}"
current_temperature_template: "{{ states('sensor.sensacion_termica') }}"
target_temperature_template: "{{ state_attr('climate.aire_acondicionado', 'temperature') | float - (state_attr('climate.aire_acondicionado', 'current_temperature') | float - states('sensor.sensacion_termica') | float) }}"
set_hvac_mode:
- service: climate.set_hvac_mode
target:
entity_id: climate.aire_acondicionado
data:
hvac_mode: "{{ hvac_mode }}"
set_temperature:
- service: climate.set_temperature
target:
entity_id: climate.aire_acondicionado
data:
temperature: "{{ temperature + (state_attr('climate.aire_acondicionado', 'current_temperature') | float - states('sensor.sensacion_termica') | float) }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment