2016-11-07 67 views
1

有了这个代码:布尔错误的JavaScript

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; 
} 

每node.error将在节点输出参数的值。我无法理解为什么,但它会接受布尔值true,而不是假的,你可以在这个图片中看到:

enter image description here

我使用NodeRED,并且你可以看到,代码很简单。我的功能每次都会触发。

编辑:不要照顾-1的,它只是表明我2值

+0

不,我不知道这个问题。你能澄清吗? – Liam

+0

@Liam在Node-RED的上下文中是有意义的。我将删除应该帮助的javascript和node.js标记。我需要仔细检查,但我认为这可能是错误功能中的错误。 – hardillb

回答