Horaire Prière Adhan

Bonjour à tous.

J’essaie de transférer une automatisation qui fonctionne bien vers node red.

automation:
  - id: '1591797596754'
    alias: Adhan
    description: ''
    trigger:
    - platform: template
      value_template: '{{ as_timestamp(strptime(states("sensor.time_date"), "%H:%M,
        %Y-%m-%d")) == as_timestamp(strptime(states("sensor.dhuhr_prayer"), "%Y-%m-%dT%H:%M:%S"))
        }}'
    - platform: template
      value_template: '{{ as_timestamp(strptime(states("sensor.time_date"), "%H:%M,
        %Y-%m-%d")) == as_timestamp(strptime(states("sensor.asr_prayer"), "%Y-%m-%dT%H:%M:%S"))
        }}'
    - platform: template
      value_template: '{{ as_timestamp(strptime(states("sensor.time_date"), "%H:%M,
        %Y-%m-%d")) == as_timestamp(strptime(states("sensor.maghrib_prayer"), "%Y-%m-%dT%H:%M:%S"))
        }}'
    - platform: template
      value_template: '{{ as_timestamp(strptime(states("sensor.time_date"), "%H:%M,
        %Y-%m-%d")) == as_timestamp(strptime(states("sensor.isha_prayer"), "%Y-%m-%dT%H:%M:%S"))
        }}'
    condition: []
    action:
    - data:
        entity_id: media_player.salon
        volume_level: '0.6'
        media_content_id: https://hassio.local/local/sounds/azzan.mp3
        media_content_type: audio/mp3
      entity_id: media_player.salon
      service: media_player.play_media
      
  - id: '1591801395650'
    alias: adhan-Fajr
    description: ''
    trigger:
    - platform: template
      value_template: '{{ as_timestamp(strptime(states("sensor.time_date"), "%H:%M,
        %Y-%m-%d")) == as_timestamp(strptime(states("sensor.fajr_prayer"), "%Y-%m-%dT%H:%M:%S"))
        }}'
    action:
    - data:
        entity_id: media_player.salon
        volume_level: '0.1'
        media_content_id: https://hassio.local/local/sounds/adhan.mp3
        media_content_type: audio/mp3
      entity_id: media_player.salon
      service: media_extractor.play_media

Cette partie fonctionne parfaitement.
Sur node red par contre non.

Ensuite en get template j’ai
{{ states.sensor.fajr_prayer.state == states.sensor.time_date.state }}
Un switch à « true »


Ensuite je set le volume :

Enfin je lance le mp3:

Mais cela ne semble pas fonctionner.
Une idée d’où je me trompe?
J’utilise l’intégration islamic prayer time.

@cob94440

Merci de citer tes sources.

En l’occurrence :

En plus, cela m’a permis de répondre à un utilisateur rencontrant un problème sur le topic source, comme quoi :wink:


Je n’y connais rien à NR, donc je laisse les autres te répondre

Je me répond à moi même, Déjà une erreur dans le lancement du mp3 il faut choisir le service play_media et non media_play.

A voir si le template est correct maintenant

N’oublie pas de le poster lorsque tu l’aura finalisé.

@cob94440, as tu fais des avancées sur le sujet du passage de YAML vers Node-Red ?

Hello,
Oui c 'est fonctionnel avec ce flow :

[{"id":"7f4bcc21.5f9c34","type":"group","z":"b06c2e12.c3f9a","name":"Adhan","style":{"stroke":"#0070c0","fill":"#b797cf","label":true,"color":"#000000"},"nodes":["27f079f9.1f86b6","58b0ba00.bd9654","30c7609f.de724","80cf17d1.f123d8","e73432ae.91075","278e1a81.c28a56","e0ee8440.c8a9e8","27157fc1.c3ef9","31349e21.499a72","7e225537.80c2fc","806ed39f.700f6","50845f7.84706a","5f3ca9b5.55be28","ff5c6ac.7219f98","ce389b3e.157fe8","6d406559.ad6fcc","473857c9.3ab7b8","8886246.d8038d8","506eb640.6cda18","5a648805.aa7ba8","103f417.129a7bf","a4e96a52.58f7c8"],"x":74,"y":619,"w":1092,"h":542},{"id":"27f079f9.1f86b6","type":"inject","z":"b06c2e12.c3f9a","g":"7f4bcc21.5f9c34","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"60","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":190,"y":880,"wires":[["58b0ba00.bd9654","278e1a81.c28a56","e0ee8440.c8a9e8","27157fc1.c3ef9","31349e21.499a72"]]},{"id":"58b0ba00.bd9654","type":"api-render-template","z":"b06c2e12.c3f9a","g":"7f4bcc21.5f9c34","name":"Fajr","server":"7d1bc7dc.dcdfe8","template":"{{ as_timestamp(strptime(states(\"sensor.time_date\"), \"%H:%M, %Y-%m-%d\")) == as_timestamp(strptime(states(\"sensor.fajr_prayer\"), \"%Y-%m-%dT%H:%M:%S\")) }}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":390,"y":660,"wires":[["30c7609f.de724","e73432ae.91075"]]},{"id":"30c7609f.de724","type":"switch","z":"b06c2e12.c3f9a","g":"7f4bcc21.5f9c34","name":"Fajr True","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"True","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":560,"y":660,"wires":[["80cf17d1.f123d8"]]},{"id":"80cf17d1.f123d8","type":"delay","z":"b06c2e12.c3f9a","g":"7f4bcc21.5f9c34","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"10","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":760,"y":660,"wires":[["1783b492.92debb"]]},{"id":"e73432ae.91075","type":"debug","z":"b06c2e12.c3f9a","g":"7f4bcc21.5f9c34","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":570,"y":700,"wires":[]},{"id":"278e1a81.c28a56","type":"api-render-template","z":"b06c2e12.c3f9a","g":"7f4bcc21.5f9c34","name":"Dhuhr","server":"7d1bc7dc.dcdfe8","template":"{{ as_timestamp(strptime(states(\"sensor.time_date\"), \"%H:%M, %Y-%m-%d\")) == as_timestamp(strptime(states(\"sensor.dhuhr_prayer\"), \"%Y-%m-%dT%H:%M:%S\")) }}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":390,"y":760,"wires":[["7e225537.80c2fc","806ed39f.700f6"]]},{"id":"e0ee8440.c8a9e8","type":"api-render-template","z":"b06c2e12.c3f9a","g":"7f4bcc21.5f9c34","name":"Asr","server":"7d1bc7dc.dcdfe8","template":"{{ as_timestamp(strptime(states(\"sensor.time_date\"), \"%H:%M, %Y-%m-%d\")) == as_timestamp(strptime(states(\"sensor.asr_prayer\"), \"%Y-%m-%dT%H:%M:%S\")) }}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":390,"y":860,"wires":[["50845f7.84706a","5f3ca9b5.55be28"]]},{"id":"27157fc1.c3ef9","type":"api-render-template","z":"b06c2e12.c3f9a","g":"7f4bcc21.5f9c34","name":"Maghrib","server":"7d1bc7dc.dcdfe8","template":"{{ as_timestamp(strptime(states(\"sensor.time_date\"), \"%H:%M, %Y-%m-%d\")) == as_timestamp(strptime(states(\"sensor.maghrib_prayer\"), \"%Y-%m-%dT%H:%M:%S\")) }}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":380,"y":980,"wires":[["ff5c6ac.7219f98","ce389b3e.157fe8"]]},{"id":"31349e21.499a72","type":"api-render-template","z":"b06c2e12.c3f9a","g":"7f4bcc21.5f9c34","name":"Isha","server":"7d1bc7dc.dcdfe8","template":"{{ as_timestamp(strptime(states(\"sensor.time_date\"), \"%H:%M, %Y-%m-%d\")) == as_timestamp(strptime(states(\"sensor.isha_prayer\"), \"%Y-%m-%dT%H:%M:%S\")) }}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":390,"y":1080,"wires":[["6d406559.ad6fcc","473857c9.3ab7b8"]]},{"id":"7e225537.80c2fc","type":"switch","z":"b06c2e12.c3f9a","g":"7f4bcc21.5f9c34","name":"Dhuhr True","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"True","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":570,"y":760,"wires":[["8886246.d8038d8"]]},{"id":"806ed39f.700f6","type":"debug","z":"b06c2e12.c3f9a","g":"7f4bcc21.5f9c34","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":570,"y":800,"wires":[]},{"id":"50845f7.84706a","type":"switch","z":"b06c2e12.c3f9a","g":"7f4bcc21.5f9c34","name":"Asr True","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"True","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":560,"y":860,"wires":[["506eb640.6cda18"]]},{"id":"5f3ca9b5.55be28","type":"debug","z":"b06c2e12.c3f9a","g":"7f4bcc21.5f9c34","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":570,"y":900,"wires":[]},{"id":"ff5c6ac.7219f98","type":"switch","z":"b06c2e12.c3f9a","g":"7f4bcc21.5f9c34","name":"Maghrib True","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"True","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":570,"y":980,"wires":[["5a648805.aa7ba8"]]},{"id":"ce389b3e.157fe8","type":"debug","z":"b06c2e12.c3f9a","g":"7f4bcc21.5f9c34","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":570,"y":1020,"wires":[]},{"id":"6d406559.ad6fcc","type":"switch","z":"b06c2e12.c3f9a","g":"7f4bcc21.5f9c34","name":"Isha True","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"True","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":560,"y":1080,"wires":[["103f417.129a7bf"]]},{"id":"473857c9.3ab7b8","type":"debug","z":"b06c2e12.c3f9a","g":"7f4bcc21.5f9c34","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":570,"y":1120,"wires":[]},{"id":"8886246.d8038d8","type":"delay","z":"b06c2e12.c3f9a","g":"7f4bcc21.5f9c34","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"10","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":760,"y":760,"wires":[["a4e96a52.58f7c8"]]},{"id":"506eb640.6cda18","type":"delay","z":"b06c2e12.c3f9a","g":"7f4bcc21.5f9c34","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"10","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":760,"y":860,"wires":[["a4e96a52.58f7c8"]]},{"id":"5a648805.aa7ba8","type":"delay","z":"b06c2e12.c3f9a","g":"7f4bcc21.5f9c34","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"10","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":760,"y":980,"wires":[["a4e96a52.58f7c8"]]},{"id":"103f417.129a7bf","type":"delay","z":"b06c2e12.c3f9a","g":"7f4bcc21.5f9c34","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"10","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":760,"y":1080,"wires":[["a4e96a52.58f7c8"]]},{"id":"a4e96a52.58f7c8","type":"cast-to-client","z":"b06c2e12.c3f9a","g":"7f4bcc21.5f9c34","name":"","url":"https://hass.myelinenet.ovh/local/sounds/azzan.mp3","contentType":"audio/mp4","message":"","language":"fr","ip":"10.0.0.12","port":"","volume":"25","x":1060,"y":840,"wires":[[]],"icon":"node-red-contrib-cast/google-home1.svg"},{"id":"7d1bc7dc.dcdfe8","type":"server","name":"Home Assistant","legacy":false,"addon":false,"rejectUnauthorizedCerts":false,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]
1 « J'aime »

Le seul souci que je rencontre c’est qu’a chaque démarrage de home assistant il lance la lecture même si les conditions ne sont pas remplies.
Si quelqu’un peut y jeter un oeil

Bonjour à tous. Je relance le sujet car avec la dernière version de ha les node get template sont en erreur. Par quoi les remplacer?
Merci d’avance.