Hallo zusammen,
Ich teile meine Konfiguration, um die TEMPO-Farbe (EDF-Option) in Node Red abzurufen.
![]()
- Der Knoten « Timestamp » startet einen Fluss um 00:10 Uhr
- Der function-Knoten « generateDate » generiert das Datum des Tages im richtigen Format (dies wird der Parameter der HTTP-Anfrage sein:
const date = new Date();
let day = date.getDate();
let month = date.getMonth() + 1;
let year = date.getFullYear();
let currentDate = `${year}-${month}-${day}`;
msg.query = currentDate;
return msg;
- Der http request-Knoten « Couleur_TEMPO » führt die Anfrage mit der EDF REST-API aus:
https://particulier.edf.fr/services/rest/referentiel/searchTempoStore?dateRelevant={{{query}}}
- Der function-Knoten « convert2msg » extrahiert die relevante Information
var tempo=msg.payload.couleurJourJ;
msg.payload=tempo;
msg.topic="couleur_tempo";
if(tempo==="TEMPO_BLEU")
{
node.status({ fill: "blue", shape: "ring", text: tempo });
}
if (tempo === "TEMPO_BLANC") {
node.status({ fill: "white", shape: "ring", text: tempo });
}
if (tempo === "TEMPO_ROUGE") {
node.status({ fill: "red", shape: "ring", text: tempo });
}
return msg;
Am Ausgang des Flusses erhalten wir ein Ergebnis TEMPO_BLEU, TEMPO_BLANC oder TEMPO_ROUGE, das Sie nach Belieben verwenden können.
