# Mini tutorial to get EDF Tempo value (+# BBR days) in Gladys via Node-red with Telegram-send scene

**URL:** <https://community.gladysassistant.com/t/mini-tuto-pour-avoir-la-valeur-tempo-edf-nb-jour-bbr-dans-gladys-via-node-red-avec-scene-envoi-telegram/8475>\
**Category:** Tutoriels\
**Tags:** tempo-edf\
**Created:** [November 11, 2023, 2:01am UTC](https://community.gladysassistant.com/t/mini-tuto-pour-avoir-la-valeur-tempo-edf-nb-jour-bbr-dans-gladys-via-node-red-avec-scene-envoi-telegram/8475 "2023-11-11T02:01:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cce66](https://gladys-assistant-community.b-cdn.net/letter_avatar_proxy/v4/letter/c/8797f3/32.png) [@cce66](https://community.gladysassistant.com/u/cce66)\
**Post date:** [November 11, 2023, 2:01am UTC](https://community.gladysassistant.com/t/mini-tuto-pour-avoir-la-valeur-tempo-edf-nb-jour-bbr-dans-gladys-via-node-red-avec-scene-envoi-telegram/8475/1 "2023-11-11T02:01:47Z")

</div>

Create a virtual device as follows in Gladys in the MQTT integration

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/3/3e2a046ea82654c202ecac7a4560eb0642d64e6a.png)

With the following features

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/a/a957189ecccd78978d11cb3a15e0b1abe7997ecd.png)

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/0/090b940e1e61bd1a3d12fee188b1a444b958f07c.png)

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/b/bf7b9000bb179b3e08a540363f740d164df2ad13.png)

Import this flow into node-red

[details=«&nbsp;Flow Code&nbsp;»]

````auto
[
    {
        "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;",  
«&nbsp;outputs&nbsp;»: 1,  
«&nbsp;timeout&nbsp;»: 0,  
«&nbsp;noerr&nbsp;»: 0,  
«&nbsp;initialize&nbsp;»: «&nbsp;&nbsp;»,  
«&nbsp;finalize&nbsp;»: «&nbsp;&nbsp;»,  
«&nbsp;libs&nbsp;»: ,  
«&nbsp;x&nbsp;»: 510,  
«&nbsp;y&nbsp;»: 420,  
«&nbsp;wires&nbsp;»: [  
[  
«&nbsp;25f4c2d57f2b9c3d&nbsp;»,  
«&nbsp;6d3c60cbfc8197ad&nbsp;»  
]  
]  
},  
{  
«&nbsp;id&nbsp;»: «&nbsp;6c60d01b69c8beda&nbsp;»,  
«&nbsp;type&nbsp;»: «&nbsp;function&nbsp;»,  
«&nbsp;z&nbsp;»: «&nbsp;2b792c822e8e46f1&nbsp;»,  
«&nbsp;g&nbsp;»: «&nbsp;02e46bae52d39d3b&nbsp;»,  
«&nbsp;name&nbsp;»: «&nbsp;Send TEMPO PARAM\_NB\_J\_ROUGE&nbsp;»,  
«&nbsp;func&nbsp;»: "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;",  
«&nbsp;outputs&nbsp;»: 1,  
«&nbsp;timeout&nbsp;»: 0,  
«&nbsp;noerr&nbsp;»: 0,  
«&nbsp;initialize&nbsp;»: «&nbsp;&nbsp;»,  
«&nbsp;finalize&nbsp;»: «&nbsp;&nbsp;»,  
«&nbsp;libs&nbsp;»: ,  
«&nbsp;x&nbsp;»: 520,  
«&nbsp;y&nbsp;»: 540,  
«&nbsp;wires&nbsp;»: [  
[  
«&nbsp;25f4c2d57f2b9c3d&nbsp;»,  
«&nbsp;6d3c60cbfc8197ad&nbsp;»  
]  
]  
},  
{  
«&nbsp;id&nbsp;»: «&nbsp;f4ab211ed11dc81c&nbsp;»,  
«&nbsp;type&nbsp;»: «&nbsp;mqtt-broker&nbsp;»,  
«&nbsp;name&nbsp;»: «&nbsp;192.168.0.125:1883&nbsp;»,  
«&nbsp;broker&nbsp;»: «&nbsp;192.168.0.125&nbsp;»,  
«&nbsp;port&nbsp;»: «&nbsp;1883&nbsp;»,  
«&nbsp;clientid&nbsp;»: «&nbsp;&nbsp;»,  
«&nbsp;autoConnect&nbsp;»: true,  
«&nbsp;usetls&nbsp;»: false,  
«&nbsp;protocolVersion&nbsp;»: «&nbsp;4&nbsp;»,  
«&nbsp;keepalive&nbsp;»: «&nbsp;60&nbsp;»,  
«&nbsp;cleansession&nbsp;»: true,  
«&nbsp;autoUnsubscribe&nbsp;»: true,  
«&nbsp;birthTopic&nbsp;»: «&nbsp;&nbsp;»,  
«&nbsp;birthQos&nbsp;»: «&nbsp;0&nbsp;»,  
«&nbsp;birthPayload&nbsp;»: «&nbsp;&nbsp;»,  
«&nbsp;birthMsg&nbsp;»: {},  
«&nbsp;closeTopic&nbsp;»: «&nbsp;&nbsp;»,  
«&nbsp;closeQos&nbsp;»: «&nbsp;0&nbsp;»,  
«&nbsp;closePayload&nbsp;»: «&nbsp;&nbsp;»,  
«&nbsp;closeMsg&nbsp;»: {},  
«&nbsp;willTopic&nbsp;»: «&nbsp;&nbsp;»,  
«&nbsp;willQos&nbsp;»: «&nbsp;0&nbsp;»,  
«&nbsp;willPayload&nbsp;»: «&nbsp;&nbsp;»,  
«&nbsp;willMsg&nbsp;»: {},  
«&nbsp;userProps&nbsp;»: «&nbsp;&nbsp;»,  
«&nbsp;sessionExpiry&nbsp;»: «&nbsp;&nbsp;»  
}  
]

