Page 1 of 1

Domoticz to Node-Red basics

Posted: Wednesday 24 January 2018 23:59
by trollmar
Hi,

i would like to send a payload (svalue1) from node red via jason mqtt to domoticz.

At https://www.domoticz.com/wiki/Flows
are examples.

Th first example is to send Text to a virtuell Device.

inside the java function node is the following code:

Code: Select all

var dt = new Date();


var now = {
 'month': dt.getMonth() + 1,
 'day': dt.getDate(),
 'year': dt.getFullYear(),
 'hours': dt.getHours(),
 'mins': dt.getMinutes(),
 'msecs': dt.getMilliseconds()
};


msg.payload = {};
msg.payload.idx = 211;
msg.payload.svalue = "The time is now " + now.hours + ":" + now.mins;
return msg;  
How should I modify this example script to insert the actual payload (the "in wire" from the function node)

like this:

Code: Select all

var  = inWirePayload;

msg.payload = {};
msg.payload.idx = 211;
msg.payload.svalue = inWirePayload;
return msg;  
I know the code dosen't make any sense.
Im not familar with Java.
The purpose is to use the msg.payload and insert it into json string

Could somebody that using node-red to send values to domoticz held out?
Sorry ..i feel dump ;-)