Domoticz to Node-Red basics

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
trollmar
Posts: 16
Joined: Friday 24 April 2015 9:27
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Domoticz to Node-Red basics

Post 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 ;-)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest