Copy an output node value to an other node

Hello

'http request node' output shows me the value of a temperature in 'debug node'.
I would like to use this value to fill in a 'function node' to make this value speak in voice assistant (rhasspy).
How to retrieve the value in 'function node' ?

Hi @9cirrus

There’s a great page in the docs that will explain how to use the debug panel to find the right path to any data item.

Once you have read that, you will realise you can copy the path of any value in the debug side-bar and paste it into the function node (but in a function, everything is inside the object msg e.g. msg.payload)

Can i also recommend watching this playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

Thank you, i saw that but it is not easy to follow video tutorials in English that I master very badly (french). I can express myself through writing but no in video english.

If you have a object in the debug call payload, it can be accessed in a following function node using msg.payload

If you are not sure of the path to the value, in the debug to the right of the object/value you will see some icons when you hover the mouse. These icon allow you to copy value or path (see image). if you cpy path then all you need to do is add msg. to the front

so the path to retain value false is retain so to access in function use msg.retain

I don't know much about node-red either, but I can try to help. If you want to retrieve the temperature value at a function node, you can simply "save" it in a message with a global context, for example global.temperature.

In the function node, simply state that you want to retrieve that data.

See this small flow attached. I don't know if it will help, but I'm trying.

[{"id":"51532a7f.e2ab14","type":"inject","z":"ed8328d3.5fbd88","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Temperature","payload":"10","payloadType":"num","x":100,"y":900,"wires":[["ead8e8f6.f469a8"]]},{"id":"2498f84a.ab6108","type":"inject","z":"ed8328d3.5fbd88","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Temperature","payload":"20","payloadType":"num","x":100,"y":940,"wires":[["ead8e8f6.f469a8"]]},{"id":"ead8e8f6.f469a8","type":"change","z":"ed8328d3.5fbd88","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"temperature","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":900,"wires":[[]]},{"id":"7726a510.6cd6ec","type":"function","z":"ed8328d3.5fbd88","name":"","func":"msg.payload = global.get(\"temperature\");\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":320,"y":1020,"wires":[["50ef2865.2508c8"]]},{"id":"28bfa94f.c9b126","type":"inject","z":"ed8328d3.5fbd88","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":" recover","payload":"","payloadType":"date","x":120,"y":1020,"wires":[["7726a510.6cd6ec"]]},{"id":"50ef2865.2508c8","type":"debug","z":"ed8328d3.5fbd88","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":470,"y":1020,"wires":[]}]

Hi
Thank you.
when I use msg.payload from the node debug this states all the details of the message
I copied the path 'debug node' and paste 'msg.retain' in 'fonction node'.
This works with the voice assistant but I feel like the value doesn’t match.
There’s a weird thing I always hear the same value of 6.8 instead of 9.2 or 9.4.

Fonction node :

msg.payload = {"speech":{"text":"La température du jardin est de " + msg.retain + " degrés celcius "}};
return msg;

payload (path)
9.4 (value)

msg.retain was an example so you could understand how messages work it is in my debug not yours.

post your flow and a copy of the debug output and i will explain using your values and paths.

[
{
"id": "3f38c999.2ce17e",
"type": "tab",
"label": "lecture temperature",
"disabled": false,
"info": ""
},
{
"id": "a64763fb.de18d",
"type": "function",
"z": "3f38c999.2ce17e",
"name": "talking response",
"func": "\n\nmsg.payload = {"speech":{"text":"La température du jardin est de " + msg.payload + " degrés celcius "}};\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 500,
"y": 200,
"wires": [
[
"fd1a77c3.1a1fd"
]
]
},
{
"id": "abcca5b2.59f7b8",
"type": "http request",
"z": "3f38c999.2ce17e",
"name": "",
"method": "GET",
"ret": "txt",
"paytoqs": false,
"url": "https://bfed8dca.dns5.jeedom.com/core/api/jeeApi.php?apikey=InsVgHIpPhhxcLMDkBmXnW4aYfE5EGd5&type=cmd&id=113",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"x": 490,
"y": 80,
"wires": [
[
"577cec79.fa2c34"
]
]
},
{
"id": "577cec79.fa2c34",
"type": "debug",
"z": "3f38c999.2ce17e",
"name": "temperature",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"x": 690,
"y": 80,
"wires":
},
{
"id": "fd1a77c3.1a1fd",
"type": "http response",
"z": "3f38c999.2ce17e",
"name": "",
"statusCode": "",
"headers": {},
"x": 690,
"y": 200,
"wires":
},
{
"id": "e8e66693.b01828",
"type": "link in",
"z": "3f38c999.2ce17e",
"name": "",
"links": [
"827a6443.76a66",
"d0b94694.f4ec7"
],
"x": 235,
"y": 80,
"wires": [
[
"abcca5b2.59f7b8",
"a64763fb.de18d"
]
]
},
{
"id": "9eacce1d.0e7168",
"type": "inject",
"z": "3f38c999.2ce17e",
"name": "",
"topic": "",
"payload": "true",
"payloadType": "bool",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 230,
"y": 160,
"wires": [
[
"abcca5b2.59f7b8"
]
]
}
]

please read How to share code or flow json
Your code has been corrupted by not posting between code/script tags.

Thank you to help me.
I just begin with nodred and your command is it’s too complicated for me.
It is a beginner issue + language problem it is not easy.

[
    {
        "id": "3f38c999.2ce17e",
        "type": "tab",
        "label": "lecture temperature",
        "disabled": false,
        "info": ""
    },
    {
        "id": "a64763fb.de18d",
        "type": "function",
        "z": "3f38c999.2ce17e",
        "name": "talking response",
        "func": "\n\nmsg.payload = {\"speech\":{\"text\":\"La température du jardin est de \" + msg.payload + \" degrés celcius \"}};\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 500,
        "y": 200,
        "wires": [
            [
                "fd1a77c3.1a1fd"
            ]
        ]
    },
    {
        "id": "abcca5b2.59f7b8",
        "type": "http request",
        "z": "3f38c999.2ce17e",
        "name": "",
        "method": "GET",
        "ret": "txt",
        "paytoqs": false,
        "url": "https://bfed8dca.dns5.jeedom.com/core/api/jeeApi.php?apikey=InsVgHIpPhhxcLMDkBmXnW4aYfE5EGd5&type=cmd&id=113",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "",
        "x": 490,
        "y": 80,
        "wires": [
            [
                "577cec79.fa2c34"
            ]
        ]
    },
    {
        "id": "577cec79.fa2c34",
        "type": "debug",
        "z": "3f38c999.2ce17e",
        "name": "temperature",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "x": 690,
        "y": 80,
        "wires": []
    },
    {
        "id": "fd1a77c3.1a1fd",
        "type": "http response",
        "z": "3f38c999.2ce17e",
        "name": "",
        "statusCode": "",
        "headers": {},
        "x": 690,
        "y": 200,
        "wires": []
    },
    {
        "id": "e8e66693.b01828",
        "type": "link in",
        "z": "3f38c999.2ce17e",
        "name": "",
        "links": [
            "827a6443.76a66",
            "d0b94694.f4ec7"
        ],
        "x": 235,
        "y": 80,
        "wires": [
            [
                "abcca5b2.59f7b8",
                "a64763fb.de18d"
            ]
        ]
    },
    {
        "id": "9eacce1d.0e7168",
        "type": "inject",
        "z": "3f38c999.2ce17e",
        "name": "",
        "topic": "",
        "payload": "true",
        "payloadType": "bool",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 230,
        "y": 160,
        "wires": [
            [
                "abcca5b2.59f7b8"
            ]
        ]
    },
    {
        "id": "de9b2e8c.6364d",
        "type": "function",
        "z": "3f38c999.2ce17e",
        "name": "",
        "func": "[{\"id\":\"51532a7f.e2ab14\",\"type\":\"inject\",\"z\":\"ed8328d3.5fbd88\",\"name\":\"\",\"props\":[{\"p\":\"payload\"},{\"p\":\"topic\",\"vt\":\"str\"}],\"repeat\":\"\",\"crontab\":\"\",\"once\":false,\"onceDelay\":0.1,\"topic\":\"Temperature\",\"payload\":\"10\",\"payloadType\":\"num\",\"x\":100,\"y\":900,\"wires\":[[\"ead8e8f6.f469a8\"]]},{\"id\":\"2498f84a.ab6108\",\"type\":\"inject\",\"z\":\"ed8328d3.5fbd88\",\"name\":\"\",\"props\":[{\"p\":\"payload\"},{\"p\":\"topic\",\"vt\":\"str\"}],\"repeat\":\"\",\"crontab\":\"\",\"once\":false,\"onceDelay\":0.1,\"topic\":\"Temperature\",\"payload\":\"20\",\"payloadType\":\"num\",\"x\":100,\"y\":940,\"wires\":[[\"ead8e8f6.f469a8\"]]},{\"id\":\"ead8e8f6.f469a8\",\"type\":\"change\",\"z\":\"ed8328d3.5fbd88\",\"name\":\"\",\"rules\":[{\"t\":\"move\",\"p\":\"payload\",\"pt\":\"msg\",\"to\":\"temperature\",\"tot\":\"global\"}],\"action\":\"\",\"property\":\"\",\"from\":\"\",\"to\":\"\",\"reg\":false,\"x\":370,\"y\":900,\"wires\":[[]]},{\"id\":\"7726a510.6cd6ec\",\"type\":\"function\",\"z\":\"ed8328d3.5fbd88\",\"name\":\"\",\"func\":\"msg.payload = global.get(\\\"temperature\\\");\\n\\nreturn msg;\",\"outputs\":1,\"noerr\":0,\"initialize\":\"\",\"finalize\":\"\",\"x\":320,\"y\":1020,\"wires\":[[\"50ef2865.2508c8\"]]},{\"id\":\"28bfa94f.c9b126\",\"type\":\"inject\",\"z\":\"ed8328d3.5fbd88\",\"name\":\"\",\"props\":[{\"p\":\"payload\"},{\"p\":\"topic\",\"vt\":\"str\"}],\"repeat\":\"\",\"crontab\":\"\",\"once\":false,\"onceDelay\":0.1,\"topic\":\" recover\",\"payload\":\"\",\"payloadType\":\"date\",\"x\":120,\"y\":1020,\"wires\":[[\"7726a510.6cd6ec\"]]},{\"id\":\"50ef2865.2508c8\",\"type\":\"debug\",\"z\":\"ed8328d3.5fbd88\",\"name\":\"\",\"active\":true,\"tosidebar\":true,\"console\":false,\"tostatus\":false,\"complete\":\"false\",\"statusVal\":\"\",\"statusType\":\"auto\",\"x\":470,\"y\":1020,\"wires\":[]}]\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 360,
        "y": 300,
        "wires": [
            []
        ]
    }
]
[{"id":"24ad6235.320a76","type":"inject","z":"f86c5090.9aba78","name":"","props":[{"p":"payload","v":"true","vt":"bool"},{"p":"topic","v":"","vt":"string"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":230,"y":100,"wires":[["d07483dc.8cd34"]]},{"id":"d07483dc.8cd34","type":"http request","z":"f86c5090.9aba78","name":"","method":"GET","ret":"txt","paytoqs":false,"url":"https://bfed8dca.dns5.jeedom.com/core/api/jeeApi.php?apikey=InsVgHIpPhhxcLMDkBmXnW4aYfE5EGd5&type=cmd&id=113","tls":"","persist":false,"proxy":"","authType":"","x":300,"y":160,"wires":[["108d5134.7d30c7"]]},{"id":"108d5134.7d30c7","type":"function","z":"f86c5090.9aba78","name":"talking response","func":"msg.payload = {\n    \"speech\":\n        {\n        \"text\":\"La température du jardin est de \" + \n        msg.payload + \n        \" degrés celcius \"\n        }\n    \n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":520,"y":160,"wires":[["46c50179.8ea6f8"]]},{"id":"46c50179.8ea6f8","type":"debug","z":"f86c5090.9aba78","name":"temperature","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":760,"y":100,"wires":[]}]

An example of passing message.
I see a http response node is there a http in node some where? As this would make it more complicated.

Your flow works with the voice assistant but i had to link the function node with the response http node otherwise the speaker remains mute.
Thanks for your patience this is great of you. :grinning:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.