1

Having this code :

function checkIsNotOverHeating(context, surchauffe, offset, topic, node){
    let msg = null;
    let overheating;

    overheating = false;

    if(checkTemperatureWithOffset(context.get("temperatureInt"), offset, surchauffe, "-") === 1){
        // Overheating
        overheating = true;
        msg = createMessageOverheat(topic);
    }

    node.error(overheating)
    if(context.get("overheating") !== overheating) context.set("overheating", overheating);

    return msg;
}

Every node.error will output in Node the value in parameter. I'm not able to understand why, but it will accept the boolean true, and not the false, as you can see in this picture :

enter image description here

I'm using NodeRED, and as you can see, the code is simple. My function is triggered everytime.

EDIT : Don't take care of the -1, it will just shown me the variation of 2 value

2
  • Nope, I can't figure this question out. Can you clarify please? Commented Nov 7, 2016 at 16:07
  • @Liam in the context of Node-RED this does make sense. I'll remove the javascript and node.js tags which should help. I need to double check but I think it may be bug in the error function. Commented Nov 7, 2016 at 16:14

1 Answer 1

1

This looks like a bug in the node.error() code as a work around try this:

node.error(' ' + overheating);

EDIT:

Fix for this has been submitted:

https://github.com/node-red/node-red/pull/1037

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.