Search

Register

Thanks for signing-up! You will receive an email with further instructions to activate your account!

username already taken
You already have an account? .

Login

Forgot password?
Don't have an account yet? Register now for using the UI-Designer and the forum or creating projects.
Login to create topics and posts!



Node Red and netIO

#1 Jan. 13, 2020 17:26:04 by meccip

Node Red and netIO

Hi,
Anybody have some example or info about node red working with netIO ?

A simple connection for LED ON/OFF and a temperature display in netIo app.

Thank you.

PS. I almost hear the wind blowing in this forum !!

#2 Jan. 13, 2020 23:46:37 by mcgiver0510

Node Red and netIO

you're right. The forum is pretty dead.
Kalle and I are the only users who still answer questions.
Do you use NodeRed with IoBroker???
If so - you can install a JavaScript-TCP-Server and use it to
access the data points from IoBroker.
Or you create a TCP server with NodeRed - this also works.
MQTT (e.g. ESP8266/32 etc) also works over such a connection.

lg
kalli

#3 Jan. 14, 2020 00:25:49 by mcgiver0510

Node Red and netIO

hi meccip,

NetIO - Config

{
"style": "flat",
"orientation": "portrait",
"pagebuttonwidth": "static",
"navigation": "fix",
"description": "this is an empty configuration for starting from scratch",
"preventSleep": false,
"connections": [
{
"eventBased": true,
"protocol": "tcp",
"name": "iobroker",
"format": "string",
"host": "000.000.000.000", <<<<<---- your Host-IP
"sendTermination": "\n",
"receiveTermination": "\n",
"port": 53000,
"initialsend": "init"
}
],
"theme": "dark",
"version": 2,
"device": "Google Nexus 7",
"type": "NetIOConfiguration",
"pages": [
{
"name": "page",
"fitToScreen": true,
"label": "page",
"width": 800,
"connection": "iobroker",
"items": [
{
"textcolor": "230,230,230",
"requiresSendReponse": false,
"sends": [
"home/from NetIO"
],
"border": "70,70,70",
"top": 60,
"height": 90,
"width": 300,
"shape": "rounded",
"background": "100,100,100",
"parseResponse": "Button1#(.*)",
"label": "Button1",
"type": "button",
"formatResponse": "{0.1}",
"left": 80
}
],
"height": 1280
}
],
"switchOnSwipe": true,
"name": "NodeRed"
}

NodeRed-Flow
[
{
"id": "2d3b5950.265856",
"type": "tab",
"label": "Flow 1",
"disabled": false,
"info": ""
},
{
"id": "f60a4dd8.413b",
"type": "tcp in",
"z": "2d3b5950.265856",
"name": "Server holding connections at :53000",
"server": "server",
"host": "",
"port": "53000",
"datamode": "stream",
"datatype": "utf8",
"newline": "\\n",
"topic": "text",
"base64": false,
"x": 170,
"y": 260,
"wires": [
[
"8358072d.420ed8",
"3de77345.12cb9c"
]
]
},
{
"id": "c3735ed8.e84ea8",
"type": "tcp out",
"z": "2d3b5950.265856",
"host": "",
"port": "",
"beserver": "reply",
"base64": false,
"end": false,
"name": "reply: all open connections will be messaged",
"x": 650,
"y": 160,
"wires": []
},
{
"id": "8843836a.c771b",
"type": "inject",
"z": "2d3b5950.265856",
"name": "button:NetIO",
"topic": "",
"payload": "Button1#NetIO",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 150,
"y": 40,
"wires": [
[
"daa8bf9d.ba2d48"
]
]
},
{
"id": "8358072d.420ed8",
"type": "template",
"z": "2d3b5950.265856",
"name": "modify received msg to be send back",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "You were sending: {{payload}}\n",
"x": 290,
"y": 160,
"wires": [
[
"c3735ed8.e84ea8"
]
]
},
{
"id": "daa8bf9d.ba2d48",
"type": "template",
"z": "2d3b5950.265856",
"name": "+ newline",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "{{payload}}\n",
"x": 380,
"y": 60,
"wires": [
[
"c3735ed8.e84ea8"
]
]
},
{
"id": "3de77345.12cb9c",
"type": "debug",
"z": "2d3b5950.265856",
"name": "",
"active": true,
"tosidebar": true,
"console": true,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"x": 440,
"y": 300,
"wires": []
},
{
"id": "ee9de955.e5d478",
"type": "inject",
"z": "2d3b5950.265856",
"name": "button: mcgiver0510",
"topic": "",
"payload": "Button1#mcgiver0510",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 170,
"y": 100,
"wires": [
[
"daa8bf9d.ba2d48"
]
]
}
]

i hope this helps…

lg
kalli

Edited mcgiver0510 (Jan. 14, 2020 00:33:28)

#4 Jan. 14, 2020 22:32:58 by meccip

Node Red and netIO

Thank you. This help me for something, but i have a new problem.

I have some readings from my Epever Tracer solar controller on modbus with node red. It is working in node dashboard, but i need to send to netIO on android. With your example i can send data like Battery Voltage, but only from 1 address. And i need to send more values like (Battery Voltage, Solar Voltage, Solar Power..and more). I just start with nodeRed and maybe you can help me with some info. I Think i have to add somethinq in front of node payload, like a prefix to identify in netIO response.

I try this in a function node but is not working

if (msg.topic=='Solar')
{
msg.payload='Prefix'(msg.payload)
}
return msg;


Or if you have a better idea for sending string from solar modbus to netIO

#5 Jan. 15, 2020 02:04:43 by mcgiver0510

Node Red and netIO

hi meccip,

you can send multiple strings without problems.
you just have to assemble them on your hardware before sending.
please remember that netio standalone cannot do mqtt.
this only works via IOBroker and with a TCP server !!!

Example :

also lower strings have to be assembled

String1 : Label1#BatteryVoltage - 12 Volt
String2 : Label2#SolarVoltage - 24 Volt
String3 : Label3#SolarPower - 100 Watt
String4 : Label4#Outside Temperature -12°C

you can send multiple strings - like this :

sendString to NetIO : Label1#BatteryVoltage - 12 Volt,Label2#SolarVoltage - 24 Volt,Label3#SolarPower - 100 Watt,
Label4#Outside Temperature -12°C

or you send only one string - like this :

sendString to NetIO : Label1#BatteryVoltage - 12 Volt


parseResponse Label1 : Label1#([\w\d+ÄäÜüÖö(\)]{0,60})
parseResponse Label2 : Label2#([\w\d+ÄäÜüÖö(\)]{0,60})
parseResponse Label3 : Label3#([\w\d+ÄäÜüÖö(\)]{0,60})
parseResponse Label4 : Label4#([\w\d+ÄäÜüÖö(\)]{0,60})

formatResponse for all Labels : {0.1}

please try to understand the regular expressions
here is a good RegEx tester :
https://regex101.com/

see the new lower Example…

lg
kalli

Edited mcgiver0510 (Jan. 15, 2020 02:38:20)

#6 Jan. 15, 2020 02:09:14 by mcgiver0510

Node Red and netIO

hi meccip,
new Example :

NetIO-Config
{
"style": "flat",
"orientation": "portrait",
"pagebuttonwidth": "static",
"navigation": "fix",
"description": "this is an empty configuration for starting from scratch",
"preventSleep": false,
"connections": [
{
"eventBased": true,
"protocol": "tcp",
"name": "iobroker",
"format": "string",
"host": "192.168.178.53",
"sendTermination": "\n",
"receiveTermination": "\n",
"port": 53000,
"initialsend": "init"
}
],
"theme": "dark",
"version": 2,
"device": "Google Nexus 7",
"type": "NetIOConfiguration",
"pages": [
{
"name": "page",
"fitToScreen": true,
"label": "page",
"width": 800,
"connection": "iobroker",
"items": [
{
"textcolor": "230,230,230",
"requiresSendReponse": false,
"sends": [
"home/from NetIO"
],
"border": "70,70,70",
"top": 510,
"height": 90,
"width": 300,
"shape": "rounded",
"background": "100,100,100",
"parseResponse": "Button1#(.*)",
"label": "Button1",
"type": "button",
"formatResponse": "{0.1}",
"left": 200
},
{
"top": 20,
"left": 20,
"width": 760,
"height": 90,
"type": "label",
"text": "Label1",
"textcolor": "230,230,230",
"background": "180,0,0",
"parseResponse": "Label1#([\\w\\d+ÄäÜüÖö(\\[\\s-.°:=%!_\\])]{0,60})",
"formatResponse": "{0.1}",
"requiresSendReponse": false,
"fontsize": 20
},
{
"top": 130,
"left": 20,
"width": 760,
"height": 90,
"type": "label",
"text": "Label2",
"textcolor": "230,230,230",
"background": "180,0,0",
"parseResponse": "Label2#([\\w\\d+ÄäÜüÖö(\\[\\s-.°:=%!_\\])]{0,60})",
"formatResponse": "{0.1}",
"requiresSendReponse": false,
"fontsize": 20
},
{
"top": 240,
"left": 20,
"width": 760,
"height": 90,
"type": "label",
"text": "Label3",
"textcolor": "230,230,230",
"background": "180,0,0",
"parseResponse": "Label3#([\\w\\d+ÄäÜüÖö(\\[\\s-.°:=%!_\\])]{0,60})",
"formatResponse": "{0.1}",
"requiresSendReponse": false,
"fontsize": 20
},
{
"top": 350,
"left": 20,
"width": 760,
"height": 90,
"type": "label",
"text": "Label4",
"textcolor": "230,230,230",
"background": "180,0,0",
"parseResponse": "Label4#([\\w\\d+ÄäÜüÖö(\\[\\s-.°:=%!_\\])]{0,60})",
"formatResponse": "{0.1}",
"requiresSendReponse": false,
"fontsize": 20
}
],
"height": 1280
}
],
"switchOnSwipe": true,
"name": "NodeRed"
}

