Node-Red to Classic Modbus for beginners

Started by ClassicCrazy, June 21, 2018, 11:31:28 AM

Previous topic - Next topic

ClassicCrazy

This is to show the steps I am taking to setup  modbus reading on Node-Red.
I am not going to show how to set up Node-Red on a device because there are plenty of other tutorials on that.
I am using Windows 10 .
I am using serial data cable from Classic - see my post in Arduino section for how I set up the connections for that.
Also make sure you don't loose a day and have a lot of frustration by hooking up a connector on your test cable like I did ! Sometimes late night soldering is not good - ha ha .
I am using a usb to serial adapter now to get the data to my computer. In the future I may install Node-Red on a Raspberry Pi and connect the serial data on there using appropriate RS-232 to ttl converters as needed.

Back to Node-Red - I installed the Modbus package for Node-Red
This shows how to do that
https://flows.nodered.org/node/node-red-contrib-modbus

Attached are some screen shots .
I have three temperature values displaying in the debug . Next step is to add the node red blocks to divide by ten and display them on the UI screen ( not shown yet )
I have shown the setup screens for the Classic using the Modbus Read block .
I am a total beginner at this !


Larry



system 1
Classic 150 , 5s3p  Kyocera 135watt , 12s Soneil 2v 540amp lead crystal 24v pack , Outback 3524 inverter
 5s 135w Kyocero , 3s3p 270w Kyocera   Classic 150 ,8s2p  Kyocera 225w to Hawkes Bay Jakiper 48v 20kwh  ,Gobel 16 kwh  lifepo4 Outback VFX 3648  8s2p 380w Rec pv EG4 6000XP

ClassicCrazy

This shows the UI screen  view of previous
I have three flows
First is Sonoff Basic Switch
Second is Sonoff POW switch
Third is the Text block from the Classic above .
So my next step is to figure out how to display these temperatures some nice way .


Larry
system 1
Classic 150 , 5s3p  Kyocera 135watt , 12s Soneil 2v 540amp lead crystal 24v pack , Outback 3524 inverter
 5s 135w Kyocero , 3s3p 270w Kyocera   Classic 150 ,8s2p  Kyocera 225w to Hawkes Bay Jakiper 48v 20kwh  ,Gobel 16 kwh  lifepo4 Outback VFX 3648  8s2p 380w Rec pv EG4 6000XP

ricardo

has anyone made a KID serial data to modbus node-red flow? ..

i know others made scripts to go from serial to modbus .. 

ClassicCrazy

Quote from: ricardo on June 22, 2018, 11:29:04 AM
has anyone made a KID serial data to modbus node-red flow? ..

i know others made scripts to go from serial to modbus ..

I don't believe that the Kid uses Modbus

Larry
system 1
Classic 150 , 5s3p  Kyocera 135watt , 12s Soneil 2v 540amp lead crystal 24v pack , Outback 3524 inverter
 5s 135w Kyocero , 3s3p 270w Kyocera   Classic 150 ,8s2p  Kyocera 225w to Hawkes Bay Jakiper 48v 20kwh  ,Gobel 16 kwh  lifepo4 Outback VFX 3648  8s2p 380w Rec pv EG4 6000XP

Vic

Larry,    it looks like you are making some good progress!

I have yet to dip any toes in this water,   but hope to get to it fairly soon.

Thanks  for helping get the rest of us started.    73,   Vic
Off Grid - Sys 1: 2ea SW+ 5548, Surrette 4KS25 1280 AH, 5.25 KW PV, Classic 150,WB, Beta Barcelona, Beta KID
Sys 2: SW+ 5548s, 4KS25s, 5.88 KW PV, 2 ea. Classic 150, WB, HB CC-needs remote Monitoring/Control, site=remote.
 MN Bkrs/Bxs/Combiners. Thanks MN for Great Products/Svc/Support&This Forum!!

ricardo

Quote from: ClassicCrazy on June 22, 2018, 02:30:32 PM
Quote from: ricardo on June 22, 2018, 11:29:04 AM
has anyone made a KID serial data to modbus node-red flow? ..

i know others made scripts to go from serial to modbus ..

I don't believe that the Kid uses Modbus

Larry

It doesn't -- i was thinking of using a raspberry pi as a "modbus-bridge" .. i wonder if that is even useful?


ClassicCrazy

I guess I don't understand what would be the use of using modbus as a bridge  ? 
You can already get the data from the Kid so why add modbus ?