```auto
[/details]

(inspired from https://community.gladysassistant.com/t/couleur-edf-tempo-dans-node-red/7645)

You should now have this in Node-red

![image|690x360](upload://rBxk3JVvUyF3pqDcy8f8oMpmN4o.png)

Adjust the MQTT broker parameters to your settings

![image|456x338, 75%](upload://sA1pEOoofSox9NKHjxN1PWjH8n1.png)

![image|573x292, 75%](upload://erTRv4ahwkD04aMWIVrd79Vbjvf.png)

Create in the Gladys dashboard

![image|263x500](upload://aJuuCDDHn9D89cEshFDxq6EvfFu.png)

Now the TEMPO EDF is displayed in your dashboard.

![image|321x407](upload://72EnNuK9b0LRswPQLJh6ZZBw9wk.png)

 **To send the Tempo color via Telegram with a scene**

You can create a scene

![image|238x306, 75%](upload://4XF5aAM6zfVs9kwSH1tnDT2dTiD.png)

![image|358x500](upload://sTQjJmadbpcFhslH11LllU2EP3p.png)

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

![image|690x263](upload://npJsjgfii4HBemOlLhmR2SrnGId.png)

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

![image|394x27, 75%](upload://kkR6HhUpkxPiDUTwWdFkm3upKZl.png)

```

// Change the output payload based on the payload sent by EDF  
if (tempo === «&nbsp;TEMPO\_BLEU&nbsp;») {  
msg.payload = 1;  
node.status({ fill: «&nbsp;blue&nbsp;», shape: «&nbsp;ring&nbsp;», text: tempo });  
}  
if (tempo === «&nbsp;TEMPO\_BLANC&nbsp;») {  
msg.payload = 2;  
node.status({ fill: «&nbsp;white&nbsp;», shape: «&nbsp;ring&nbsp;», text: tempo });  
}

if (tempo === «&nbsp;TEMPO\_ROUGE&nbsp;») {  
msg.payload = 3;  
node.status({ fill: «&nbsp;red&nbsp;», shape: «&nbsp;ring&nbsp;», text: tempo });  
}

if (tempo === «&nbsp;NON\_DEFINI&nbsp;») {  
msg.payload = 4;  
node.status({ fill: «&nbsp;grey&nbsp;», shape: «&nbsp;ring&nbsp;», text: tempo });  
}

```auto
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.)
```
