# Check conditions function doesn't evaluate properly

**URL:** <https://discourse.nodered.org/t/check-conditions-function-doesnt-evaluate-properly/93006>\
**Category:** General\
**Tags:** home-assistant\
**Created:** [9 November 2024 09:55 UTC](https://discourse.nodered.org/t/check-conditions-function-doesnt-evaluate-properly/93006 "2024-11-09T09:55:55Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![slaz](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@slaz](https://discourse.nodered.org/u/slaz)\
**Post date:** [9 November 2024 09:55 UTC](https://discourse.nodered.org/t/check-conditions-function-doesnt-evaluate-properly/93006/1 "2024-11-09T09:55:55Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/f/0f0a5f49a920fd895cf85ac5541d2f3c90309642.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/7/87fe7077f91e0d8c5615c4d9cbc94e05f5b5cc04.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/9/591287f7b22ad7df0ec3ba8d796b705abef340e6.png)

Hello,

I have an flow that I try to setup. It should get 2 values from homeassistant called realtime\_produced\_power\_kw and realtime\_consumption\_kw and if the produced is more then 1kw higher then the consumption, trigger start or airco. Else if the consumption is higher then produced with 0.5 kw then trigger a stop of airco.

Problem that I face is that realtime\_produced\_power\_kw is updating more often then realtime\_consumption\_kw and when this happens then I get "Real-time Consumption: NaN".

I tried to store the last value of the realtime\_consumption\_kw to use it till it gets new values but it's not working for some reason.

My condition check is this

```auto
// Get the latest values for produced power and consumption power
let producedPower = flow.get("realtime_produced_power_kw");
let consumptionPower = flow.get("realtime_consumption_kw");

// Check if consumptionPower is valid (not NaN)
if (isNaN(consumptionPower)) {
    // If consumptionPower is NaN, try to use last valid consumption value from flow
    consumptionPower = flow.get("last_valid_consumption_kw");
    
    if (consumptionPower === undefined || isNaN(consumptionPower)) {
        node.warn("No valid consumption data available yet.");
        return null; // Exit if no valid data available
    } else {
        node.warn("Using last valid consumption data: " + consumptionPower);
    }
} else {
    // Update the flow with the latest valid consumption power
    flow.set("last_valid_consumption_kw", consumptionPower);
}

// Ensure produced power is valid
if (isNaN(producedPower)) {
    node.warn("Produced power value is invalid.");
    return null; // Exit if produced power is invalid
}

// Log the values for debugging
node.warn("Produced Power: " + producedPower);
node.warn("Real-time Consumption: " + consumptionPower);

// Check if the conditions are met for triggering actions
if (producedPower - consumptionPower >= 1.5 && producedPower > 1.9) {
    node.warn("Conditions met, taking action.");
    return [msg, null]; // Trigger HVAC actions
} else {
    node.warn("No action taken - conditions not met");
    return [null, msg]; // Do nothing if conditions are not met
}

```

and the debug output for this is

```auto
11/9/2024, 11:49:18 AMnode: Check conditions
function : (warn)
"Real-time Consumption: NaN"
11/9/2024, 11:49:18 AMnode: Check conditions
function : (warn)
"No action taken - conditions not met"
11/9/2024, 11:49:18 AMnode: Check conditions
function : (warn)
"No valid consumption data available yet."
11/9/2024, 11:49:27 AMnode: Check conditions
function : (warn)
"No valid consumption data available yet."
11/9/2024, 11:49:27 AMnode: Check conditions
function : (warn)
"Produced Power: 0.714"
11/9/2024, 11:49:27 AMnode: Check conditions
function : (warn)
"Real-time Consumption: 0.714"
11/9/2024, 11:49:27 AMnode: Check conditions
function : (warn)
"No action taken - conditions not met"
11/9/2024, 11:49:28 AMnode: Check conditions
function : (warn)
"Produced Power: 3.0332353"
11/9/2024, 11:49:28 AMnode: Check conditions
function : (warn)
"Real-time Consumption: NaN"
11/9/2024, 11:49:28 AMnode: Check conditions
function : (warn)
"No action taken - conditions not met"
11/9/2024, 11:49:29 AMnode: Check conditions
function : (warn)
"No valid consumption data available yet."
11/9/2024, 11:49:29 AMnode: Check conditions
function : (warn)
"No valid consumption data available yet."
11/9/2024, 11:49:29 AMnode: Check conditions
function : (warn)
"Produced Power: 0.638"
11/9/2024, 11:49:29 AMnode: Check conditions
function : (warn)
"Real-time Consumption: 0.638"
11/9/2024, 11:49:29 AMnode: Check conditions
function : (warn)
"No action taken - conditions not met"
11/9/2024, 11:49:39 AMnode: Check conditions
function : (warn)
"Produced Power: 3.0635878"
11/9/2024, 11:49:39 AMnode: Check conditions
function : (warn)
"Real-time Consumption: NaN"
11/9/2024, 11:49:39 AMnode: Check conditions
function : (warn)
"No action taken - conditions not met"

```

Is there anything I am overlooking and can fix to get this working please?  
Thank you lots in advance

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [9 November 2024 10:38 UTC](https://discourse.nodered.org/t/check-conditions-function-doesnt-evaluate-properly/93006/2 "2024-11-09T10:38:50Z")

</div>

firstly note, i do not use HA so may be missing some under the covers magic, but from what i see here: you are not setting `flow.realtime_consumption_kw` and `flow.realtime_produced_power_kw`.

Assuming those 2 blue HA nodes on the left send out the values for `realtime_consumption_kw` and `realtime_produced_power_kw`, why not simply join the 2 values into a single payload:

See [this article in the cookbook](https://cookbook.nodered.org/basic/join-streams) for an example of how to join messages into one object.

Then you will always have the latest values.

Just be sure both values have unique topics and to set the join node to "After a number of message parts `2` - and every subsequent message."

### Demo

![chrome_dKVn66dnxY](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/d/5de7f6c658c742c29f05aebdec8a762ab4f731eb.gif)

```auto
[{"id":"4924d89b2e1e9719","type":"join","z":"dc3aa5374a70eb0a","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","useparts":false,"accumulate":true,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":970,"y":240,"wires":[["5c4202ee8c059e38"]]},{"id":"6da76b9a48cf9027","type":"change","z":"dc3aa5374a70eb0a","name":"set topic to realtime_consumption_kw","rules":[{"t":"set","p":"topic","pt":"msg","to":"realtime_consumption_kw","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":680,"y":200,"wires":[["4924d89b2e1e9719"]]},{"id":"1aa242ed1340626a","type":"change","z":"dc3aa5374a70eb0a","name":"set topic to realtime_produced_power_kw","rules":[{"t":"set","p":"topic","pt":"msg","to":"realtime_produced_power_kw","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":680,"y":300,"wires":[["4924d89b2e1e9719"]]},{"id":"05a23a2fb6775b33","type":"inject","z":"dc3aa5374a70eb0a","name":"faking realtime_produced_power_kw","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"12","payloadType":"num","x":620,"y":260,"wires":[["1aa242ed1340626a"]]},{"id":"bf526e763078ebce","type":"inject","z":"dc3aa5374a70eb0a","name":"faking realtime_consumption_kw","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"11.2","payloadType":"num","x":630,"y":160,"wires":[["6da76b9a48cf9027"]]},{"id":"5c4202ee8c059e38","type":"debug","z":"dc3aa5374a70eb0a","name":"debug 11","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1020,"y":300,"wires":[]}]

```

Then you can simply access the values in your function using `msg.payload.realtime_consumption_kw` and `msg.payload.realtime_produced_power_kw`

---

<div class="post-metadata">

**Author:** ![slaz](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@slaz](https://discourse.nodered.org/u/slaz)\
**Post date:** [9 November 2024 11:04 UTC](https://discourse.nodered.org/t/check-conditions-function-doesnt-evaluate-properly/93006/3 "2024-11-09T11:04:20Z")

</div>

> [@Steve-Mcl](#):
>
> ```auto
> [{"id":"4924d89b2e1e9719","type":"join","z":"dc3aa5374a70eb0a","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","useparts":false,"accumulate":true,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":970,"y":240,"wires":[["5c4202ee8c059e38"]]},{"id":"6da76b9a48cf9027","type":"change","z":"dc3aa5374a70eb0a","name":"set topic to realtime_consumption_kw","rules":[{"t":"set","p":"topic","pt":"msg","to":"realtime_consumption_kw","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":680,"y":200,"wires":[["4924d89b2e1e9719"]]},{"id":"1aa242ed1340626a","type":"change","z":"dc3aa5374a70eb0a","name":"set topic to realtime_produced_power_kw","rules":[{"t":"set","p":"topic","pt":"msg","to":"realtime_produced_power_kw","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":680,"y":300,"wires":[["4924d89b2e1e9719"]]},{"id":"05a23a2fb6775b33","type":"inject","z":"dc3aa5374a70eb0a","name":"faking realtime_produced_power_kw","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"12","payloadType":"num","x":620,"y":260,"wires":[["1aa242ed1340626a"]]},{"id":"bf526e763078ebce","type":"inject","z":"dc3aa5374a70eb0a","name":"faking realtime_consumption_kw","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"11.2","payloadType":"num","x":630,"y":160,"wires":[["6da76b9a48cf9027"]]},{"id":"5c4202ee8c059e38","type":"debug","z":"dc3aa5374a70eb0a","name":"debug 11","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1020,"y":300,"wires":[]}]
> 
> ```

I tried this code based on your example:

```auto
[
    {
        "id": "5b18c39baec77c7b",
        "type": "tab",
        "label": "Flow 4",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "3e1ee0dafce6593a",
        "type": "server-state-changed",
        "z": "5b18c39baec77c7b",
        "name": "realtime_produced_power_kw",
        "server": "e088f9a18be9efaf",
        "version": 6,
        "outputs": 1,
        "exposeAsEntityConfig": "",
        "entities": {
            "entity": [
                "sensor.realtime_produced_power_kw"
            ],
            "substring": [],
            "regex": []
        },
        "outputInitially": false,
        "stateType": "num",
        "ifState": "",
        "ifStateType": "str",
        "ifStateOperator": "is",
        "outputOnlyOnStateChange": true,
        "for": "0",
        "forType": "num",
        "forUnits": "minutes",
        "ignorePrevStateNull": false,
        "ignorePrevStateUnknown": false,
        "ignorePrevStateUnavailable": false,
        "ignoreCurrentStateUnknown": false,
        "ignoreCurrentStateUnavailable": false,
        "outputProperties": [
            {
                "property": "realtime_produced",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            }
        ],
        "x": 380,
        "y": 200,
        "wires": [
            [
                "0f838cacaf888d91"
            ]
        ]
    },
    {
        "id": "f03f55139e883fc4",
        "type": "debug",
        "z": "5b18c39baec77c7b",
        "name": "debug 12",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1360,
        "y": 220,
        "wires": []
    },
    {
        "id": "0f838cacaf888d91",
        "type": "change",
        "z": "5b18c39baec77c7b",
        "name": "set topic to realtime_produced_power_kw",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "realtime_produced_power_kw",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 460,
        "y": 280,
        "wires": [
            [
                "d880514ac0a78e85",
                "f03f55139e883fc4"
            ]
        ]
    },
    {
        "id": "f3af83e8ff22dc05",
        "type": "change",
        "z": "5b18c39baec77c7b",
        "name": "set topic to realtime_consumption_kw ",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "realtime_consumption_kw",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1010,
        "y": 280,
        "wires": [
            [
                "d880514ac0a78e85",
                "f03f55139e883fc4"
            ]
        ]
    },
    {
        "id": "0fb2c559c8d0ed8a",
        "type": "server-state-changed",
        "z": "5b18c39baec77c7b",
        "name": "realtime_consumption_kw",
        "server": "e088f9a18be9efaf",
        "version": 6,
        "outputs": 1,
        "exposeAsEntityConfig": "",
        "entities": {
            "entity": [
                "sensor.realtime_power_kw"
            ],
            "substring": [],
            "regex": []
        },
        "outputInitially": false,
        "stateType": "num",
        "ifState": "",
        "ifStateType": "str",
        "ifStateOperator": "is",
        "outputOnlyOnStateChange": true,
        "for": "0",
        "forType": "num",
        "forUnits": "minutes",
        "ignorePrevStateNull": false,
        "ignorePrevStateUnknown": false,
        "ignorePrevStateUnavailable": false,
        "ignoreCurrentStateUnknown": false,
        "ignoreCurrentStateUnavailable": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            }
        ],
        "x": 710,
        "y": 140,
        "wires": [
            [
                "f3af83e8ff22dc05"
            ]
        ]
    },
    {
        "id": "d880514ac0a78e85",
        "type": "join",
        "z": "5b18c39baec77c7b",
        "name": "",
        "mode": "custom",
        "build": "object",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "useparts": false,
        "accumulate": true,
        "timeout": "",
        "count": "2",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "",
        "reduceFixup": "",
        "x": 1210,
        "y": 420,
        "wires": [
            [
                "f03f55139e883fc4"
            ]
        ]
    },
    {
        "id": "e088f9a18be9efaf",
        "type": "server",
        "name": "Home Assistant",
        "version": 5,
        "addon": false,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true,
        "cacheJson": true,
        "heartbeat": false,
        "heartbeatInterval": "30",
        "areaSelector": "friendlyName",
        "deviceSelector": "friendlyName",
        "entitySelector": "friendlyName",
        "statusSeparator": ": ",
        "statusYear": "hidden",
        "statusMonth": "short",
        "statusDay": "numeric",
        "statusHourCycle": "default",
        "statusTimeFormat": "h:m",
        "enableGlobalContextStore": false
    }
]

```

And the output is

```auto
11/9/2024, 12:58:50 PMnode: Check conditions
function : (warn)
"Produced Power: 2.876947"
11/9/2024, 12:58:50 PMnode: Check conditions
function : (warn)
"Real-time Consumption: NaN"
11/9/2024, 12:58:50 PMnode: Check conditions
function : (warn)
"No action taken - conditions not met"
11/9/2024, 12:58:50 PMnode: 618207cb3d9d48e4
msg : string[63]
"Message missing key property 'msg.topic' - cannot add to object"
11/9/2024, 12:58:50 PMnode: d880514ac0a78e85
msg : string[63]
"Message missing key property 'msg.topic' - cannot add to object"
11/9/2024, 12:58:50 PMnode: debug 12
msg.payload : string[26]
"realtime_produced_power_kw"
11/9/2024, 12:59:00 PMnode: Check conditions
function : (warn)
"Produced Power: 2.873873"
11/9/2024, 12:59:00 PMnode: Check conditions
function : (warn)
"Real-time Consumption: NaN"
11/9/2024, 12:59:00 PMnode: Check conditions
function : (warn)
"No action taken - conditions not met"
11/9/2024, 12:59:00 PMnode: 618207cb3d9d48e4
msg : string[63]
"Message missing key property 'msg.topic' - cannot add to object"
11/9/2024, 12:59:00 PMnode: d880514ac0a78e85
msg : string[63]
"Message missing key property 'msg.topic' - cannot add to object"
11/9/2024, 12:59:00 PMnode: debug 12
msg.payload : string[26]
"realtime_produced_power_kw"
11/9/2024, 12:59:10 PMnode: Check conditions
function : (warn)
"Produced Power: 2.871841"
11/9/2024, 12:59:10 PMnode: Check conditions
function : (warn)
"Real-time Consumption: NaN"
11/9/2024, 12:59:10 PMnode: Check conditions
function : (warn)
"No action taken - conditions not met"
11/9/2024, 12:59:10 PMnode: 618207cb3d9d48e4
msg : string[63]
"Message missing key property 'msg.topic' - cannot add to object"
11/9/2024, 12:59:10 PMnode: d880514ac0a78e85
msg : string[63]
"Message missing key property 'msg.topic' - cannot add to object"
11/9/2024, 12:59:10 PMnode: debug 12
msg.payload : string[26]
"realtime_produced_power_kw"
11/9/2024, 12:59:20 PMnode: Check conditions
function : (warn)
"Produced Power: 2.8725623"
11/9/2024, 12:59:20 PMnode: Check conditions
function : (warn)
"Real-time Consumption: NaN"
11/9/2024, 12:59:20 PMnode: Check conditions
function : (warn)
"No action taken - conditions not met"
11/9/2024, 12:59:20 PMnode: 618207cb3d9d48e4
msg : string[63]
"Message missing key property 'msg.topic' - cannot add to object"
11/9/2024, 12:59:20 PMnode: d880514ac0a78e85
msg : string[63]
"Message missing key property 'msg.topic' - cannot add to object"
11/9/2024, 12:59:20 PMnode: debug 12
msg.payload : string[26]
"realtime_produced_power_kw"
11/9/2024, 12:59:27 PMnode: Check conditions
function : (warn)
"Produced Power: 2.781"
11/9/2024, 12:59:27 PMnode: Check conditions
function : (warn)
"Real-time Consumption: 2.781"
11/9/2024, 12:59:27 PMnode: Check conditions
function : (warn)
"No action taken - conditions not met"

```

As you can see I still get "Produced Power: 2.781" and "Real-time Consumption: 2.781". This is not right since the values that come in are different. Can't understand what I do wrong here

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [9 November 2024 11:09 UTC](https://discourse.nodered.org/t/check-conditions-function-doesnt-evaluate-properly/93006/4 "2024-11-09T11:09:17Z")

</div>

> [@slaz](#):
>
> `"Message missing key property 'msg.topic' - cannot add to object"`

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/f/9ff01a1769b8465f3a7d97d19ee7c1065e909676.png)

Set that to `topic`

NOTE:

It is really difficult to decipher output when you use a generic debug for all things.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/2/12e6f332a42d18b5cbe6cdc1a05b20399868c3f0.png)

Please in future, use separate named debugs so it is easier to see where the issue is happening

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/4/441f879f6305aaf1e288ffd7b2a0cc10b9dae185.png)

---

<div class="post-metadata">

**Author:** ![slaz](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@slaz](https://discourse.nodered.org/u/slaz)\
**Post date:** [9 November 2024 11:13 UTC](https://discourse.nodered.org/t/check-conditions-function-doesnt-evaluate-properly/93006/5 "2024-11-09T11:13:30Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/2/1232ab700da2684dfc8ed9b36653637a9a49f0be.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/c/8c9417f301dcd40c6929cfa2db23d6053e6b37f9.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/5/a5971141f3630a7bab1e6a501d0192104fe09627.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/9/a933bd1ea7ebdc61768066c3e99d1cdde6be0a8b.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/2/d278b1ae0d54208e4053b1611b8d9de16610da7c.png)

I have this in my flow.

---

<div class="post-metadata">

**Author:** ![slaz](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@slaz](https://discourse.nodered.org/u/slaz)\
**Post date:** [9 November 2024 11:14 UTC](https://discourse.nodered.org/t/check-conditions-function-doesnt-evaluate-properly/93006/6 "2024-11-09T11:14:38Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/c/6c96ab516733ac4ea038489a63a31c9d2cc14a97.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/7/175a0e5f195e3733e4ced4b47bc37a8c47fd391b.png)

I even try it like this but without any luck ☹

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [9 November 2024 11:16 UTC](https://discourse.nodered.org/t/check-conditions-function-doesnt-evaluate-properly/93006/7 "2024-11-09T11:16:12Z")

</div>

> [@slaz](#):
>
> ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/5/a5971141f3630a7bab1e6a501d0192104fe09627.png)

You are setting `payload` to a string! I already said ...

> [@Steve-Mcl](#):
>
> ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/f/9ff01a1769b8465f3a7d97d19ee7c1065e909676.png)
> 
> Set that to `topic`

## ↑ Set that to `topic` ↑
  

did you not read the link I sent - it explains how to use the join node.

> [@Steve-Mcl](#):
>
> See [this article in the cookbook](https://cookbook.nodered.org/basic/join-streams) for an example of how to join messages into one object.

---

<div class="post-metadata">

**Author:** ![slaz](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@slaz](https://discourse.nodered.org/u/slaz)\
**Post date:** [9 November 2024 11:20 UTC](https://discourse.nodered.org/t/check-conditions-function-doesnt-evaluate-properly/93006/8 "2024-11-09T11:20:25Z")

</div>

Thank you for your patience. Really appreciated.  
I did change that to topic and now I have this

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/f/cf37a42574097ae93a788a950f546d6b214a23c8.png)

where realtime\_produced\_power\_kw is undefined and it is set to topic

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/1/c185ef485de0cdf0e0393261ffe01ad6f8a7a2ad.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [9 November 2024 11:22 UTC](https://discourse.nodered.org/t/check-conditions-function-doesnt-evaluate-properly/93006/9 "2024-11-09T11:22:00Z")

</div>

1. Please use separate named debugs like I showed you.

> [@Steve-Mcl](#):
>
> Please in future, use separate named debugs so it is easier to see where the issue is happening
> 
> ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/4/441f879f6305aaf1e288ffd7b2a0cc10b9dae185.png)

1. Show me what comes out of all 3 debug nodes.

---

<div class="post-metadata">

**Author:** ![slaz](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@slaz](https://discourse.nodered.org/u/slaz)\
**Post date:** [9 November 2024 11:30 UTC](https://discourse.nodered.org/t/check-conditions-function-doesnt-evaluate-properly/93006/10 "2024-11-09T11:30:08Z")

</div>

Thanks to your patience and help I think I saw something that was wrong

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/7/27946031913426c9182a23cd0bbb68f7302fc449.png)

this seems to not be set to payload. Corrected it and thanks to your separated debugs I managed to find what was going on and now it looks like it's producing the proper output

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/2/f2863e7fc2f5fb10bf18782ef4dcf5f1528a8457.png)

Now back to the drawing board to change the conditional function to read this values.

Many many thanks for your help and suggestions. Really appreciated

---

<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:** [7 February 2025 11:30 UTC](https://discourse.nodered.org/t/check-conditions-function-doesnt-evaluate-properly/93006/11 "2025-02-07T11:30:12Z")

</div>

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