Hi,
I am getting there, I can now detect a number and branch to correct code.
But the timer does not run correctly, it does if I leave the 5000 part in on my code, but id I try to use number it completes with no delay ?
I know this is easy to sort but looked on internet and cannot find the answer !
if (msg.payload == 30)
{
var number = msg.payload;
// X second delay
node.status({fill:"green",shape:"dot",text:"Enabled"});
msg.payload = "RLY = ON"
node.send(msg)
setTimeout(function()
{
node.status({fill:"red",shape:"ring",text:"Disabled"});
msg.payload = "RLY = OFF"
node.send(msg)
//}, 5000); // sets timeout
} , number); // sets timeout
return null;
}
regards
Gaz