Carte pour Thermostat Netatmo

Bonjour,
Je me suis amusé à faire une carte pour mon thermostat Netatmo et j’avais envie qu’elle ressemble à ce que l’on peut voir sur l’espace personnel du site Netatmo.
Je me suis appuyé sur l’intégration Netatmo ainsi que sur la carte « Éléments d’image » qui me semblait la plus adaptée à mon projet.
Je ne suis pas développeur et c’est pour cela que cette carte n’est surement pas la plus optimisée niveau code, mais chacun pourra apporter les modifications nécessaires afin de corriger mes erreurs. :roll_eyes:

Voici donc comment cela se présente :

netatmo

J’ai intégré l’indicateur de chauffe mais aussi un témoin pour les modes: Hors Gel, Absent, Programmation et Manuel.
On trouve également l’indication du niveau de la batterie et le nom du Thermostat qui permet, lorsque l’on clique dessus d’accéder aux réglages avancés du thermostat.
Vous pouvez mettre le nom de votre fournisseur en changeant l’image « Engie » par la votre.
Les boutons « + » et « - » servent à monter ou baisser la température de consigne par pas de 0.5°, mais cette fonction ne donne pas entière satisfaction du fait que le retour d’info du thermostat prend un certain temps.
J’ai créer six sensors:

Les Sensors
- platform: template
  sensors:
    netatmo_temperature_courante:
# Remplacer "entree"  par le nom de votre thermostat
      friendly_name: Température Entrée
      device_class: temperature
# Remplacer "entree"  par le nom de votre thermostat
      value_template: "{{ state_attr('climate.netatmo_entree', 'current_temperature') }}"

    netatmo_temperature_consigne:
# Remplacer "entree"  par le nom de votre thermostat
      friendly_name: température consigne Entrée
      device_class: temperature
# Remplacer "entree"  par le nom de votre thermostat
      value_template: "{{ state_attr('climate.netatmo_entree', 'temperature') }}"

    netatmo_niveau_batterie:
# Remplacer "entree"  par le nom de votre thermostat
      friendly_name: Niveau Batterie Entrée
      device_class: battery
      unit_of_measurement: "%"
# Remplacer "entree"  par le nom de votre thermostat
      value_template: "{{ state_attr('climate.netatmo_entree', 'battery_level') }}"

    netatmo_hvac_action:
# Remplacer "entree"  par le nom de votre thermostat
      friendly_name: Hvac action Entrée
# Remplacer "entree"  par le nom de votre thermostat
      value_template: "{{ state_attr('climate.netatmo_entree', 'hvac_action') }}"

    netatmo_hvac_modes:
# Remplacer "entree"  par le nom de votre thermostat
      friendly_name: Hvac modes Entrée
# Remplacer "entree"  par le nom de votre thermostat
      value_template: "{{ state_attr('climate.netatmo_entree', 'hvac_modes') }}"

    netatmo_preset_mode:
# Remplacer "entree"  par le nom de votre thermostat
      friendly_name: Preset mode Entrée
# Remplacer "entree"  par le nom de votre thermostat
      value_template: "{{ state_attr('climate.netatmo_entree', 'preset_mode') }}"

 

J’ai également eu besoin de 2 scripts pour les boutons « + » et « - »

Pour trouver le device id vous devez vous rendre dans configuration/appareils/ puis cliquer sur votre thermostat netatmo, le device id correspond au dernier chiffre dans la barre d’adresse de votre navigateur internet.
Capture d’écran 2021-12-04 094259

Les scripts
netatmo_increment_consigne:
  alias: netatmo_increment_consigne
  sequence:
  - service: climate.set_temperature
    target:
      device_id: 5e9dcba177a540fd9e89c5cc9e9ecce0
    data:
      temperature: '{{(states.sensor.netatmo_temperature_consigne.state | float +
        0.5)}}'
  mode: single
netatmo_decrement_consigne:
  alias: netatmo_decrement_consigne
  sequence:
  - service: climate.set_temperature
    target:
      device_id: 5e9dcba177a540fd9e89c5cc9e9ecce0
    data:
      temperature: '{{(states.sensor.netatmo_temperature_consigne.state | float -
        0.5)}}'
  mode: single

il ne reste plus que les 9 images à déposer dans le dossier « netatmo » qui sera créer dans le dossier « www ».
Pour cela vous faites un clic droit sur l’image puis enregistrer l’image sous…

Engie.png
Engie3
Netatmo_background_409x762_2.png
Netatmo_background_409x762_2
Netatmo_chauffe.png
Netatmo_chauffe
Netatmo_down.png
Netatmo_down
Netatmo_manual.png
Netatmo_manual
Netatmo_up.png
Netatmo_up
Absent.png
Absent
Automatique.png
Automatique
Hors Gel.png
Hors Gel

Pour finir voici le code de la carte:

Le code de la carte
type: picture-elements
image: /local/netatmo/Netatmo_background_409x762_2.png
elements:
  - type: image
    entity: climate.netatmo_entree
    image: /local/netatmo/Engie.png
    title: null
    tap_action:
      action: none
    style:
      top: 10%
      left: 90%
      width: 10%
  - type: image
    entity: climate.netatmo_entree
    title: Up Consigne
    tap_action:
      action: call-service
      service: Script.netatmo_increment_consigne
    hold_action:
      action: more-info
    image: /local/netatmo/Netatmo_up.png
    style:
      top: 52.6%
      left: 76.5%
      width: 6%
  - type: image
    entity: climate.netatmo_entree
    title: Down Consigne
    tap_action:
      action: call-service
      service: Script.netatmo_decrement_consigne
    hold_action:
      action: more-info
    image: /local/netatmo/Netatmo_down.png
    style:
      top: 52.6%
      left: 56.5%
      width: 6%
  - type: image
    entity: sensor.netatmo_hvac_action
    title: Temoin Chauffe
    tap_action:
      action: none
    image: /local/netatmo/Netatmo_chauffe.png
    style:
      top: 58%
      left: 25.5%
      width: 7%
    state_filter:
      heating: brightness(100%) saturate(1)
      idle: opacity(0%)
  - type: image
    entity: sensor.netatmo_preset_mode
    title: Temoin Manual
    tap_action:
      action: none
    image: /local/netatmo/Netatmo_manual.png
    style:
      top: 30%
      left: 39%
      width: 9%
    state_filter:
      manual: brightness(100%) saturate(1)
      Schedule: opacity(0%)
      away: opacity(0%)
      Frost Guard: opacity(0%)
  - type: image
    entity: sensor.netatmo_preset_mode
    title: Temoin Absent
    tap_action:
      action: none
    image: /local/netatmo/Absent.png
    style:
      top: 29.8%
      left: 38.6%
      width: 11%
    state_filter:
      away: brightness(100%) saturate(1)
      Schedule: opacity(0%)
      manual: opacity(0%)
      Frost Guard: opacity(0%)
  - type: image
    entity: sensor.netatmo_preset_mode
    title: Temoin Hors Gel
    tap_action:
      action: none
    image: /local/netatmo/Hors Gel.png
    style:
      top: 29.8%
      left: 38.6%
      width: 11%
    state_filter:
      Frost Guard: brightness(100%) saturate(1)
      Schedule: opacity(0%)
      manual: opacity(0%)
      away: opacity(0%)
  - type: image
    entity: sensor.netatmo_preset_mode
    title: Temoin Automatique
    tap_action:
      action: none
    image: /local/netatmo/Automatique.png
    style:
      top: 29.9%
      left: 39%
      width: 11%
    state_filter:
      Schedule: brightness(100%) saturate(1)
      away: opacity(0%)
      manual: opacity(0%)
      Frost Guard: opacity(0%)
  - type: state-label
    entity: sensor.netatmo_temperature_courante
    unit_of_measurement: .
    style:
      top: 45%
      left: 25.5%
      font-size: 1.5em
      color: black
      font-weight: 600
  - type: state-label
    entity: sensor.netatmo_temperature_consigne
    style:
      top: 25%
      left: 25.5%
      font-size: 1em
      color: white
      font-weight: 600
  - type: state-label
    entity: climate.netatmo_entree
    attribute: friendly_name
    style:
      top: 85%
      left: 25.5%
      font-size: 1.2em
      color: black
      font-weight: 400
  - type: state-label
    entity: sensor.thermostat_entree_battery_percent
    tap_action:
      action: none
    style:
      top: 76%
      left: 88%
      font-size: 0.7em
      color: grey
      font-weight: 600
  - type: state-icon
    entity: sensor.netatmo_niveau_batterie
    title: Niveau Batterie
    icon: mdi:battery-high
    tap_action:
      action: more-info
    style:
      top: 83%
      left: 88%
      '--paper-item-icon-color': grey


- Le 16/12/2021:
Ajout de trois nouveaux indicateurs du mode de fonctionnement,
Absent, Automatique, Hors Gel.
Et modification de la carte pour prendre en compte ces nouveaux indicateurs.
L’indicateur de batterie affiche maintenant correctement le niveau en % grâce au sensor disponible dans l’intégration netatmo.
sensor.thermostat_entree_battery_percent

- Le 28/01/2022:
Correction du code de la carte.
Suite au changement du nom de l’état qui passe de « boost » à « manual », le temoin du mode « manual » ne s’affiche plus.
Pour ceux qui auraient déja installé la carte, vous pouvez juste remplacer « boost » par « manual » dans les state_filter de chaque temoin d’état.
Voici l’exemple du code avant après pour l’état « Absent ».


A la lecture des différents échanges, je me suis dit qu’il serait intéressant de vous partager une évolution de cette carte.
Voici donc un aperçu de cette nouvelle carte.
Carte Netatmo3
Pour réaliser cette carte, je réutilise 90% des éléments de la version initiale.
vous avec donc besoin:

Des images de la première carte, ajoutez dans le même dossier l’image ci-dessous.

bouton_fond-300x98.png
bouton_fond-300x98

Utilisez les même sensors.

Afin de mettre à jour immédiatement les indicateurs de mode de fonctionnement et de température de consigne sans attendre le retour par netatmo, j’utilise le service python_script pour les nouveaux scripts.
ces indicateurs seront ensuite actualisés lors du retour d’info par l’api netatmo.
Procédure d’installation du service python_script:

  • Ajouter cette ligne dans le fichier configuration.yaml.
    python_script:
  • Créer un dossier nommé python_scripts dans le répertoire config
  • Créer un fichier dans le répertoire python_scripts avec le code ci-dessous et le nommer set_state.py
  • Redémarrer Hassio
set_state.py(ne rien changer dans ce fichier)
#==================================================================================================
#  python_scripts/set_state.py 
#==================================================================================================

# https://community.home-assistant.io/t/how-to-manually-set-state-value-of-sensor/43975/8
# voici un script mis à jour qui a été généralisé pour pouvoir définir n'importe quel attribut

#--------------------------------------------------------------------------------------------------
# Set the state or other attributes for the entity specified in the Automation Action
# Définir l'état ou d'autres attributs pour l'entité spécifiée dans l'action d'automatisation
#--------------------------------------------------------------------------------------------------

inputEntity = data.get('entity_id')
if inputEntity is None:
    logger.warning("===== entity_id is required if you want to set something.")
else:    
    inputStateObject = hass.states.get(inputEntity)
    inputState = inputStateObject.state
    inputAttributesObject = inputStateObject.attributes.copy()

    for item in data:
        newAttribute = data.get(item)
        logger.debug("===== item = {0}; value = {1}".format(item,newAttribute))
        if item == 'entity_id':
            continue            # already handled
        elif item == 'state':
            inputState = newAttribute
        else:
            inputAttributesObject[item] = newAttribute
        
    hass.states.set(inputEntity, inputState, inputAttributesObject)
    

    
#--------------------------------------------------------------------------------------------------    
#Avec ce script en place, l'action pourrait être :
#--------------------------------------------------------------------------------------------------


#  action:
#service: python_script.set_state
#data_template:
#  entity_id: Binary_sensor.sensor1
#  state: ON


#    ou bien

#service: python_script.set_state
#data_template:
#  entity_id: sensor.netatmo_temperature_consigne
#  state: '{{(states.sensor.netatmo_temperature_consigne.state | float + 0.5)}}'




#--------------------------------------------------------------------------------------------------
# la bonne façon de passer un argument au script python est la suivante 
# Remarquez que j'ai utilisé service_data : à la place de data_template 
#--------------------------------------------------------------------------------------------------


#type: button
#entity: sensor.irrigation_icon_1
#tap_action:
#  action: call-service
#  service: python_script.hello_world
#  service_data:
#    nombre: jaime



Voici les nouveaux scripts (5):
copier ces lignes de code dans le fichier /config/scripts.yaml,
Attention, si vous créez ces scripts via l’interface UI cela risque de ne pas fonctionner du fait que le script aura un id avec un numéro et pas le nom de l’alias.

nouveaux scripts(Changer le entity_id: dans ce fichier)
netatmo_increment_consigne:
  alias: netatmo_increment_consigne
  sequence:
  - service: climate.set_temperature
    data:
      temperature: '{{(states.sensor.netatmo_temperature_consigne.state | float +
        0.5)}}'
    target:
# Remplacer "netatmo_entree"  par le nom de votre thermostat
      entity_id: climate.netatmo_entree
  - service: python_script.set_state
    data_template:
      entity_id: sensor.netatmo_temperature_consigne
      state: '{{(states.sensor.netatmo_temperature_consigne.state | float + 0.5)}}'
  mode: single
  
netatmo_decrement_consigne:
  alias: netatmo_decrement_consigne
  sequence:
  - service: climate.set_temperature
    data:
      temperature: '{{(states.sensor.netatmo_temperature_consigne.state | float -
        0.5)}}'
    target:
# Remplacer "netatmo_entree"  par le nom de votre thermostat
      entity_id: climate.netatmo_entree
  - service: python_script.set_state
    data_template:
      entity_id: sensor.netatmo_temperature_consigne
      state: '{{(states.sensor.netatmo_temperature_consigne.state | float - 0.5)}}'
  mode: single

netatmo_mode_absent:
  alias: netatmo_mode_absent
  sequence:
  - service: climate.set_preset_mode
    target:
# Remplacer "netatmo_entree"  par le nom de votre thermostat
      entity_id: climate.netatmo_entree
    data:
      preset_mode: away
  - service: python_script.set_state
    data_template:
      entity_id: sensor.netatmo_preset_mode
      state: away
  mode: single
  
netatmo_mode_hors_gel:
  alias: netatmo_mode_hors_gel
  sequence:
  - service: climate.set_preset_mode
    target:
# Remplacer "netatmo_entree"  par le nom de votre thermostat
      entity_id: climate.netatmo_entree
    data:
      preset_mode: Frost Guard
  - service: python_script.set_state
    data_template:
      entity_id: sensor.netatmo_preset_mode
      state: Frost Guard
  mode: single
  
netatmo_mode_schedule:
  alias: netatmo_mode_schedule
  sequence:
  - service: climate.set_preset_mode
    target:
# Remplacer "netatmo_entree"  par le nom de votre thermostat
      entity_id: climate.netatmo_entree
    data:
      preset_mode: Schedule
  - service: python_script.set_state
    data_template:
      entity_id: sensor.netatmo_preset_mode
      state: Schedule
  mode: single

Pour finir voici le code de la carte:
Modifier toutes les lignes qui suivent un commentaire.

Code de la carte
type: picture-elements
image: /local/netatmo/Netatmo_background_409x762_2.png
elements:
  - type: image
# Remplacer "netatmo_entree"  par le nom de votre thermostat
    entity: climate.netatmo_entree
# Vous pouvez remplacer cette image par celle de votre opérateur
    image: /local/netatmo/Engie.png
    title: null
    tap_action:
      action: none
    style:
      top: 10%
      left: 90%
      width: 10%
  - type: image
# Remplacer "netatmo_entree"  par le nom de votre thermostat
    entity: climate.netatmo_entree
    title: Up Consigne
    tap_action:
      action: call-service
      service: Script.netatmo_increment_consigne
    hold_action:
      action: more-info
    image: /local/netatmo/Netatmo_up.png
    style:
      top: 52.6%
      left: 76.5%
      width: 6%
  - type: image
# Remplacer "netatmo_entree"  par le nom de votre thermostat
    entity: climate.netatmo_entree
    title: Down Consigne
    tap_action:
      action: call-service
      service: Script.netatmo_decrement_consigne
    hold_action:
      action: more-info
    image: /local/netatmo/Netatmo_down.png
    style:
      top: 52.6%
      left: 56.5%
      width: 6%
  - type: image
    entity: sensor.netatmo_hvac_action
    title: Temoin Chauffe
    tap_action:
      action: none
    image: /local/netatmo/Netatmo_chauffe.png
    style:
      top: 58%
      left: 25.5%
      width: 7%
    state_filter:
      heating: brightness(100%) saturate(1)
      idle: opacity(0%)
  - type: image
    entity: sensor.netatmo_preset_mode
    title: Temoin Manual
    tap_action:
      action: none
    image: /local/netatmo/Netatmo_manual.png
    style:
      top: 30%
      left: 39%
      width: 9%
    state_filter:
      manual: brightness(100%) saturate(1)
      Schedule: opacity(0%)
      away: opacity(0%)
      Frost Guard: opacity(0%)
  - type: image
    entity: sensor.netatmo_preset_mode
    title: Mode de fonctionnement
    tap_action:
      action: none
    image: /local/netatmo/Absent.png
    style:
      top: 29.8%
      left: 38.6%
      width: 11%
    state_filter:
      away: brightness(100%) saturate(1)
      Schedule: opacity(0%)
      manual: opacity(0%)
      Frost Guard: opacity(0%)
  - type: image
    entity: sensor.netatmo_preset_mode
    title: Mode de fonctionnement
    tap_action:
      action: none
    image: /local/netatmo/Hors Gel.png
    style:
      top: 29.8%
      left: 38.6%
      width: 11%
    state_filter:
      Frost Guard: brightness(100%) saturate(1)
      Schedule: opacity(0%)
      manual: opacity(0%)
      away: opacity(0%)
  - type: image
    entity: sensor.netatmo_preset_mode
    title: Mode de fonctionnement
    tap_action:
      action: none
    image: /local/netatmo/Automatique.png
    style:
      top: 29.9%
      left: 39%
      width: 11%
    state_filter:
      Schedule: brightness(100%) saturate(1)
      away: opacity(0%)
      manual: opacity(0%)
      Frost Guard: opacity(0%)
  - type: state-label
    entity: sensor.netatmo_temperature_courante
    unit_of_measurement: .
    title: Température Actuelle
    tap_action:
      action: null
    style:
      top: 48%
      left: 25.5%
      font-size: 1.6em
      color: black
      font-weight: 600
  - type: state-label
    entity: sensor.netatmo_temperature_consigne
    title: Température de consigne
    tap_action:
      action: null
    style:
      top: 25%
      left: 25.5%
      font-size: 1em
      color: white
      font-weight: 600
  - type: state-label
# Remplacer "netatmo_entree"  par le nom de votre thermostat
    entity: climate.netatmo_entree
    attribute: friendly_name
    style:
      top: 25%
      left: 66%
      font-size: 1.4em
      color: black
      font-weight: 400
  - type: state-label
    entity: sensor.thermostat_entree_battery_percent
    title: '% Batterie'
    tap_action:
      action: none
    style:
      top: 79%
      left: 8.3%
      font-size: 0.7em
      color: grey
      font-weight: 600
  - type: state-icon
    entity: sensor.netatmo_niveau_batterie
    title: Niveau Batterie
    icon: mdi:battery-high
    tap_action:
      action: more-info
    style:
      top: 86%
      left: 8%
      '--paper-item-icon-color': grey
  - type: image
# Remplacer "netatmo_entree"  par le nom de votre thermostat
    entity: climate.netatmo_entree
    title: null
    tap_action:
      action: none
    image: /local/netatmo/bouton_fond-300x98.png
    style:
      top: 83.2%
      left: 71%
      width: 58%
  - type: image
# Remplacer "netatmo_entree"  par le nom de votre thermostat
    entity: climate.netatmo_entree
    title: Passer en Mode Absent
    tap_action:
      action: call-service
      service: Script.netatmo_mode_absent
    image: /local/netatmo/Absent.png
    style:
      top: 83%
      left: 53%
      width: 12%
  - type: image
# Remplacer "netatmo_entree"  par le nom de votre thermostat
    entity: climate.netatmo_entree
    title: Passer en Mode Hors Gel
    tap_action:
      action: call-service
      service: Script.netatmo_mode_hors_gel
    image: /local/netatmo/Hors Gel.png
    style:
      top: 83.2%
      left: 79.5%
      width: 14.5%
  - type: image
# Remplacer "netatmo_entree"  par le nom de votre thermostat
    entity: climate.netatmo_entree
    title: Passer en Mode Automatique
    tap_action:
      action: call-service
      service: Script.netatmo_mode_schedule
    image: /local/netatmo/Automatique.png
    style:
      top: 83.2%
      left: 67%
      width: 10%

Voilà, je pense n’avoir rien oublié
Les problèmes d’attentes de retour d’info par l’api netatmo sont toujours présents, mais ces nouveaux script permettent d’y palier en parti, ce n’est pas la solution idéale je l’avoue mais cela dépanne en attendant mieux.
Bonne bidouille !

- Le 26-10-2022:

Cette carte à beaucoup évolué depuis sa création, aussi je mets à disposition les derniers ajouts ici.
Tout d’abord merci à @Fabien_Jouet pour l’ajout de la gestion du planning, merci aussi à @jerome6994 pour l’ajout du bouton on/off.

