# Get object params value

**URL:** <https://discourse.nodered.org/t/get-object-params-value/62356>\
**Category:** General\
**Tags:** http-request, function-node\
**Created:** [8 May 2022 07:33 UTC](https://discourse.nodered.org/t/get-object-params-value/62356 "2022-05-08T07:33:08Z")\
**Posts on this page:** 9\
**Page:** 2

<div class="post-metadata">

**Author:** ![azxo1](https://avatars.discourse-cdn.com/v4/letter/a/b487fb/32.png) [@azxo1](https://discourse.nodered.org/u/azxo1)\
**Post date:** [8 May 2022 08:33 UTC](https://discourse.nodered.org/t/get-object-params-value/62356/21 "2022-05-08T08:33:13Z")

</div>

When I say an instruction to the google assistant, ("set roomterm thermostat 25"), I get a response in node red. :

```auto
Roomterm : msg.payload : Object
object
command: "action.devices.commands.ThermostatTemperatureSetpoint"
params: object
thermostatTemperatureSetpoint: 18
online: true

```

I want to compare the value (18) of this response with the data from the dht11 thermometer sensor. If it is smaller, it is ON, if it is larger it is OFF

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [8 May 2022 08:37 UTC](https://discourse.nodered.org/t/get-object-params-value/62356/22 "2022-05-08T08:37:17Z")

</div>

That sounds like a typical simple control system with two inputs and one output.  
e.g. dht11 and thermostat and I assume a signal to control a boiler/heater/cooler.

Can you post your flow so we can see what you have created so far ?

---

<div class="post-metadata">

**Author:** ![azxo1](https://avatars.discourse-cdn.com/v4/letter/a/b487fb/32.png) [@azxo1](https://discourse.nodered.org/u/azxo1)\
**Post date:** [8 May 2022 08:38 UTC](https://discourse.nodered.org/t/get-object-params-value/62356/23 "2022-05-08T08:38:46Z")

</div>

```auto
[
    {
        "id": "680004bc8e5431d1",
        "type": "tab",
        "label": "Flow 12",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "5e4c5dbb52e00e21",
        "type": "http request",
        "z": "680004bc8e5431d1",
        "name": "HŐMÉRSÉKLET",
        "method": "GET",
        "ret": "txt",
        "paytoqs": "ignore",
        "url": "http://192.168.5.240/cm?cmnd=cmnd/temp/GlobalTemp",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "basic",
        "senderr": false,
        "x": 510,
        "y": 260,
        "wires": [
            [
                "b3f95ac789145f94"
            ]
        ]
    },
    {
        "id": "49907e55c23a0256",
        "type": "inject",
        "z": "680004bc8e5431d1",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 220,
        "y": 160,
        "wires": [
            [
                "5e4c5dbb52e00e21",
                "ebb9967a342bbcb0"
            ]
        ]
    },
    {
        "id": "b3f95ac789145f94",
        "type": "change",
        "z": "680004bc8e5431d1",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "$substring(payload,14,4)",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 760,
        "y": 260,
        "wires": [
            [
                "47771fc32d80208f",
                "50d6787ab46254f3"
            ]
        ]
    },
    {
        "id": "ebb9967a342bbcb0",
        "type": "http request",
        "z": "680004bc8e5431d1",
        "name": "PÁRATARTALOM",
        "method": "GET",
        "ret": "txt",
        "paytoqs": "ignore",
        "url": "http://192.168.5.240/cm?cmnd=cmnd/temp/GlobalHum",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "basic",
        "senderr": false,
        "x": 510,
        "y": 100,
        "wires": [
            [
                "da9d633199d4fa97"
            ]
        ]
    },
    {
        "id": "da9d633199d4fa97",
        "type": "change",
        "z": "680004bc8e5431d1",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "$substring(payload,13,4)",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1000,
        "y": 100,
        "wires": [
            [
                "cbc09ed8712eaa55",
                "df3861bf43df16b5"
            ]
        ]
    },
    {
        "id": "3ad8f862a2ac967c",
        "type": "ui_gauge",
        "z": "680004bc8e5431d1",
        "name": "",
        "group": "9fd3364b.b2963",
        "order": 1,
        "width": 0,
        "height": 0,
        "gtype": "gage",
        "title": "Hőmérséklet",
        "label": "°C",
        "format": "{{value}}",
        "min": "-20",
        "max": "50",
        "colors": [
            "#00b500",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "",
        "seg2": "",
        "className": "",
        "x": 1230,
        "y": 200,
        "wires": []
    },
    {
        "id": "cbc09ed8712eaa55",
        "type": "ui_gauge",
        "z": "680004bc8e5431d1",
        "name": "",
        "group": "9fd3364b.b2963",
        "order": 3,
        "width": 0,
        "height": 0,
        "gtype": "gage",
        "title": "Páratartalom ",
        "label": "%",
        "format": "{{value}}",
        "min": 0,
        "max": "100",
        "colors": [
            "#00b500",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "",
        "seg2": "",
        "className": "",
        "x": 1230,
        "y": 60,
        "wires": []
    },
    {
        "id": "5c74b25146f681ca",
        "type": "ui_chart",
        "z": "680004bc8e5431d1",
        "name": "",
        "group": "9fd3364b.b2963",
        "order": 2,
        "width": 0,
        "height": 0,
        "label": "Hőmérséklet",
        "chartType": "line",
        "legend": "false",
        "xformat": "auto",
        "interpolate": "linear",
        "nodata": "",
        "dot": true,
        "ymin": "-20",
        "ymax": "50",
        "removeOlder": "3",
        "removeOlderPoints": "",
        "removeOlderUnit": "86400",
        "cutout": 0,
        "useOneColor": false,
        "useUTC": false,
        "colors": [
            "#1f77b4",
            "#aec7e8",
            "#ff7f0e",
            "#2ca02c",
            "#98df8a",
            "#d62728",
            "#ff9896",
            "#9467bd",
            "#c5b0d5"
        ],
        "outputs": 1,
        "useDifferentColor": false,
        "className": "",
        "x": 1230,
        "y": 260,
        "wires": [
            []
        ]
    },
    {
        "id": "df3861bf43df16b5",
        "type": "ui_chart",
        "z": "680004bc8e5431d1",
        "name": "",
        "group": "9fd3364b.b2963",
        "order": 3,
        "width": 0,
        "height": 0,
        "label": "Páratartalom ",
        "chartType": "line",
        "legend": "false",
        "xformat": "auto",
        "interpolate": "linear",
        "nodata": "",
        "dot": false,
        "ymin": "15",
        "ymax": "100",
        "removeOlder": "3",
        "removeOlderPoints": "",
        "removeOlderUnit": "86400",
        "cutout": 0,
        "useOneColor": false,
        "useUTC": false,
        "colors": [
            "#1f77b4",
            "#aec7e8",
            "#ff7f0e",
            "#2ca02c",
            "#98df8a",
            "#d62728",
            "#ff9896",
            "#9467bd",
            "#c5b0d5"
        ],
        "outputs": 1,
        "useDifferentColor": false,
        "className": "",
        "x": 1230,
        "y": 120,
        "wires": [
            []
        ]
    },
    {
        "id": "47771fc32d80208f",
        "type": "change",
        "z": "680004bc8e5431d1",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "$szobatemp := $number(payload) - $number(10)",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1000,
        "y": 260,
        "wires": [
            [
                "51ffc3075efd5824",
                "3ad8f862a2ac967c",
                "5c74b25146f681ca"
            ]
        ]
    },
    {
        "id": "51ffc3075efd5824",
        "type": "debug",
        "z": "680004bc8e5431d1",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1230,
        "y": 320,
        "wires": []
    },
    {
        "id": "50d6787ab46254f3",
        "type": "function",
        "z": "680004bc8e5431d1",
        "name": "",
        "func": "let myValue = msg.payload.params.thermostatTemperatureSetPoint;\n//msg.payload = Number(msg.payload)-10; \nif (Number(msg.payload)-10 < myValue) \n{msg.payload = \"on\";}\nelse {\n {msg.payload = \"off\"}\n}\nreturn [msg, msg.myValue];",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1020,
        "y": 440,
        "wires": [
            [
                "c5910488841ea14b",
                "9b75d20a60b2194f"
            ]
        ]
    },
    {
        "id": "c5910488841ea14b",
        "type": "debug",
        "z": "680004bc8e5431d1",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1230,
        "y": 480,
        "wires": []
    },
    {
        "id": "9b75d20a60b2194f",
        "type": "mqtt out",
        "z": "680004bc8e5431d1",
        "name": "",
        "topic": "cmnd/temper/POWER",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "814b9bd3b9b0f4fd",
        "x": 1260,
        "y": 400,
        "wires": []
    },
    {
        "id": "3fe05a340decb10b",
        "type": "google-home",
        "z": "680004bc8e5431d1",
        "conf": "ea2a8cbe09dae149",
        "device": "20986",
        "acknowledge": false,
        "name": "Roomterm",
        "topic": "Roomterm",
        "x": 420,
        "y": 460,
        "wires": [
            [
                "50d6787ab46254f3",
                "c5910488841ea14b"
            ]
        ]
    },
    {
        "id": "9fd3364b.b2963",
        "type": "ui_group",
        "name": "DHT11",
        "tab": "c8c249f2.8df858",
        "order": 5,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "814b9bd3b9b0f4fd",
        "type": "mqtt-broker",
        "name": "RPI-MQTT",
        "broker": "127.0.0.1",
        "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": {},
        "sessionExpiry": ""
    },
    {
        "id": "ea2a8cbe09dae149",
        "type": "google-home-conf",
        "username": "azxo1"
    },
    {
        "id": "c8c249f2.8df858",
        "type": "ui_tab",
        "name": "Home",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
]

```

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [8 May 2022 08:44 UTC](https://discourse.nodered.org/t/get-object-params-value/62356/24 "2022-05-08T08:44:40Z")

</div>

The DHT11 is a tasmota device ? You can get the value in JSON without the need for substrings and it is easier to get the value via mqtt, but ok http request works too.

You will need to store the temperature into a flow/global/node context variable and compare the google value against it. The function node acts on the message that arrives on the node, one by one, so you cannot send 2 values and compare, it requires the value to be stored.

rough example (so you don't have to connect the change node to the function node):

 ![Screenshot 2022-05-08 at 10.47.52](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/f/ff3c5d67aca641f6af7e0dd315b9ff37826d768c.jpeg)

function node:

```auto
let googleInput = parseInt(msg.payload)
msg.payload = (googleInput > flow.get("temperature")) ? "on" : "off"

return msg;

```

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [8 May 2022 09:03 UTC](https://discourse.nodered.org/t/get-object-params-value/62356/25 "2022-05-08T09:03:22Z")

</div>

When I asked for your flow and input, your reply was

> [@azxo1](#):
>
> No mistake !!!!

You still have not given inputs, why?

If you had shown your flow earlier when asked, we could have seen that the message is infact two messages. These will need to be stored (@bakman2 reply) or joined as in the example below

```auto
[{"id":"233abfc.c8ab34","type":"inject","z":"680004bc8e5431d1","name":"google","props":[{"p":"payload.params.thermostatTemperatureSetpoint","v":"20","vt":"num"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"google","x":660,"y":440,"wires":[["4bfcbe29.2f294"]]},{"id":"4bfcbe29.2f294","type":"join","z":"680004bc8e5431d1","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":860,"y":420,"wires":[["50d6787ab46254f3"]]},{"id":"49907e55c23a0256","type":"inject","z":"680004bc8e5431d1","name":"dht11","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"dht11","payload":"24","payloadType":"num","x":650,"y":360,"wires":[["4bfcbe29.2f294"]]},{"id":"50d6787ab46254f3","type":"function","z":"680004bc8e5431d1","name":"","func":"let myValue = msg.payload.google.params.thermostatTemperatureSetpoint;\nmsg.payload = Number(msg.payload.dht11)-10; \nif (msg.payload < myValue) \n{msg.payload = \"on\";}\nelse {\n {msg.payload = \"off\"}\n}\nreturn [msg, msg.myValue];","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1010,"y":420,"wires":[["c5910488841ea14b"]]},{"id":"c5910488841ea14b","type":"debug","z":"680004bc8e5431d1","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1190,"y":420,"wires":[]}]

```

notice the two messages have distinctive topics, for the join, and how they are referenced later in the function.  
I have had to guess the incoming dht11 message as still you have not shown an example of it.

p.s. you still are referncing `msg.payload.params.thermostatTemperatureSetPoint` wrong it should be `msg.payload.params.thermostatTemperatureSetpoint` small `p`

---

<div class="post-metadata">

**Author:** ![azxo1](https://avatars.discourse-cdn.com/v4/letter/a/b487fb/32.png) [@azxo1](https://discourse.nodered.org/u/azxo1)\
**Post date:** [8 May 2022 13:36 UTC](https://discourse.nodered.org/t/get-object-params-value/62356/26 "2022-05-08T13:36:39Z")

</div>

**That would be the question:**  
Hi! Please help!  
How to get any object params value?  
 ![params](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/c/5c16efe8b4b0681992baa252117451abf42a10f0.png)

---

<div class="post-metadata">

**Author:** ![azxo1](https://avatars.discourse-cdn.com/v4/letter/a/b487fb/32.png) [@azxo1](https://discourse.nodered.org/u/azxo1)\
**Post date:** [8 May 2022 13:44 UTC](https://discourse.nodered.org/t/get-object-params-value/62356/27 "2022-05-08T13:44:29Z")

</div>

We strayed a little from the original question. And I misinterpreted your answer. Thank you very much! Of course it works. I can already compare this value with the DHT11 Tasmota thermometer data and perform various operations with it. I'm sorry, I still don't speak English. (Google translator)  
🙂

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [8 May 2022 17:57 UTC](https://discourse.nodered.org/t/get-object-params-value/62356/28 "2022-05-08T17:57:14Z")

</div>

Why do you keep repeating the same (previously answered) question over and over ?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [22 May 2022 17:58 UTC](https://discourse.nodered.org/t/get-object-params-value/62356/29 "2022-05-22T17:58:12Z")

</div>

Closed on 22 May 2022 17:58 UTC

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

[Previous page](https://discourse.nodered.org/t/get-object-params-value/62356.md?page=1)
