Skip to content

Instantly share code, notes, and snippets.

@simonjodet
Last active January 9, 2022 11:37
Show Gist options
  • Save simonjodet/4bf7ee134a26778c521a39498829900e to your computer and use it in GitHub Desktop.
Save simonjodet/4bf7ee134a26778c521a39498829900e to your computer and use it in GitHub Desktop.
blueprint:
name: Thermostat TPI
description: Thermostat TPI (Time Propertional & Integral)
domain: automation
input:
coeff_c:
name: Coefficient C
description: coefficient multiplicateur de la différence entre la consigne et la température intérieure pour le calcul de la puissance (0.6 conseillé)
selector:
number:
min: 0.0
max: 1.0
step: 0.01
coeff_t:
name: Coefficient T
description: coefficient multiplicateur de la différence entre la consigne et éa température extérieure pour le calcul de la puissance (0.01 conseillé)
selector:
number:
min: 0.0
max: 0.1
step: 0.001
entity_consigne:
name: Consigne
description: Champs d'entrée de la température de consigne (input number).
selector:
entity:
domain: input_number
entity_temp_ext:
name: Température extérieure
description: Sonde de mesure de la température extérieure (sensor)
selector:
entity:
domain: sensor
device_class: temperature
entity_temp_int:
name: Température intérieure
description: Sonde de mesure de la température intérieure (sensor)
selector:
entity:
domain: sensor
device_class: temperature
entity_puissance:
name: Puissance
description: Champs d'affichage de la puissance (input_number)
selector:
entity:
domain: input_number
entity_chauffage:
name: Chauffage
description: Interrupteur marche / arrêt du chauffage (switch)
selector:
entity:
domain: switch
# Récupération des paramètres
variables:
coeff_c: !input coeff_c
coeff_t: !input coeff_t
entity_temp_int: !input entity_temp_int
entity_temp_ext: !input entity_temp_ext
trigger:
- platform: time_pattern
minutes: "/10"
- platform: state
entity_id: !input entity_consigne
action:
- alias: récupération des données
variables:
entity_consigne: !input entity_consigne
consigne: "{{states(entity_consigne)}}"
temp_ext: '{{ states(entity_temp_ext) }}'
temp_int: '{{ states(entity_temp_int) }}'
puissance: >-
{%set val = coeff_c * (consigne - temp_int) + coeff_t * (consigne -
temp_ext) %} {% if val > 1 %} {% set val = 100 %} {% elif val < 0 %} {% set val = 0 %} {% else %} {% set val = ( (val *
100) | round(0)) %} {% endif %} {{val}}
temps_chauffe: '{{ puissance * 6 }}'
- alias: Met à jour l'indicateur de puissance
service: input_number.set_value
target:
entity_id: !input entity_puissance
data:
value: '{{puissance}}'
- choose:
- conditions:
- condition: template
value_template: '{{puissance == 0}}'
sequence:
- service: switch.turn_off
target:
entity_id: !input entity_chauffage
- conditions:
- condition: template
value_template: '{{ puissance > 99}}'
sequence:
- service: switch.turn_on
target:
entity_id: !input entity_chauffage
default:
- service: switch.turn_on
target:
entity_id: !input entity_chauffage
- delay: '{{temps_chauffe}}'
- service: switch.turn_off
target:
entity_id: !input entity_chauffage
mode: restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment