Envoi de photos à télégram via nodered

Bonjour,

J’essaye d’envoyer des snapshots via nodered vers télégram, mais il y a un souci d’url.
Sur détection, je prend une photo et je recopie l’horodatage pour former le nom. Pas de souci jusque là. Les photos sont bien nommées :

avec le nom défini comme ça (payload = horodatage):

Et dans le noeud que j’envoie au sender de télégram :

var nom = msg.payload;
msg.payload = {
  chatId: XXXXX,
  sentMessageId: XXXXX,
  type: 'photo',
  content: nom
};
return msg;

qui donne ce debug

Et directement au noeud sender, qui lui me donne

Est ce qu’il y a un souci de répertoire ou de droits d’accès pour nodered ?

Merci

Salut

Il faut creuser la doc mais à lire l’erreur le nœud semble attendre une URL http (donc qui commence par https:// ou http://)
Et tu donnes un lien direct ( /local/).

Hello,

Apparemment, c’est du aux mises à jour du package Node-RED :

In recent updates to Node-RED addon package, the file structure has changed. Node-RED (addon) now has its own top level /addon_configs/a0d7b954_nodered/ folder where all the NR configuration lives.

From within NR, file nodes reading and writing to /config/ now actually refer to the new addon_config folder and not the main HA config folder.

From within NR, to read into the HA config folder /config/ you need to call it /homeassistant/ (it is still /config, just known as /homeassistant within addons).

The write access to folders has also changed, with the intention that addon programmes can no longer make changes to the main HA configuration files and directory.

You may well have to experiment with this as you appear to have two flows, one writing and one reading. Clearly they need to point to the same place, wherever that may now be.

Donc pour écrire dans le répertoire local =>
"./local/snapshots/Reolink snapshot - " & payload & ".jpg"

Et pour lire dans le répertoire local =>

"/homeassistant/local/snapshots/Reolink snapshot - " & payload & ".jpg" 

Du coup, ça fonctionne, et je reçois les images :wink:

PS : par contre, je mets un délai d’une seconde entre la capture sur HA et l’envoi vers télégram, le temps que la photo soit enregistrée.

1 « J'aime »

Bonjour,
Je passe par https :

let monnum = global.get('numblc');
let d = new Date();
let hours = d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds();

msg.payload = {
    "type": "photo",
    "chatId": "53xxxxxx86",
    "caption": "Photo Mez à " + hours + " N° " +monnum,
    "content": "https://monnomdedomaine.fr/local/snapshot/snapshot_CameraMezzanine_" + monnum +".jpg"
};
return msg;

Bob