Create a virtual device as follows in Gladys in the MQTT integration
With the following features
Import this flow into node-red
[details=« Flow Code »]
[
{
"id": "2b792c822e8e46f1",
"type": "tab",
"label": "TEMPO EDF",
"disabled": false,
"info": "",
"env": []
},
{
"id": "42d67acc049f7425",
"type": "group",
"z": "2b792c822e8e46f1",
"name": "TEMPO EDF",
"style": {
"stroke": "#000000",
"fill": "#bfdbef",
"label": true,
"label-position": "n",
"color": "#000000"
},
"nodes": [
"3d684dcab20a9914",
"3645d0bfbb46151e",
"967e5501fcd58cdd",
"71a73d70ed628528",
"e87b67de861c3256",
"50e0c479b04cb23c",
"418c3a4174d195aa",
"e89633a377e594b8",
"0de6bf94f39e7f8b"
],
"x": 74,
"y": 39,
"w": 1052,
"h": 262
},
{
"id": "02e46bae52d39d3b",
"type": "group",
"z": "2b792c822e8e46f1",
"name": "TEMPO EDF - Nb Days White Red Blue",
"style": {
"stroke": "#000000",
"fill": "#bfdbef",
"label": true,
"label-position": "n",
"color": "#000000"
},
"nodes": [
"c930bd12d3f44d91",
"9c8bd280de70d67b",
"590aa4f85a232830",
"6d3c60cbfc8197ad",
"4c96ef17847a98b3",
"25f4c2d57f2b9c3d",
"341b7ddd6a3eb996",
"25b74b7de9880f61",
"6c60d01b69c8beda"
],
"x": 74,
"y": 319,
"w": 1052,
"h": 262
},
{
"id": "3d684dcab20a9914",
"type": "inject",
"z": "2b792c822e8e46f1",
"g": "42d67acc049f7425",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "01 13 * * *",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 190,
"y": 80,
"wires": [
[
"3645d0bfbb46151e"
]
]
},
{
"id": "3645d0bfbb46151e",
"type": "function",
"z": "2b792c822e8e46f1",
"g": "42d67acc049f7425",
"name": "Generate Date ",
"func": "const date = new Date();\n\nlet day = date.getDate();\nlet month = date.getMonth() + 1;\nlet year = date.getFullYear();\n\nlet currentDate = `${year}-${month}-${day}`;\n\nmsg.query = currentDate;\n\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 190,
"y": 140,
"wires": [
[
"967e5501fcd58cdd"
]
]
},
{
"id": "967e5501fcd58cdd",
"type": "http request",
"z": "2b792c822e8e46f1",
"g": "42d67acc049f7425",
"name": "TEMPO Color",
"method": "GET",
"ret": "obj",
"paytoqs": "ignore",
"url": "https://particulier.edf.fr/services/rest/referentiel/searchTempoStore?dateRelevant={{{query}}}",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [],
"x": 210,
"y": 200,
"wires": [
[
"e87b67de861c3256",
"418c3a4174d195aa",
"e89633a377e594b8",
"0de6bf94f39e7f8b"
]
]
},
{
"id": "71a73d70ed628528",
"type": "debug",
"z": "2b792c822e8e46f1",
"g": "42d67acc049f7425",
"name": "debug 2",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 940,
"y": 140,
"wires": []
},
{
"id": "e87b67de861c3256",
"type": "debug",
"z": "2b792c822e8e46f1",
"g": "42d67acc049f7425",
"name": "debug 1",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 420,
"y": 80,
"wires": []
},
{
"id": "50e0c479b04cb23c",
"type": "mqtt out",
"z": "2b792c822e8e46f1",
"g": "42d67acc049f7425",
"name": "Broker Mqtt IP Gladys:1883",
"topic": "",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "f4ab211ed11dc81c",
"x": 980,
"y": 200,
"wires": []
},
{
"id": "418c3a4174d195aa",
"type": "function",
"z": "2b792c822e8e46f1",
"g": "42d67acc049f7425",
"name": "Send TEMPO DAY1 => Gladys:TOMORROW ...",
"func": "var tempo = msg.payload.couleurJourJ1;\n\n// ** Start Block ***********************************************************************************************\n\n// Device names given in Gladys\nvar nomAppareilGladys = \"TEMPO-EDF\"; // device name in Gladys\nvar nomIdAppareilGladys = \"TOMORROW\"; // name of the external ID of the feature\n\n// Topic and Payload values to send to Gladys\n// gladys/master/device/mqtt:\" TEMPO-EDF /feature/mqtt:\" DAY /text\nmsg.topic = \"gladys/master/device/mqtt:\" + nomAppareilGladys + \"/feature/mqtt:\" + nomIdAppareilGladys + \"/text\";\n\n// Change the output payload according to the value of the payload sent by EDF\nif (tempo === \"TEMPO_BLEU\") {\n msg.payload = \"TEMPO BLUE\";\n node.status({ fill: \"blue\", shape: \"ring\", text: tempo });\n}\nif (tempo === \"TEMPO_BLANC\") {\n msg.payload = \"TEMPO WHITE\";\n node.status({ fill: \"white\", shape: \"ring\", text: tempo });\n}\n\nif (tempo === \"TEMPO_ROUGE\") {\n msg.payload = \"TEMPO RED\";\n node.status({ fill: \"red\", shape: \"ring\", text: tempo });\n}\n\nif (tempo === \"NON_DEFINI\") {\n msg.payload = \"NO DEFINED\";\n node.status({ fill: \"grey\", shape: \"ring\", text: tempo });\n}\n\n// ** End Block ************************************************************************************************\n\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 540,
"y": 200,
"wires": [
[
"50e0c479b04cb23c",
"71a73d70ed628528"
]
]
},
{
"id": "e89633a377e594b8",
"type": "function",
"z": "2b792c822e8e46f1",
"g": "42d67acc049f7425",
"name": "Send TEMPO DAY => Gladys:DAY ....",
"func": "var tempo = msg.payload.couleurJourJ;\n\n// ** Start Block ***********************************************************************************************\n\n// Device names given in Gladys\nvar nomAppareilGladys = \"TEMPO-EDF\"; // device name in Gladys\nvar nomIdAppareilGladys = \"DAY\"; // name of the external ID of the feature\n\n// Topic and Payload values to send to Gladys\n// gladys/master/device/mqtt:\" TEMPO-EDF /feature/mqtt:\" DAY /text\nmsg.topic = \"gladys/master/device/mqtt:\" + nomAppareilGladys + \"/feature/mqtt:\" + nomIdAppareilGladys + \"/text\";\n\n// Change the output payload according to the value of the payload sent by EDF\nif (tempo === \"TEMPO_BLEU\") {\n msg.payload = \"TEMPO BLUE\";\n node.status({ fill: \"blue\", shape: \"ring\", text: tempo });\n}\nif (tempo === \"TEMPO_BLANC\") {\n msg.payload = \"TEMPO WHITE\";\n node.status({ fill: \"white\", shape: \"ring\" },
"func": "var nbJour = msg.payload.PARAM_NB_J_BLEU;\n\n// ** Start Block ***********************************************************************************************\n\n// Device names given in Gladys\nvar nomAppareilGladys = \"TEMPO-EDF\"; // device name in Gladys\nvar nomIdAppareilGladys = \"NbJourBleu\"; // name of the external ID of the feature\n\n// Topic and Payload values to send to Gladys\n// gladys/master/device/mqtt:\" TEMPO-EDF /feature/mqtt:\" JOUR /text\nmsg.topic = \"gladys/master/device/mqtt:\" + nomAppareilGladys + \"/feature/mqtt:\" + nomIdAppareilGladys + \"/text\";\n\n// Change the output payload according to the payload sent by EDF\nmsg.payload = nbJour;\nnode.status({ fill: \"blue\", shape: \"ring\", text: nbJour });\n\n// ** End Block ************************************************************************************************\n\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 520,
"y": 540,
"wires": [
[
"25f4c2d57f2b9c3d",
"6d3c60cbfc8197ad"
]
]
},
{
"id": "6c60d01b69c8beda",
"type": "function",
"z": "2b792c822e8e46f1",
"g": "02e46bae52d39d3b",
"name": "Envoi TEMPO PARAM_NB_J_ROUGE",
"func": "var nbJour = msg.payload.PARAM_NB_J_ROUGE;\n\n// ** Début Bloc ***********************************************************************************************\n\n// Nom des appareils donnés dans Gladys\nvar nomAppareilGladys = \"TEMPO-EDF\"; // nom du device dans Gladys\nvar nomIdAppareilGladys = \"NbJourRouge\"; // nom de l'ID externe de la fonctionnalité\n\n// Valeur Topic et Payload à envoyer à Gladys\n// gladys/master/device/mqtt:\" TEMPO-EDF /feature/mqtt:\" JOUR /text\nmsg.topic = \"gladys/master/device/mqtt:\" + nomAppareilGladys + \"/feature/mqtt:\" + nomIdAppareilGladys + \"/text\";\n\n// Change le payload de sortie selon la valeur du payload envoyé par EDF\nmsg.payload = nbJour;\nnode.status({ fill: \"red\", shape: \"ring\", text: nbJour });\n\n// ** Fin Bloc ************************************************************************************************\n\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 520,
"y": 600,
"wires": [
[
"25f4c2d57f2b9c3d",
"6d3c60cbfc8197ad"
]
]
},
{
"id": "50e0c479b04cb23c",
"type": "debug",
"z": "2b792c822e8e46f1",
"g": "02e46bae52d39d3b",
"name": "debug 16",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 980,
"y": 360,
"wires": []
},
{
"id": "71a73d70ed628528",
"type": "debug",
"z": "2b792c822e8e46f1",
"g": "02e46bae52d39d3b",
"name": "debug 17",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 980,
"y": 420,
"wires": []
},
{
"id": "f4ab211ed11dc81c",
"type": "mqtt-broker",
"name": "Broker Mqtt Gladys",
"broker": "192.168.1.10",
"port": "1883",
"clientid": "",
"autoConnect": true,
"usetls": false,
"protocolVersion": "4",
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willPayload": "",
"willMsg": {},
"userProps": "",
"sessionExpiry": "",
"auth": {
"user": "",
"pass": ""
}
}```
[details=From the Gladys Assistant Community]
[quote="alice, post:3, topic:42"]
How do I get started?
[/quote]
We're so glad you're here! Want to run your own Minecraft server? Just click the Get Started button below — it's easy.
[/details]
[details=From the Gladys Assistant Community]
// External feature ID name
// Topic and Payload values to send to Gladys
// gladys/master/device/mqtt:" TEMPO-EDF /feature/mqtt:" DAY /text
msg.topic = "gladys/master/device/mqtt:" + nomAppareilGladys + "/feature/mqtt:" + nomIdAppareilGladys + "/text";
// Change the output payload based on the payload sent by EDF
msg.payload = nbJour;
node.status({ fill: "white", shape: "ring", text: nbJour });
// ** End Block ************************************************************************************************
return msg;",
« outputs »: 1,
« timeout »: 0,
« noerr »: 0,
« initialize »: « »,
« finalize »: « »,
« libs »: ,
« x »: 510,
« y »: 420,
« wires »: [
[
« 25f4c2d57f2b9c3d »,
« 6d3c60cbfc8197ad »
]
]
},
{
« id »: « 6c60d01b69c8beda »,
« type »: « function »,
« z »: « 2b792c822e8e46f1 »,
« g »: « 02e46bae52d39d3b »,
« name »: « Send TEMPO PARAM_NB_J_ROUGE »,
« func »: "var nbJour = msg.payload.PARAM_NB_J_ROUGE;
// ** Start Block ***********************************************************************************************
// Device names given in Gladys
var nomAppareilGladys = "TEMPO-EDF"; // device name in Gladys
var nomIdAppareilGladys = "NbJourRouge"; // external feature ID name
// Topic and Payload values to send to Gladys
// gladys/master/device/mqtt:" TEMPO-EDF /feature/mqtt:" DAY /text
msg.topic = "gladys/master/device/mqtt:" + nomAppareilGladys + "/feature/mqtt:" + nomIdAppareilGladys + "/text";
// Change the output payload based on the payload sent by EDF
msg.payload = nbJour;
node.status({ fill: "white", shape: "ring", text: nbJour });
// ** End Block ************************************************************************************************
return msg;",
« outputs »: 1,
« timeout »: 0,
« noerr »: 0,
« initialize »: « »,
« finalize »: « »,
« libs »: ,
« x »: 520,
« y »: 540,
« wires »: [
[
« 25f4c2d57f2b9c3d »,
« 6d3c60cbfc8197ad »
]
]
},
{
« id »: « f4ab211ed11dc81c »,
« type »: « mqtt-broker »,
« name »: « 192.168.0.125:1883 »,
« broker »: « 192.168.0.125 »,
« port »: « 1883 »,
« clientid »: « »,
« autoConnect »: true,
« usetls »: false,
« protocolVersion »: « 4 »,
« keepalive »: « 60 »,
« cleansession »: true,
« autoUnsubscribe »: true,
« birthTopic »: « »,
« birthQos »: « 0 »,
« birthPayload »: « »,
« birthMsg »: {},
« closeTopic »: « »,
« closeQos »: « 0 »,
« closePayload »: « »,
« closeMsg »: {},
« willTopic »: « »,
« willQos »: « 0 »,
« willPayload »: « »,
« willMsg »: {},
« userProps »: « »,
« sessionExpiry »: « »
}
]
[/details]
(inspired from https://community.gladysassistant.com/t/couleur-edf-tempo-dans-node-red/7645)
You should now have this in Node-red

Adjust the MQTT broker parameters to your settings


Create in the Gladys dashboard

Now the TEMPO EDF is displayed in your dashboard.

**To send the Tempo color via Telegram with a scene**
You can create a scene


Now you can receive TEMPO EDF via TELEGRAM every morning at 8 a.m. :blush:
You can condition the sending based on the color value sent by creating a "Continue only if" action to place before the action to send a message

The colors are indicated in the node code in the payload value

// Change the output payload based on the payload sent by EDF
if (tempo === « TEMPO_BLEU ») {
msg.payload = 1;
node.status({ fill: « blue », shape: « ring », text: tempo });
}
if (tempo === « TEMPO_BLANC ») {
msg.payload = 2;
node.status({ fill: « white », shape: « ring », text: tempo });
}
if (tempo === « TEMPO_ROUGE ») {
msg.payload = 3;
node.status({ fill: « red », shape: « ring », text: tempo });
}
if (tempo === « NON_DEFINI ») {
msg.payload = 4;
node.status({ fill: « grey », shape: « ring », text: tempo });
}
Here's how to make additional savings! :fire:
PS: 03/12/23 update with addition of the number of remaining days in Blue, White, and Red
TEMPO information is retrieved via the inject nodes at 1:01 p.m. (EDF changes them at 1 p.m.)



