Notification samba backup avec HA

Bonjour,

Mon problème

J’utilise samba backup pour faire mes sauvegardes.

J’utilise nodered pour avoir une notification pour m’indiquer si la sauvegarde a réussi

[{"id":"338e0f49865035c9","type":"group","z":"52381500228e3591","name":"SAUVEGARDE","style":{"stroke":"#bfdbef","fill":"#7fb7df","label":true,"color":"#000000","fill-opacity":"0.3"},"nodes":["57d794349944d074","6b0f242e4b05f05e","3aada53d8d00701c","53333aff084ed151","872a256720d3515e"],"x":94,"y":19,"w":1152,"h":182},{"id":"57d794349944d074","type":"comment","z":"52381500228e3591","d":true,"g":"338e0f49865035c9","name":"Notification des sauvegardes","info":"","x":260,"y":60,"wires":[]},{"id":"6b0f242e4b05f05e","type":"trigger-state","z":"52381500228e3591","d":true,"g":"338e0f49865035c9","name":"Sauvegarde Haos Reussi","server":"64fc7b21.810404","version":4,"inputs":0,"outputs":2,"exposeAsEntityConfig":"","entityId":"sensor.samba_backup","entityIdType":"exact","debugEnabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"SUCCEEDED"},{"targetType":"this_entity","targetValue":"","propertyType":"previous_state","propertyValue":"old_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"RUNNING"}],"customOutputs":[],"outputInitially":false,"stateType":"str","enableInput":false,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"x":530,"y":160,"wires":[["872a256720d3515e"],[]]},{"id":"3aada53d8d00701c","type":"trigger-state","z":"52381500228e3591","d":true,"g":"338e0f49865035c9","name":"Sauvegarde Haos echec","server":"64fc7b21.810404","version":4,"inputs":0,"outputs":2,"exposeAsEntityConfig":"","entityId":"sensor.samba_backup","entityIdType":"exact","debugEnabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"FAILED"},{"targetType":"this_entity","targetValue":"","propertyType":"previous_state","propertyValue":"old_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"RUNNING"}],"customOutputs":[],"outputInitially":false,"stateType":"str","enableInput":false,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"x":530,"y":100,"wires":[["53333aff084ed151"],[]]},{"id":"53333aff084ed151","type":"api-call-service","z":"52381500228e3591","d":true,"g":"338e0f49865035c9","name":"💽 Sauvegarde Echec ⚠️","server":"64fc7b21.810404","version":5,"debugenabled":false,"domain":"notify","service":"telegram_pascal_ha","areaId":[],"deviceId":[],"entityId":[],"data":"{\t   \"message\":\"💽 Sauvegarde Echec ⚠️\",\t   \"title\":\"\"\t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1080,"y":60,"wires":[[]]},{"id":"872a256720d3515e","type":"api-call-service","z":"52381500228e3591","d":true,"g":"338e0f49865035c9","name":"💽 Sauvegarde reussi ! NR","server":"64fc7b21.810404","version":5,"debugenabled":false,"domain":"notify","service":"telegram_pascal_ha","areaId":[],"deviceId":[],"entityId":[],"data":"{\t   \"message\":\"💽 Sauvegarde reussi ! NR\",\t   \"title\":\"\"\t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1080,"y":140,"wires":[[]]},{"id":"64fc7b21.810404","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]

J’ai essayé de transcrire cet automatisme sur HA. Mais sa ne fonctionne pas.

alias: "notification samba backup "
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.samba_backup
    to: succeeded
    id: samba succes
  - platform: state
    entity_id:
      - sensor.samba_backup
    to: failed
    id: samba fail
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - samba succes
        sequence:
          - service: notify.telegram_pascal_ha
            metadata: {}
            data:
              message: samba backup reussi
      - conditions:
          - condition: trigger
            id:
              - samba fail
        sequence:
          - service: notify.telegram_pascal_ha
            metadata: {}
            data:
              message: samba backup echec
mode: single

Merci pour votre aide

Bonjour,

Tout à l’air bon. C’est quoi l’erreur ?
Tu vois quoi dans l’historique d’exécution ?

Salut, je viens d’essayer en copiant ton automation. Je n’ai eu aucune exécution, mais en mettant SUCCEEDED et FAILED en capital j’ai eu ma notifications. Peux tu essayer ça ?

Pas d’erreur, il se déclenche pas donc pas de notification.

C’est bon, je viens de tester, j’ai bien reçu la notification.
Donc il faut bien mettre en majuscules, pour que Sa fonctionne.

Nikel! :wink: Ça doit être un formatage sensible à la case. Content pour toi :slight_smile:

1 « J'aime »