NodeRed-Flow
[
{
"id": "720b44b0.aba7dc",
"type": "tcp in",
"z": "97787a5e.d68a8",
"name": "Server holding connections at :53000",
"server": "server",
"host": "",
"port": "53000",
"datamode": "stream",
"datatype": "utf8",
"newline": "\\n",
"topic": "text",
"base64": false,
"x": 170,
"y": 520,
"wires": [
[
"efd00a8a.3f2648",
"56b22724.83f29"
]
]
},
{
"id": "18901d1d.653f53",
"type": "tcp out",
"z": "97787a5e.d68a8",
"host": "",
"port": "",
"beserver": "reply",
"base64": false,
"end": false,
"name": "reply: all open connections will be messaged",
"x": 570,
"y": 420,
"wires": []
},
{
"id": "774082cf.126204",
"type": "inject",
"z": "97787a5e.d68a8",
"name": "Button:NetIO",
"topic": "",
"payload": "Button1#NetIO",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 170,
"y": 80,
"wires": [
[
"f0ba4011.997fd"
]
]
},
{
"id": "efd00a8a.3f2648",
"type": "template",
"z": "97787a5e.d68a8",
"name": "modify received msg to be send back",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "You were sending: {{payload}}\n",
"x": 190,
"y": 440,
"wires": [
[
"18901d1d.653f53"
]
]
},
{
"id": "f0ba4011.997fd",
"type": "template",
"z": "97787a5e.d68a8",
"name": "+ newline",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "{{payload}}\n",
"x": 580,
"y": 80,
"wires": [
[
"18901d1d.653f53"
]
]
},
{
"id": "56b22724.83f29",
"type": "debug",
"z": "97787a5e.d68a8",
"name": "",
"active": true,
"tosidebar": true,
"console": true,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"x": 460,
"y": 540,
"wires": []
},
{
"id": "7a4a4e2f.a21a6",
"type": "inject",
"z": "97787a5e.d68a8",
"name": "Button: mcgiver0510",
"topic": "",
"payload": "Button1#mcgiver0510",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 180,
"y": 140,
"wires": [
[
"f0ba4011.997fd"
]
]
},
{
"id": "b139888d.0998c",
"type": "inject",
"z": "97787a5e.d68a8",
"name": "Button: send multiple strings to NetIO",
"topic": "",
"payload": "Label1#BatteryVoltage - 12 Volt,Label2#SolarVoltage - 24 Volt,Label3#SolarPower - 100 Watt,Label4#Outside Temperature -12 °C",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 210,
"y": 200,
"wires": [
[
"f0ba4011.997fd"
]
]
},
{
"id": "f8d66d14.89ea8",
"type": "inject",
"z": "97787a5e.d68a8",
"name": "Button: clear multiple strings",
"topic": "",
"payload": "Label1#Label1,Label2#Label2,Label3#Label3,Label4#Label4",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 240,
"y": 260,
"wires": [
[
"f0ba4011.997fd"
]
]
}
]

…the rest is up to you…
good luck…

lg
kalli

Edited mcgiver0510 (Jan. 15, 2020 02:16:21)

#7 Jan. 19, 2020 01:05:08 by meccip

Node Red and netIO

Thank you for your help and examples. I managed to send readings from modbus controller to netIO. i add in function node some if statments to add a prefix to all readings.