Pour ceux qui ont déjà la carte d’installée, voici les 2 otpions récemment crées.

**Gestion du planning :
Ajoutez ces lignes dans votre carte.

Planning Carte
  - type: state-label
    entity: select.netatmo_domicile
    title: Planning
    icon: mdi:calendar
    style:
      top: 85%
      left: 27%
      '--paper-item-icon-color': rgb(68,68,68)

**Bouton on/off :
Ajoutez ces deux photos dans le répertoire « netatmo ».
netatmo-on
netatmo-off

Ajoutez ce script.
Modifier toutes les lignes qui suivent un commentaire.

script on/off
netatmo_on_off:
  alias: Netatmo on/off
  sequence:
  - choose:
    - conditions:
      - condition: state
    # Remplacer "netatmo_entree"  par le nom de votre thermostat
        entity_id: climate.netatmo_entree
        state: 'off'
      sequence:
      - service: climate.turn_on
        data: {}
        target:
    # Remplacer "netatmo_entree"  par le nom de votre thermostat
          entity_id: climate.netatmo_entree
      - service: python_script.set_state
        data_template:
    # Remplacer "netatmo_entree"  par le nom de votre thermostat
          entity_id: climate.netatmo_entree
          state: auto
    default:
    - service: climate.turn_off
      data: {}
      target:
    # Remplacer "netatmo_entree"  par le nom de votre thermostat
        entity_id: climate.netatmo_entree
    - service: python_script.set_state
      data_template:
    # Remplacer "netatmo_entree"  par le nom de votre thermostat
        entity_id: climate.netatmo_entree
        state: 'off'
        temperature: 0
  mode: single

Ajoutez ces lignes dans votre carte.
Modifier toutes les lignes qui suivent un commentaire.

on/off Carte
  - type: image
# Remplacer "netatmo_entree"  par le nom de votre thermostat
    entity: climate.netatmo_entree
    title: On / Off
    style:
      top: 10%
      left: 8%
      width: 07%
    state_image:
      'off': /local/netatmo/netatmo-off.png
      auto: /local/netatmo/netatmo-on.png
    tap_action:
      action: call-service
      service: Script.netatmo_on_off

Pour ceux qui partent de zéro, voici comment faire :

Créez les 3 sensors à partir de ce fichier.

Modifier toutes les lignes qui suivent un commentaire.

Les 3 Sensors
- platform: template
  sensors:
    netatmo_temperature_consigne:
      # Remplacer "Entrée"  par le nom de votre thermostat
      friendly_name: température consigne Entrée
      #device_class: temperature
      #unit_of_measurement: '°C'
     # Remplacer "netatmo_entree"  par le nom de votre thermostat
      value_template: >
        {% set tempcon = state_attr('climate.netatmo_entree', 'temperature') %}
        {% if tempcon == 0 %}
           OFF
        {% else %}
           {{ state_attr('climate.netatmo_entree', 'temperature') }}
        {% endif %}

    netatmo_hvac_action:

      friendly_name: Hvac action Entrée
      # Remplacer "netatmo_entree"  par le nom de votre thermostat
      value_template: "{{ state_attr('climate.netatmo_entree', 'hvac_action') }}"

    netatmo_preset_mode:
      # Remplacer "Entrée"  par le nom de votre thermostat
      friendly_name: Preset mode Entrée
      # Remplacer "netatmo_entree"  par le nom de votre thermostat
      value_template: "{{ state_attr('climate.netatmo_entree', 'preset_mode') }}"


Créez les 6 scripts à partir de ce fichier.

Modifier toutes les lignes qui suivent un commentaire.

Les 6 Scripts

netatmo_increment_consigne:
  alias: netatmo_increment_consigne
  sequence:
  - service: climate.set_temperature
    data:
      temperature: '{{(states.sensor.netatmo_temperature_consigne.state | float +
        0.5)}}'
    target:
    # Remplacer "netatmo_entree"  par le nom de votre thermostat
      entity_id: climate.netatmo_entree
  - service: python_script.set_state
    data_template:
      entity_id: sensor.netatmo_temperature_consigne
      state: '{{(states.sensor.netatmo_temperature_consigne.state | float + 0.5)}}'
  mode: single
  
netatmo_decrement_consigne:
  alias: netatmo_decrement_consigne
  sequence:
  - service: climate.set_temperature
    data:
      temperature: '{{(states.sensor.netatmo_temperature_consigne.state | float -
        0.5)}}'
    target:
    # Remplacer "netatmo_entree"  par le nom de votre thermostat
      entity_id: climate.netatmo_entree
  - service: python_script.set_state
    data_template:
      entity_id: sensor.netatmo_temperature_consigne
      state: '{{(states.sensor.netatmo_temperature_consigne.state | float - 0.5)}}'
  mode: single

netatmo_mode_absent:
  alias: netatmo_mode_absent
  sequence:
  - service: climate.set_preset_mode
    target:
    # Remplacer "netatmo_entree"  par le nom de votre thermostat
      entity_id: climate.netatmo_entree
    data:
      preset_mode: away
  - service: python_script.set_state
    data_template:
      entity_id: sensor.netatmo_preset_mode
      state: away
  mode: single
  
netatmo_mode_hors_gel:
  alias: netatmo_mode_hors_gel
  sequence:
  - service: climate.set_preset_mode
    target:
    # Remplacer "netatmo_entree"  par le nom de votre thermostat
      entity_id: climate.netatmo_entree
    data:
      preset_mode: Frost Guard
  - service: python_script.set_state
    data_template:
      entity_id: sensor.netatmo_preset_mode
      state: Frost Guard
  mode: single
  
