Hello,
J’avais demandé à Claude AI de me faire quelque chose de similaire à Netatmo et voici le résultat pour le dashboard.
Code dashboard
type: vertical-stack
cards:
- type: thermostat
entity: climate.poele_a_granules
name: 🔥 Poêle à Granules
show_current_as_primary: true
features:
- type: climate-hvac-modes
- type: climate-preset-modes
style: dropdown
- type: markdown
content: |
### 📅 Planning Automatique
{% if states('input_select.thermostat_mode') == 'Auto' %}
✅ **Mode Auto activé**
**Mode actuel :** {{ states('sensor.mode_actif') }}
**Température cible :** {{ states('sensor.temperature_cible') }}°C
**Hystérésis :** 🔥 Allumage à {{ states('sensor.temperature_cible') | float - 1 }}°C / 🛑 Arrêt à {{ states('sensor.temperature_cible') | float + 1 }}°C
{% set day = now().weekday() %}
{% set time = now().strftime('%H:%M') %}
{% if day in [0, 2, 5, 6] %}
📆 Aujourd'hui : Confort de 6h15 à 22h
{% elif day in [1, 3, 4] %}
📆 Aujourd'hui : Confort 6h15-8h30 et 16h30-22h
{% endif %}
{% else %}
⚙️ **Mode manuel :** {{ states('input_select.thermostat_mode') }}
**Température cible :** {{ states('sensor.temperature_cible') }}°C
**Hystérésis :** 🔥 Allumage à {{ states('sensor.temperature_cible') | float - 1 }}°C / 🛑 Arrêt à {{ states('sensor.temperature_cible') | float + 1 }}°C
{% endif %}
- type: entities
title: 🎮 Contrôle
show_header_toggle: false
state_color: true
entities:
- entity: input_boolean.thermostat_enable
name: 🔌 Activer le thermostat
- entity: input_select.thermostat_mode
name: 🔧 Mode de fonctionnement
- type: divider
- entity: switch.relais_poele
name: ⚡ État du relais
- type: history-graph
title: 📊 Évolution des températures
hours_to_show: 24
refresh_interval: 0
entities:
- entity: sensor.temperature_salon
name: Température actuelle
- entity: sensor.temperature_cible
name: Cible programmée
- type: entities
title: ⚙️ Réglages des Températures
show_header_toggle: false
state_color: true
entities:
- type: section
label: Modes de chauffage
- entity: input_number.temp_nuit
name: 🌙 Nuit (minuit-6h15 et 22h-minuit)
- entity: input_number.temp_confort
name: 🔥 Confort (selon planning)
- type: section
label: Modes supplémentaires
- entity: input_number.temp_eco
name: 🍃 Éco (manuel uniquement)
- entity: input_number.temp_confort_plus
name: 🔥🔥 Confort+ (manuel uniquement)
- type: section
label: ℹ️ Informations
- type: attribute
entity: sensor.mode_actif
attribute: friendly_name
name: Mode en cours
icon: mdi:information-outline
- type: custom:mushroom-chips-card
chips:
- type: template
content: 🔥 {{ states("sensor.temperature_cible") | float - 1 }}°C
icon: mdi:fire
icon_color: orange
tap_action:
action: none
- type: template
content: 🎯 {{ states("sensor.temperature_cible") }}°C
icon: mdi:target
icon_color: blue
tap_action:
action: none
- type: template
content: 🛑 {{ states("sensor.temperature_cible") | float + 1 }}°C
icon: mdi:stop
icon_color: red
tap_action:
action: none
Il m’a dit aussi de créer un dossier packages dans Config et d’y insérer le fichier thermostat_poele.yaml dont voici le code. Cela créér du coup directement les automatisations dans Automatisations.
thermostat_poele.yaml
#############################################
# THERMOSTAT POÊLE À GRANULES ZIGBEE
# Configuration complète pour Home Assistant
# Cible: 21°C | Allumage: 20°C | Arrêt: 22°C
#############################################
#############################################
# INPUT SELECTS
#############################################
input_select:
thermostat_mode:
name: Mode Thermostat
options:
- Auto
- Nuit
- Éco
- Confort
- Confort+
- "Off"
initial: Auto
icon: mdi:thermostat
#############################################
# INPUT NUMBERS
#############################################
input_number:
temp_nuit:
name: Température Nuit
min: 10
max: 18
step: 0.5
unit_of_measurement: °C
initial: 14
icon: mdi:moon-waning-crescent
temp_eco:
name: Température Éco
min: 8
max: 16
step: 0.5
unit_of_measurement: °C
initial: 10
icon: mdi:leaf
temp_confort:
name: Température Confort
min: 19
max: 24
step: 0.5
unit_of_measurement: °C
initial: 21
icon: mdi:fire
temp_confort_plus:
name: Température Confort+
min: 21
max: 26
step: 0.5
unit_of_measurement: °C
initial: 22
icon: mdi:fire-alert
#############################################
# INPUT BOOLEANS
#############################################
input_boolean:
thermostat_enable:
name: Activer le thermostat
initial: true
icon: mdi:power
#############################################
# SENSORS
#############################################
template:
- sensor:
- name: Température Cible
unique_id: thermostat_target_temp
unit_of_measurement: °C
state: >
{% if states('input_select.thermostat_mode') == 'Off' %}
0
{% elif states('input_select.thermostat_mode') == 'Nuit' %}
{{ states('input_number.temp_nuit') | float }}
{% elif states('input_select.thermostat_mode') == 'Éco' %}
{{ states('input_number.temp_eco') | float }}
{% elif states('input_select.thermostat_mode') == 'Confort' %}
{{ states('input_number.temp_confort') | float }}
{% elif states('input_select.thermostat_mode') == 'Confort+' %}
{{ states('input_number.temp_confort_plus') | float }}
{% elif states('input_select.thermostat_mode') == 'Auto' %}
{% set day = now().weekday() %}
{% set time = now().strftime('%H:%M') %}
{% if day in [0, 2, 5, 6] %}
{% if time >= '06:15' and time < '22:00' %}
{{ states('input_number.temp_confort') | float }}
{% else %}
{{ states('input_number.temp_nuit') | float }}
{% endif %}
{% elif day in [1, 3, 4] %}
{% if time >= '06:15' and time < '08:30' %}
{{ states('input_number.temp_confort') | float }}
{% elif time >= '16:30' and time < '22:00' %}
{{ states('input_number.temp_confort') | float }}
{% else %}
{{ states('input_number.temp_nuit') | float }}
{% endif %}
{% endif %}
{% else %}
0
{% endif %}
- name: Mode Actif
unique_id: thermostat_current_mode
state: >
{% if states('input_select.thermostat_mode') == 'Auto' %}
{% set day = now().weekday() %}
{% set time = now().strftime('%H:%M') %}
{% if day in [0, 2, 5, 6] %}
{% if time >= '06:15' and time < '22:00' %}
Confort
{% else %}
Nuit
{% endif %}
{% elif day in [1, 3, 4] %}
{% if time >= '06:15' and time < '08:30' %}
Confort
{% elif time >= '16:30' and time < '22:00' %}
Confort
{% else %}
Nuit
{% endif %}
{% endif %}
{% else %}
{{ states('input_select.thermostat_mode') }}
{% endif %}
icon: >
{% set mode = this.state %}
{% if mode == 'Nuit' %}
mdi:moon-waning-crescent
{% elif mode == 'Éco' %}
mdi:leaf
{% elif mode == 'Confort' %}
mdi:fire
{% elif mode == 'Confort+' %}
mdi:fire-alert
{% elif mode == 'Off' %}
mdi:power-off
{% else %}
mdi:thermostat-auto
{% endif %}
#############################################
# AUTOMATISATIONS
#############################################
automation:
###########################################
# Gestion automatique allumage/extinction avec hystérésis
###########################################
- id: thermostat_hysteresis_control
alias: Thermostat - Contrôle Hystérésis
mode: single
trigger:
- platform: state
entity_id: sensor.temperature_salon
- platform: state
entity_id: sensor.temperature_cible
- platform: homeassistant
event: start
- platform: state
entity_id: input_boolean.thermostat_enable
to: "on"
- platform: state
entity_id: input_select.thermostat_mode
- platform: time_pattern
minutes: "/5"
condition:
- condition: state
entity_id: input_boolean.thermostat_enable
state: "on"
- condition: template
value_template: "{{ states('sensor.temperature_cible') | float > 0 }}"
action:
- choose:
# Allumer si température < cible - 1°C
- conditions:
- condition: template
value_template: >
{{ states('sensor.temperature_salon') | float < states('sensor.temperature_cible') | float - 1 }}
- condition: state
entity_id: climate.poele_a_granules
state: "off"
sequence:
- service: climate.turn_on
entity_id: climate.poele_a_granules
- service: climate.set_temperature
target:
entity_id: climate.poele_a_granules
data:
temperature: "{{ states('sensor.temperature_cible') | float }}"
# Éteindre si température >= cible + 1°C
- conditions:
- condition: template
value_template: >
{{ states('sensor.temperature_salon') | float >= states('sensor.temperature_cible') | float + 1 }}
- condition: not
conditions:
- condition: state
entity_id: climate.poele_a_granules
state: "off"
sequence:
- service: climate.turn_off
entity_id: climate.poele_a_granules
###########################################
# Sécurité - Désactivation si température trop haute
###########################################
- id: thermostat_safety_high_temp
alias: Thermostat - Sécurité Température Haute
mode: single
trigger:
- platform: numeric_state
entity_id: sensor.temperature_salon
above: 28
action:
- service: climate.turn_off
entity_id: climate.poele_a_granules
###########################################
# Forcer OFF si thermostat désactivé
###########################################
- id: thermostat_force_off
alias: Thermostat - Forcer OFF
mode: single
trigger:
- platform: state
entity_id: input_boolean.thermostat_enable
to: "off"
- platform: state
entity_id: input_select.thermostat_mode
to: "Off"
action:
- service: climate.turn_off
entity_id: climate.poele_a_granules