Larry
system 1
Classic 150 , 5s3p  Kyocera 135watt , 12s Soneil 2v 540amp lead crystal 24v pack , Outback 3524 inverter
 5s 135w Kyocero , 3s3p 270w Kyocera   Classic 150 ,8s2p  Kyocera 225w to Hawkes Bay Jakiper 48v 20kwh  ,Gobel 16 kwh  lifepo4 Outback VFX 3648  8s2p 380w Rec pv EG4 6000XP

ricardo

Quote from: ClassicCrazy on June 22, 2018, 09:42:47 PM
I guess I don't understand what would be the use of using modbus as a bridge  ? 
You can already get the data from the Kid so why add modbus ?

Larry

thats what i mean by "is it even useful" .. other than having the midnite local app work with a KID, or other modbus apps.

ClassicCrazy

Quote from: ricardo on June 22, 2018, 09:51:35 PM
Quote from: ClassicCrazy on June 22, 2018, 09:42:47 PM
I guess I don't understand what would be the use of using modbus as a bridge  ? 
You can already get the data from the Kid so why add modbus ?

Larry
thats what i mean by "is it even useful" .. other than having the midnite local app work with a KID, or other modbus apps.
Ricardo
Interesting idea but way too complicated for me.
The Local App uses Adobe Air - they chose that since it works on all platforms.  But the Node-Red does also and would be highly user configurable.
Making a Kid App on Node-Red would be better and probably a lot easier than trying to get Kid data converted to Modbus. I say that partly because I am just now starting to get Modbus stuff figured out !
If I win the lottery next time I will buy you a Classic so you can design Node-Red for it and save me a lot of learning and trouble ! ha ha .
Larry
system 1
Classic 150 , 5s3p  Kyocera 135watt , 12s Soneil 2v 540amp lead crystal 24v pack , Outback 3524 inverter
 5s 135w Kyocero , 3s3p 270w Kyocera   Classic 150 ,8s2p  Kyocera 225w to Hawkes Bay Jakiper 48v 20kwh  ,Gobel 16 kwh  lifepo4 Outback VFX 3648  8s2p 380w Rec pv EG4 6000XP

ClassicCrazy

Here is my Node -Red flow code so far.