netatmo_mode_schedule:
  alias: netatmo_mode_schedule
  sequence:
  - service: climate.set_preset_mode
    target:
    # Remplacer "netatmo_entree"  par le nom de votre thermostat
      entity_id: climate.netatmo_entree
    data:
      preset_mode: Schedule
  - service: python_script.set_state
    data_template:
      entity_id: sensor.netatmo_preset_mode
      state: Schedule
  mode: single

netatmo_on_off:
  alias: Netatmo on/off
  sequence:
  - choose:
    - conditions:
      - condition: state
    # Remplacer "netatmo_entree"  par le nom de votre thermostat
        entity_id: climate.netatmo_entree
        state: 'off'
      sequence:
      - service: climate.turn_on
        data: {}
        target:
    # Remplacer "netatmo_entree"  par le nom de votre thermostat
          entity_id: climate.netatmo_entree
      - service: python_script.set_state
        data_template:
    # Remplacer "netatmo_entree"  par le nom de votre thermostat
          entity_id: climate.netatmo_entree
          state: auto
    default:
    - service: climate.turn_off
      data: {}
      target:
    # Remplacer "netatmo_entree"  par le nom de votre thermostat
        entity_id: climate.netatmo_entree
    - service: python_script.set_state
      data_template:
    # Remplacer "netatmo_entree"  par le nom de votre thermostat
        entity_id: climate.netatmo_entree
        state: 'off'
        temperature: 0
  mode: single

Ajouter le service python_script, en suivant la procédure décrite précédemment.

Copiez les 12 images (voir tableau récap) mises à dispositions précédemment, dans le dossier « netatmo » qui sera créer dans le dossier « www ».

Pour cela vous faites un clic droit sur l’image puis enregistrer l’image sous…

Créez une nouvelle carte avec le code suivant.

Modifier toutes les lignes qui suivent un commentaire.

La Carte
type: picture-elements
image: /local/netatmo/Netatmo_background_409x762_2.png
elements:
  - type: image
# Remplacer "netatmo_entree"  par le nom de votre thermostat  
    entity: climate.netatmo_entree
# Vous pouvez remplacer cette image par celle de votre opérateur    
    image: /local/netatmo/Engie.png
    title: null
    tap_action:
      action: none
    style:
      top: 10%
      left: 90%
      width: 10%
  - type: image
# Remplacer "netatmo_entree"  par le nom de votre thermostat
    entity: climate.netatmo_entree
    title: Up Consigne
    tap_action:
      action: call-service
      service: Script.netatmo_increment_consigne
    hold_action:
      action: more-info
    image: /local/netatmo/Netatmo_up.png
    style:
      top: 52.6%
      left: 76.5%
      width: 6%
  - type: image
# Remplacer "netatmo_entree"  par le nom de votre thermostat
    entity: climate.netatmo_entree
    title: Down Consigne
    tap_action:
      action: call-service
      service: Script.netatmo_decrement_consigne
    hold_action:
      action: more-info
    image: /local/netatmo/Netatmo_down.png
    style:
      top: 52.6%
      left: 56.5%
      width: 6%
  - type: image
    entity: sensor.netatmo_hvac_action
    title: Temoin Chauffe
    tap_action:
      action: none
    image: /local/netatmo/Netatmo_chauffe.png
    style:
      top: 58%
      left: 25.5%
      width: 7%
    state_filter:
      heating: brightness(100%) saturate(1)
      idle: opacity(0%)
  - type: image
    entity: sensor.netatmo_preset_mode
    title: Mode de fonctionnement
    style:
      top: 29.9%
      left: 39%
      width: 11%
    state_image:
      manual: /local/netatmo/Netatmo_manual.png
      Schedule: /local/netatmo/Automatique.png
      away: /local/netatmo/Absent.png
      Frost Guard: /local/netatmo/Hors Gel.png
    tap_action:
      action: none
  - type: state-label
# Remplacer "netatmo_entree"  par le nom de votre thermostat
    entity: climate.netatmo_entree
    attribute: current_temperature
    unit_of_measurement: .
    title: Température Actuelle
    tap_action:
      action: null
    style:
      top: 48%
      left: 25.5%
      font-size: 1.6em
      color: black
      font-weight: 600
  - type: state-label
    entity: sensor.netatmo_temperature_consigne
    title: Température de consigne
    tap_action:
      action: null
    style:
      top: 25%
      left: 25.5%
      font-size: 1em
      color: white
      font-weight: 600
  - type: state-label
# Remplacer "netatmo_entree"  par le nom de votre thermostat
    entity: climate.netatmo_entree
    attribute: friendly_name
    style:
      top: 25%
      left: 66%
      font-size: 1.4em
      color: black
      font-weight: 400
  - type: state-label
# Remplacer "sensor.thermostat_entree_battery_percent"  par le sensor de votre thermostat
    entity: sensor.thermostat_entree_battery_percent
    title: '% Batterie'
    tap_action:
      action: none
    style:
      top: 79%
      left: 8.3%
      font-size: 0.7em
      color: grey
      font-weight: 600
  - type: state-icon
# Remplacer "sensor.thermostat_entree_battery_percent"  par le sensor de votre thermostat
    entity: sensor.thermostat_entree_battery_percent
    title: Niveau Batterie
    icon: mdi:battery-high
    tap_action:
      action: more-info
    style:
      top: 86%
      left: 8%
      '--paper-item-icon-color': grey
  - type: image
