Context value question


In a function node I store the "nvalue" of an On/Off switch (domoticz) in a context variable.
This function node is part of a flow which turns a TV on/off if the Switch is turned On/Off.

if (msg.payload.idx == '351') {
    //store nvalue
    var nvalue=context.get('nvalue');
    if (typeof nvalue=='undefined'){
       nvalue=0; //set default
    context.set('nvalue',nvalue); //save it
    return msg;

I want to use this context variable in an IF statement in another Function node.
Which sync's the Switch if the TV is turned On/Off with the remote.
I have this code, but it looks like the context variable is either not saved nor passed to this fuction node.

var tvstate = context.get('nvalue');

if (tvstate === 0) {

    msg.payload = {
        "idx": 351,
        "nvalue": 1,
    return msg;

Does anyone has an Idea what I am missing here?

context is node specific
flow is flow specific
global is every where
so use global.set and global.get

Thanx, I’ll try!

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