[{"id":"7814d43b.054044","type":"debug","z":"5b05eee9.d07c08","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":550,"y":160,"wires":[]},{"id":"ac01c59a.753dd8","type":"modbus-read","z":"5b05eee9.d07c08","name":"Midnite Classic ","topic":"","showStatusActivities":false,"showErrors":false,"unitid":"10","dataType":"HoldingRegister","adr":"4131","quantity":"3","rate":"2","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"61de09d5.6be308","useIOFile":false,"ioFile":"","useIOForPayload":false,"x":140,"y":140,"wires":[["48c2d857.b4cda"],["48c2d857.b4cda"]]},{"id":"dfd82617.a6187","type":"ui_text","z":"5b05eee9.d07c08","group":"92929de4.bc8b58","order":0,"width":0,"height":0,"name":"","label":"text","format":"{{msg.payload}}","layout":"col-center","x":530,"y":240,"wires":[]},{"id":"603eab2c.3b8b24","type":"range","z":"5b05eee9.d07c08","minin":"0","maxin":"1000","minout":"0","maxout":"100","action":"scale","round":false,"property":"payload","name":"Scale ","x":350,"y":140,"wires":[["14547405.4ad87c","dfd82617.a6187"]]},{"id":"48c2d857.b4cda","type":"split","z":"5b05eee9.d07c08","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":260,"y":240,"wires":[["603eab2c.3b8b24"]]},{"id":"14547405.4ad87c","type":"debug","z":"5b05eee9.d07c08","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":500,"y":340,"wires":[]},{"id":"61de09d5.6be308","type":"modbus-client","z":"","name":"Classic ","clienttype":"simpleser","bufferCommands":false,"stateLogEnabled":false,"tcpHost":"192.168.3.21","tcpPort":"502","tcpType":"TPC-RTU-BUFFERED","serialPort":"COM3","serialType":"RTU","serialBaudrate":"19200","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":"10","commandDelay":"1","clientTimeout":"1000","reconnectTimeout":"2000"},{"id":"92929de4.bc8b58","type":"ui_group","z":"","name":"Outputs","tab":"74f42c08.0cd0ac","order":1,"disp":true,"width":"6"},{"id":"74f42c08.0cd0ac","type":"ui_tab","z":"","name":"Office","icon":"dashboard","order":1}]
system 1
Classic 150 , 5s3p  Kyocera 135watt , 12s Soneil 2v 540amp lead crystal 24v pack , Outback 3524 inverter
 5s 135w Kyocero , 3s3p 270w Kyocera   Classic 150 ,8s2p  Kyocera 225w to Hawkes Bay Jakiper 48v 20kwh  ,Gobel 16 kwh  lifepo4 Outback VFX 3648  8s2p 380w Rec pv EG4 6000XP

ClassicCrazy

#10


Ricardo ,
The first line below are my temps I want,
the second line { data: array[3], buffer: buffer[6]    seems to mess up the CSV
I think I need to use a function to strip those out
How do I do that ?
Thanks for any help .
Larry

6/24/2018, 11:13:33 AMnode: 14547405.4ad87cmsg.payload : array[3]
[ 195, 554, 540 ]
6/24/2018, 11:13:33 AMnode: 14547405.4ad87cmsg.payload : Object
{ data: array[3], buffer: buffer[6] }
6/24/2018, 11:13:35 AMnode: 14547405.4ad87cmsg.payload : array[3]
[ 196, 553, 540 ]
6/24/2018, 11:13:35 AMnode: 14547405.4ad87cmsg.payload : Object
{ data: array[3], buffer: buffer[6] }
6/24/2018, 11:13:37 AMnode: 14547405.4ad87cmsg.payload : array[3]
[ 196, 553, 540 ]
system 1
Classic 150 , 5s3p  Kyocera 135watt , 12s Soneil 2v 540amp lead crystal 24v pack , Outback 3524 inverter
 5s 135w Kyocero , 3s3p 270w Kyocera   Classic 150 ,8s2p  Kyocera 225w to Hawkes Bay Jakiper 48v 20kwh  ,Gobel 16 kwh  lifepo4 Outback VFX 3648  8s2p 380w Rec pv EG4 6000XP

ClassicCrazy

#11
I figured out how to just get the numbers - I unhooked the bottom wire from the Modbus module and just use the top one. Now to split up the data into more than one line.

Larry
system 1
Classic 150 , 5s3p  Kyocera 135watt , 12s Soneil 2v 540amp lead crystal 24v pack , Outback 3524 inverter
 5s 135w Kyocero , 3s3p 270w Kyocera   Classic 150 ,8s2p  Kyocera 225w to Hawkes Bay Jakiper 48v 20kwh  ,Gobel 16 kwh  lifepo4 Outback VFX 3648  8s2p 380w Rec pv EG4 6000XP

jedon

I've had my Classic hooked to an RPi then to an Odroid C2 for years now, my Node-RED flows are... very complicated but powerful, auto start-stops the generator, voice control via Alexa, logging, remote monitoring etc. I have a wifi range extender bridged to the house from the solar shed and the Classic hooked to that via ethernet cable.
-Jedon

ClassicCrazy

Quote from: jedon on July 30, 2018, 01:08:15 PM
I've had my Classic hooked to an RPi then to an Odroid C2 for years now, my Node-RED flows are... very complicated but powerful, auto start-stops the generator, voice control via Alexa, logging, remote monitoring etc. I have a wifi range extender bridged to the house from the solar shed and the Classic hooked to that via ethernet cable.
-Jedon
Jedon ,
That sounds like a great setup you have created.
Any chance you could share your flows or parts of them ? I have not gotten much farther than what I have posted above. 

Larry
system 1
Classic 150 , 5s3p  Kyocera 135watt , 12s Soneil 2v 540amp lead crystal 24v pack , Outback 3524 inverter
 5s 135w Kyocero , 3s3p 270w Kyocera   Classic 150 ,8s2p  Kyocera 225w to Hawkes Bay Jakiper 48v 20kwh  ,Gobel 16 kwh  lifepo4 Outback VFX 3648  8s2p 380w Rec pv EG4 6000XP

David

#14
Has someone gotten this to work over ethernet?  I have Node-Red running.  I have the client node using the IP# of the Classic as it appears from my router.  I can ping the Classic and within Node-Red have a ModBus-read node using  port 502, type TCP, and DEFAULT TCP Type.  It keeps displaying "Error: Modbus exception 1" and wondering what I am doing wrong.