# Remplacer "netatmo_entree"  par le nom de votre thermostat
    entity: climate.netatmo_entree
    title: null
    tap_action:
      action: none
    image: /local/netatmo/bouton_fond-300x98.png
    style:
      top: 83.2%
      left: 71%
      width: 58%
  - type: image
# Remplacer "netatmo_entree"  par le nom de votre thermostat
    entity: climate.netatmo_entree
    title: Passer en Mode Absent
    tap_action:
      action: call-service
      service: Script.netatmo_mode_absent
    image: /local/netatmo/Absent.png
    style:
      top: 83%
      left: 53%
      width: 12%
  - type: image
# Remplacer "netatmo_entree"  par le nom de votre thermostat
    entity: climate.netatmo_entree
    title: Passer en Mode Hors Gel
    tap_action:
      action: call-service
      service: Script.netatmo_mode_hors_gel
    image: /local/netatmo/Hors Gel.png
    style:
      top: 83.2%
      left: 79.5%
      width: 14.5%
  - type: image
# Remplacer "netatmo_entree"  par le nom de votre thermostat
    entity: climate.netatmo_entree
    title: Passer en Mode Automatique
    tap_action:
      action: call-service
      service: Script.netatmo_mode_schedule
    image: /local/netatmo/Automatique.png
    style:
      top: 83.2%
      left: 67%
      width: 10%
  - type: state-label
    entity: select.netatmo_domicile
    title: Planning
    icon: mdi:calendar
    style:
      top: 85%
      left: 27%
      '--paper-item-icon-color': rgb(68,68,68)
  - type: image
# Remplacer "netatmo_entree"  par le nom de votre thermostat
    entity: climate.netatmo_entree
    title: On / Off
    style:
      top: 10%
      left: 8%
      width: 07%
    state_image:
      'off': /local/netatmo/netatmo-off.png
      auto: /local/netatmo/netatmo-on.png
    tap_action:
      action: call-service
      service: Script.netatmo_on_off


L’optimisation de cette nouvelle carte a permis de réduire le nombre de sensors.
Voici également un tableau récapitilatif de ce dont nous avons besoin pour cette carte,


et un apperçu de cette nouvelle carte:
Capture d’écran 2022-10-26 113637

Voilà, c’est tout pour l’instant.

Bonne bidouille !

27 « J'aime »

Bonjour, désolé pour la question de débutant j’aimerais savoir où doit-on créé les 3 sensors merci pour l’aide

Bonjour @ Hydci,
Tu peux par exemple créer tes sensors dans le fichier « configuration.yaml » comme cela,

sensor:
   netatmo_niveau_batterie:
     friendly_name: Niveau Batterie Entrée
     device_class: battery
     unit_of_measurement: '%'
     value_template: "{{ state_attr('climate.netatmo_entree', 'battery_level') }}"
     
   netatmo_preset_mode:
     friendly_name: Preset mode Entrée
     value_template: "{{ state_attr('climate.netatmo_entree', 'preset_mode') }}"
     
   netatmo_hvac_action:
     friendly_name: Hvac action Entrée
     value_template: "{{ state_attr('climate.netatmo_entree', 'hvac_action') }}"

pour plus d’info regarde ici:
https://www.home-assistant.io/integrations/sensor/
https://www.home-assistant.io/integrations/template/

1 « J'aime »

Super réalisation , ca mériterai de se retrouver sur HACS pour une installation plus simple !
Bravo

Merci,
J’ai créer cette carte avec le peu de connaissances que je possède en lignes de code aussi tes remarques me font vraiment plaisir.
Concernant HACS, c’est vrais qu’une intégration serait le bienvenue, mais je laisse cela aux professionnelles.

1 « J'aime »

Wahou c’est exactement ce que j’aimerai intégré dans mon HA mais je débute et je ne sais meme pas ou placer les scripts que tu as cité @telenaze, mes premières expériences avec config.yaml ne se sont pas très bien passées, autant en technique je suis mais en dev c’est compliqué. Si a tout hasard tu as un peu de temps a perdre pour m’expliquer … en tout ca le résultat est superbe.

Bonjour @moustik_2k2,
Cela demande un peu de travail pour réaliser cette carte, mais si tu es prêt à t’investir, je peux t’aider à la réaliser.
Le plus simple et pour éviter de polluer ce post, je te propose que l’on fasse cela via messagerie.
@+

1 « J'aime »

Merci @telenaze, je me suis inscrit sur le Discord. Donc à l’occasion on pourrait faire ca la bas du coup ?

Désolé pour ma traduction google en français. Mec, félicitations pour le travail. J’essaie de l’implémenter dans mon assistant domestique, la seule chose que je n’ai pas comprise où vous avez obtenu l’identifiant de l’appareil : (cible :
<device_id : 5e9dcba177a540fd9e89c5cc9e9ecce0) et je n’arrive pas à télécharger les images que vous avez proposées. Aide-moi?

Pour télécharger une image il faut faire un clic droit et enregistrer l’image sous…
Pour l’identifiant j’ai ajouté la procédure pour le trouver.:wink:

wow merci, pour l’id je jure que je n’étais pas là, alors que pour les images j’attendais un coup de main à télécharger :slight_smile: … Merci encore maintenant j’essaye

Compte tenu du magnifique travail effectué par telenaze et de la rapidité avec laquelle il a répondu, je tiens à apporter ma contribution. J’ai des fichiers packege avec tout à l’intérieur. Il suffit de le modifier et de le modifier avec vos capteurs à l’endroit indiqué. Malheureusement ici, il me semble qu’il n’est pas possible d’insérer un fichier zip. Comment puis-je faire?
J’espère qu’il est apprécié. Merci encore.