if (msg.topic=='SOC'){msg.payload='SOC'+msg.payload}
if (msg.topic=='Vsolar'){msg.payload='Vsolar'+msg.payload}
if (msg.topic=='Vbatt'){msg.payload='Vbatt'+msg.payload}


return msg;

in netio i replace for all 3 readings
parseResponse: SOC(.*)…Vsolar(.*)…Vbatt(.*)…
formatResponse: {0.1} for all

I have a new problem with displaying this readings. Sometimes i have this bug Vsolar 35,6999999999999 V instead of 35,70 V, This bug it comes from nodred range node. I tried to check <Round result to the nearest integer> but the display is just 35 V and i want decimal too. Maybe you know something about it.

Edited meccip (Jan. 19, 2020 01:08:20)

#8 Jan. 19, 2020 14:34:02 by Kalle

Node Red and netIO

You can try this in parseRespone

(?<=Vsolar)(\d+.\d{2})

this will show only two digits after the comma.

Edited Kalle (Jan. 20, 2020 06:39:49)

#9 Jan. 19, 2020 22:50:20 by mcgiver0510

Node Red and netIO

hi meccip,

I have a new problem with displaying this readings. 
Sometimes i have this bug Vsolar 35,6999999999999 V instead of 35,70 V,
This bug it comes from nodred range node. I tried to check <Round result
to the nearest integer> but the display is just 35 V and i want decimal too.
Maybe you know something about it.

yes - a little bit…

there are several possibilities as it depends very much on how your string looks like

Kalle's rule is ok -
but you cannot round the value
and the unit of measurement is missing
if there is only one decimal place - the rule no longer matches

Example 1 :
Value : Vsolar35,6999999999999V
parseResponse : (?<=Vsolar)(\d+.\d{2}) —>> matched “35,69” – lost values “99999999999V”
formatResponse : {0.1}V
Result : 35,69V

Example 2 :
Value : Vsolar35,6V
parseResponse : (?<=Vsolar)(\d+.\d{2})
formatResponse : {0.1}V
Result : no match

in such a case it might be better to send the string with dot notation

and now values with dots…

Example 3 :
Value : Vsolar1#35.6999999999999V
parseResponse : Vsolar1#(\d{2}.[0-9]{0,15})([\WA-Z]{0,2})
formatResponse : <calc dec=2>{0.1}</calc>{0.2} <<--- rounded Group 1
Result : 35.70V

Example 4 :
Value : Vsolar1#35.6999V
parseResponse : Vsolar1#(\d{2}.[0-9]{0,15})([\WA-Z]{0,2})
formatResponse : <calc dec=2>{0.1}</calc>{0.2} <<--- rounded Group 1
Result : 35.70V

Example 5 :
Value : Vsolar1#35.69V
parseResponse : Vsolar1#(\d{2}.[0-9]{0,15})([\WA-Z]{0,2})
formatResponse : <calc dec=2>{0.1}</calc>{0.2} <<--- not rounded Group 1 -- already has 2 characters
Result : 35.69V

Example 6 :
Value : Vsolar1#35.6V
parseResponse : Vsolar1#(\d{2}.[0-9]{0,15})([\WA-Z]{0,2})
formatResponse : <calc dec=2>{0.1}</calc>{0.2} <<--- rounded Group 1
Result : 35.60V

Example 7 :
Value : Vsolar1#35.699°C
parseResponse : Vsolar1#(\d{2}.[0-9]{0,15})([\WA-Z]{0,2})
formatResponse : <calc dec=2>{0.1}</calc>{0.2} <<--- rounded Group 1
Result : 35.70°C

Full match = Vsolar1#35.6999999999999V
Group1 == {0.1} == 35.6999999999999
Group2 == {0.2} == V

this : <calc dec=2>{0.1}</calc> rounded Group 1
this : {0.2} concatenate the "V" from Group 2

Please try this with the above mentioned RegExTester…

i hope this helps…

lg
kalli

Edited mcgiver0510 (Jan. 19, 2020 23:05:10)

#10 Jan. 20, 2020 06:24:16 by Kalle

Node Red and netIO

Hi Kalli,
wow - perfekt.
Ich hatte lange probiert um zu helfen, bekam es aber nicht hin, dass die Einheit angehängt wird.

@meccip

The examples from mcgiver0510 are perfect. A small improvement I would still have in parseResponse:

Vsolar1#(\d{0,3}.[0-9]{0,15})([\WA-Z]{0,2})

thus a value of 0-999 Volt is considered.

Gruß,
Kalle

Edited Kalle (Jan. 20, 2020 08:14:42)