Bonjour,

J’essaye d’installer la carte pour mon chauffage Netatmo mais dés la création du fichier template, j’obtiens cette erreur.
Invalid config for [sensor.template]: invalid template (TemplateSyntaxError: expected token ',', got 'current_temperature') for dictionary value @ data['sensors']['netatmo_temperature_courante']['value_template']. Got "{{ state_attr('climate.netatmo_salon, 'current_temperature') }}". (See ?, line ?).

Quelqu’un a une idée?

Une erreur de syntaxe … mais sans le code sous les yeux …

  - platform: template
    sensors:
      porte_garage: 
        friendly_name: "Etat de la porte Garage"
        value_template: >-
          {% if is_state('binary_sensor.capteur_porte_de_garage', 'on') and is_state('binary_sensor.capteur_de_porte_de_garage', 'on') %}
            Entreouvert
          {% elif is_state('binary_sensor.capteur_porte_de_garage', 'off') and is_state('binary_sensor.capteur_de_porte_de_garage', 'on') %}
            Ouvert
          {% elif is_state('binary_sensor.capteur_porte_de_garage', 'on') and is_state('binary_sensor.capteur_de_porte_de_garage', 'off') %}
            Fermé
          {% endif %}
        icon_template: >-
          {% if is_state('binary_sensor.capteur_de_porte_de_garage','on') %}
            mdi:garage-open
          {% else %}
            mdi:garage
          {% endif %}
          
      portail: 
        friendly_name: "Etat du portail"
        value_template: >-
          {% if is_state('binary_sensor.capteur_porte_gauche_portail','on') %}
            Ouvert pour les voitures
          {% elif is_state('binary_sensor.capteur_porte_gauche_portail','off') and is_state('binary_sensor.capteur_porte_de_droite_portail', 'on') %}
            Ouvert pour les piétons
          {% else %}
            Fermé
          {% endif %}
        icon_template: >-
          {% if is_state('binary_sensor.capteur_porte_gauche_portail','on') %}
            mdi:gate-open
          {% elif is_state('binary_sensor.capteur_porte_de_droite_portail', 'on') %}
            mdi:gate-open
          {% else %}
            mdi:gate
          {% endif %}
          
      netatmo_temperature_courante:
        friendly_name: "Température Salon"
        device_class: temperature
        unit_of_measurement: "°C"
        value_template: "{{ state_attr('climate.netatmo_salon, 'current_temperature') }}"

      netatmo_temperature_consigne:
        friendly_name: "Température consigne Entrée"
        device_class: temperature
        #unit_of_measurement: '°C'
        value_template: "{{ state_attr('climate.netatmo_salon', 'temperature') }}"

      netatmo_niveau_batterie:
        friendly_name: "Niveau Batterie Entrée"
        device_class: battery
        unit_of_measurement: "%"
        value_template: "{{ state_attr('climate.netatmo_salon', 'battery_level') }}"

      netatmo_hvac_action:
        friendly_name: "Hvac action Entrée"
        #device_class: battery
        #unit_of_measurement: '%'
        value_template: "{{ state_attr('climate.netatmo_salon', 'hvac_action') }}"

      netatmo_hvac_modes:
        friendly_name: "Hvac modes Entrée"
        #device_class: battery
        #unit_of_measurement: '%'
        value_template: "{{ state_attr('climate.netatmo_entree', 'hvac_modes') }}"

      netatmo_preset_mode:
        friendly_name: "Preset mode Entrée"
        #device_class: battery
        #unit_of_measurement: '%'
        value_template: "{{ state_attr('climate.netatmo_entree', 'preset_mode') }}"

Voici mon fichier sensor.yaml global, pour vérifier la syntaxe. Toute la partie « portail » et garage fonctionne bien, seule la partie « Netatmo » crée l’erreur.

Merci

donc sur la première occurrence, si tu comptes le nombre de ', tu vois pas un truc bizarre sur cette ligne ? Indice, c’est toujours paire :wink:

        value_template: "{{ state_attr('climate.netatmo_salon, 'current_temperature') }}"
1 « J'aime »

je ne l’ai vraiment pas vu :sweat:

Oui, c’est courant, mais tu as toutes les infos dans le message d’erreur pour te dire où chercher :

  • value @ data['sensors']['netatmo_temperature_courante'] : l’entitié qui ne va pas
  • invalid template: l’attribut où ça coince
  • expected token ',' : ce qu’il cherche
  • got 'current_temperature' : ce qu’il trouve
1 « J'aime »

Merci Pulpy,

Pour l’explication de texte, j’avais beaucoup de mal à comprendre à quoi correspondait le (les) message(s) d’erreur.

Je ne comprend pas.

J’ai copié les deux scripts donnés plus haut

netatmo_increment_consigne:
  alias: netatmo_increment_consigne
  sequence:
  - service: climate.set_temperature
    target:
      device_id: 5e9dcba177a540fd9e89c5cc9e9ecce0
    data:
      temperature: '{{(states.sensor.netatmo_temperature_consigne.state | float +
        0.5)}}'
  mode: single
netatmo_decrement_consigne:
  alias: netatmo_decrement_consigne
  sequence:
  - service: climate.set_temperature
    target:
      device_id: 5e9dcba177a540fd9e89c5cc9e9ecce0
    data:
      temperature: '{{(states.sensor.netatmo_temperature_consigne.state | float -
        0.5)}}'
  mode: single

et j’ai cette erreur.