A Forum run by Enthusiasts of MidNite Solar

The Open Source software/hardware corner => Node Red => Topic started by: ClassicCrazy on June 21, 2018, 11:31:28 AM

Title: Node-Red to Classic Modbus for beginners
Post by: ClassicCrazy on June 21, 2018, 11:31:28 AM
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 !
(http://)

Larry



Title: Re: Node-Red to Classic Modbus for beginners
Post by: ClassicCrazy on June 21, 2018, 11:39:41 AM
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 .
(http://)

Larry
Title: Re: Node-Red to Classic Modbus for beginners
Post by: 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 .. 
Title: Re: Node-Red to Classic Modbus for beginners
Post by: ClassicCrazy on June 22, 2018, 02:30:32 PM
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
Title: Re: Node-Red to Classic Modbus for beginners
Post by: Vic on June 22, 2018, 07:59:56 PM
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
Title: Re: Node-Red to Classic Modbus for beginners
Post by: ricardo on June 22, 2018, 09:36:53 PM
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?

Title: Re: Node-Red to Classic Modbus for beginners
Post by: 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
Title: Re: Node-Red to Classic Modbus for beginners
Post by: ricardo on June 22, 2018, 09:51:35 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.
Title: Re: Node-Red to Classic Modbus for beginners
Post by: ClassicCrazy on June 22, 2018, 10:06:08 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
Title: Re: Node-Red to Classic Modbus for beginners
Post by: ClassicCrazy on June 22, 2018, 10:06:56 PM
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}]
Title: Re: Node-Red to Classic Modbus for beginners
Post by: ClassicCrazy on June 24, 2018, 12:24:19 PM


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 ]
Title: Re: Node-Red to Classic Modbus for beginners
Post by: ClassicCrazy on June 24, 2018, 01:02:21 PM
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
Title: Re: Node-Red to Classic Modbus for beginners
Post by: 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
Title: Re: Node-Red to Classic Modbus for beginners
Post by: ClassicCrazy on July 30, 2018, 02:02:30 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
Title: Re: Node-Red to Classic Modbus for beginners
Post by: David on October 03, 2018, 05:35:47 PM
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.
Title: Re: Node-Red to Classic Modbus for beginners
Post by: ClassicCrazy on October 03, 2018, 07:39:38 PM
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.

What modbus registers are you trying to read from the Classic ?

Larry
Title: Re: Node-Red to Classic Modbus for beginners
Post by: David on October 03, 2018, 11:49:06 PM
Thanks Larry.  I was able to figure out my issue(s) after much trial and error.

After those changes I now can see my battery voltage being dumped to debugger.

Now trying to figure out how to display in node-red-dashboard.
 
Title: Re: Node-Red to Classic Modbus for beginners
Post by: RossW on October 04, 2018, 07:31:37 AM
It keeps displaying "Error: Modbus exception 1" and wondering what I am doing wrong.

Silly question, but do you have anything else reading the classic at the same time?
Eg, the local-app?
The classic only supports one modbus connection at a time, and if something else is using it, that could explain your errors?
Title: Re: Node-Red to Classic Modbus for beginners
Post by: ClassicCrazy on October 04, 2018, 12:34:29 PM
It keeps displaying "Error: Modbus exception 1" and wondering what I am doing wrong.

Silly question, but do you have anything else reading the classic at the same time?
Eg, the local-app?
The classic only supports one modbus connection at a time, and if something else is using it, that could explain your errors?

That is one advantage of hooking up the serial output since it will also work with the network side going too.

Larry
Title: Re: Node-Red to Classic Modbus for beginners
Post by: ClassicCrazy on October 04, 2018, 12:37:37 PM
Thanks Larry.  I was able to figure out my issue(s) after much trial and error.
  • Use FC 3: Read Holding Registers (I was using FC 4)
  • Need to subtract 1 from Modbus address that Midnite specifies, i.e. 4114 for bat voltage not 4115
  • TCP Type should be RTU-BUFFERED

After those changes I now can see my battery voltage being dumped to debugger.

Now trying to figure out how to display in node-red-dashboard.

Glad to hear you got it going. Look forward to seeing how you go about getting the data to display. I have not worked on Node Red more than I had in the initial post just because it got to be summer - maybe this winter I can dig back into it. Hopefully by the time maybe you will have something worked out and shared and save me a lot of effort !
We need someone like Ricardo to get a Classic because he is a whiz at Node Red for what he did with it for his Kid controller.

Larry
Title: Re: Node-Red to Classic Modbus for beginners
Post by: jedon on October 17, 2018, 12:29:15 PM
Here is my modbus parsing code.
Note that the classic seems very sensitive to multiple connections so I set my polling to 30s and only from one device.

You will need the modbustcp node

This is the code from  modbus to nodered

//[ 549, 19, 0, 94, 1027, 14, 650, 1417, 0, 46335, 20948, 0, 5381, 4380, 4100, 12800, 65326, 375, 450, 0, 600, 502, 15, 14400, 19 ]
/*
ChargeStage= [4120]MSB
Lifetime kW-Hours= (([4127] << 16) + [4126]) kWh
Infoflags = (([4131] << 16) + [4130])
FloatTimeToday= ([4138]) s
KwhToday=    ([4118]) kWh
Tbatt=   ([4132] /10) degC
Tfet=   ([4133] /10) degC
Vbatt= ([4115] /10) V
Ibatt= ([4117] /10) A
Vpv=    ([4116] /10) V
Ipv=    ([4121] /10) A
Watts= ([4119]) W
*/

var base = 4114;
var EMP = msg.payload[4131-base]/10.0

var newMsg = {
    payload: {
    BatteryVolts:msg.payload[4114-base]/10.0,
    TotalKWH:msg.payload[4117-base]/10.0,
    Watts:msg.payload[4118-base],
    AmpHours:msg.payload[4124-base]/10.0}
};
return newMsg;
Title: Re: Node-Red to Classic Modbus for beginners
Post by: ClassicCrazy on October 17, 2018, 12:57:39 PM
Thanks Jedon for sharing that .
Any chance you could copy the flow for that block like I did in this post  ?
http://midniteftp.com/forum/index.php?topic=4081.msg40102#msg40102
Then it is easy to just load that in the Node Red and the exact blocks you have will show up in our Node Red screens with all the associated logic and formulas.
I don't remember exactly how I copied that - but I can look it up sometime .
I am too busy with getting ready for winter stuff now to try out the Node Red - sunshine and no rain is rarity these days in Wisconsin !
thanks
Larry
Title: Re: Node-Red to Classic Modbus for beginners
Post by: jedon on October 23, 2018, 05:09:02 PM
Sure, here:
Code: [Select]
[{"id":"8b332f45.a5e82","type":"function","z":"7126d246.da35cc","name":"ModBus to NodeRed Format","func":"//[ 549, 19, 0, 94, 1027, 14, 650, 1417, 0, 46335, 20948, 0, 5381, 4380, 4100, 12800, 65326, 375, 450, 0, 600, 502, 15, 14400, 19 ]\n/*\nChargeStage= [4120]MSB\nLifetime kW-Hours= (([4127] << 16) + [4126]) kWh\nInfoflags = (([4131] << 16) + [4130])\nFloatTimeToday= ([4138]) s\nKwhToday=    ([4118]) kWh\nTbatt=   ([4132] /10) degC\nTfet=   ([4133] /10) degC\nVbatt= ([4115] /10) V\nIbatt= ([4117] /10) A\nVpv=    ([4116] /10) V\nIpv=    ([4121] /10) A\nWatts= ([4119]) W\n\nWbJrPercentLeft is 4373\nWbJrRemainingAmpHours is 4377\nWbJrTotalAmpHours is 4381\n\n*/ \n\nvar base = 4114;\nvar EMP = msg.payload[4131-base]/10.0\n\nvar newMsg = {\n    payload: {\n    BatteryVolts:msg.payload[4114-base]/10.0,\n    TotalKWH:msg.payload[4117-base]/10.0,\n    Watts:msg.payload[4118-base],\n    AmpHours:msg.payload[4124-base]/10.0,\n    Vpv:msg.payload[4116-base]/10.0,\n    Ipv:msg.payload[4121-base]/10.0, \n    }\n};\nreturn newMsg;\n\n\n","outputs":1,"noerr":0,"x":374.9999313354492,"y":469.999963760376,"wires":[["d4f35a30.49c3f8","6d199560.c3177c"]]},{"id":"d4f35a30.49c3f8","type":"debug","z":"7126d246.da35cc","name":"","active":true,"console":"false","complete":"payload","x":396.99996185302734,"y":419.9999523162842,"wires":[]},{"id":"4c5183ae.ce4b2c","type":"modbustcp-read","z":"7126d246.da35cc","name":"Midnite Classic 150 ","dataType":"HoldingRegister","adr":"4114","quantity":"20","rate":"30","rateUnit":"s","server":"1764ed5a.412543","x":120.82637786865234,"y":469.8439064025879,"wires":[["8b332f45.a5e82"]]},{"id":"6d199560.c3177c","type":"mqtt out","z":"7126d246.da35cc","name":"MidniteClassic","topic":"MidniteClassic/BatteryVolts","qos":"","retain":"","broker":"884615ee.3ead88","x":617.9999885559082,"y":475.9999475479126,"wires":[]},{"id":"1764ed5a.412543","type":"modbustcp-server","z":"7126d246.da35cc","host":"192.168.2.103","port":"502","unit_id":"1","reconnecttimeout":"32"},{"id":"884615ee.3ead88","type":"mqtt-broker","z":"","name":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"15","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""}]
Title: Re: Node-Red to Classic Modbus for beginners
Post by: ClassicCrazy on October 23, 2018, 05:45:29 PM
Thanks Jedon ,
I pasted that flow in on my node red -  then loaded the modbustcp and changed the IP address to match mine and  it works !
though I had to remember that I had to shut off Local Status app first since only one tcp connection at at time.
Not sure when I get to it but I will remove the network and replace it with my serial connection which I had running earlier.
I like the way you get the data and convert it to display - I can understand how you did it .
I forgot how to see the data on a webpage - I was just looking at it in debug . Next time I play with it I will re-remember how to display that . At least I got Node Red running again pretty easily on my computer.
Appreciate you sharing this - saved me hours trying to figure out how to do that !

Larry
Title: Re: Node-Red to Classic Modbus for beginners
Post by: ClassicCrazy on October 24, 2018, 12:27:36 PM
I took Jedon's flow , removed the Classic network connection he had, the copy and pasted in the serial modbus connection I had previously and wired it in to Jedons Modbus to Node Red Format block and it works via serial . 

This is the serial block flow from my Classic that I pasted in

[{"id":"e777cb21.3043d8","type":"modbus-read","z":"db127068.f821d8","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":160,"y":320,"wires":[["d9fbc654.2d9128"],[]]},{"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"}]
Title: Re: Node-Red to Classic Modbus for beginners
Post by: jedon on November 03, 2018, 05:29:03 PM
Fantastic! I use the Node-Red built in UI code to generate gauges and graphs from the Classic data.
Here are the UI Nodes

Code: [Select]
[{"id":"fdc37f4e.d79b1","type":"mqtt in","z":"27cd102b.b84a5","name":"","topic":"MidniteClassic/BatteryVolts","qos":"2","broker":"884615ee.3ead88","x":296.1666564941406,"y":681.8000717163086,"wires":[["ea7d5a00.92fc98"]]},{"id":"b9104a38.308a78","type":"ui_gauge","z":"27cd102b.b84a5","name":"","group":"bda2cbde.f2edc8","order":3,"width":0,"height":0,"gtype":"gage","title":"Solar Panel Watts","label":"Watts","format":"{{value}}","min":"0","max":"5000","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":930,"y":580,"wires":[]},{"id":"8ff1bdc3.68db6","type":"ui_chart","z":"27cd102b.b84a5","name":"","group":"bda2cbde.f2edc8","order":5,"width":"0","height":"0","label":"Solar Panel Watts Graph","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"No Data","dot":false,"ymin":"0","ymax":"5000","removeOlder":"12","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":true,"x":950,"y":620,"wires":[[],[]]},{"id":"ea7d5a00.92fc98","type":"json","z":"27cd102b.b84a5","name":"","x":499.1666564941406,"y":680.1333389282227,"wires":[["82e00190.beaf7","7e4d55bf.32c21c","dfe48fb3.070b2"]]},{"id":"82e00190.beaf7","type":"change","z":"27cd102b.b84a5","name":"Watts","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.Watts","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":690,"y":640,"wires":[["b9104a38.308a78","8ff1bdc3.68db6","3ace8642.724a7a"]]},{"id":"3ace8642.724a7a","type":"function","z":"27cd102b.b84a5","name":"Date","func":"msg.payload = Date();\nreturn msg;","outputs":1,"noerr":0,"x":950,"y":720,"wires":[["a322fa33.6a4758"]]},{"id":"a322fa33.6a4758","type":"ui_text","z":"27cd102b.b84a5","group":"bda2cbde.f2edc8","order":2,"width":0,"height":0,"name":"","label":"Solar Watts Timestamp","format":"{{msg.payload}}","layout":"row-spread","x":1150,"y":720,"wires":[]},{"id":"c9fa43ea.4a89c","type":"ui_gauge","z":"27cd102b.b84a5","name":"","group":"bda2cbde.f2edc8","order":7,"width":0,"height":0,"gtype":"gage","title":"Solar Panels - TotalKWH","label":"KW/Hours","format":"{{value}}","min":"0","max":"30","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":1510,"y":760,"wires":[]},{"id":"6d360c70.a5a9d4","type":"ui_chart","z":"27cd102b.b84a5","name":"","group":"bda2cbde.f2edc8","order":8,"width":"0","height":"0","label":"Solar Panels TotalKWH","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"No Data","dot":false,"ymin":"0","ymax":"25","removeOlder":"7","removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":true,"x":1506.0664367675781,"y":814.0666275024414,"wires":[[],[]]},{"id":"7e4d55bf.32c21c","type":"change","z":"27cd102b.b84a5","name":"TotalKWH","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.TotalKWH","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1153.9998779296875,"y":812.9999465942383,"wires":[["c9fa43ea.4a89c","6d360c70.a5a9d4","5ad57b5b.ccca94"]]},{"id":"5ad57b5b.ccca94","type":"function","z":"27cd102b.b84a5","name":"Date","func":"msg.payload = Date();\nreturn msg;","outputs":1,"noerr":0,"x":1446.0664367675781,"y":854.0666275024414,"wires":[["a1588468.e34ab8"]]},{"id":"a1588468.e34ab8","type":"ui_text","z":"27cd102b.b84a5","group":"bda2cbde.f2edc8","order":4,"width":0,"height":0,"name":"","label":"Solar Panel kW/h Timestamp","format":"{{msg.payload}}","layout":"row-spread","x":1676.0664367675781,"y":854.0666275024414,"wires":[]},{"id":"11fa3ccd.4e1303","type":"ui_gauge","z":"27cd102b.b84a5","name":"","group":"bda2cbde.f2edc8","order":1,"width":0,"height":0,"gtype":"gage","title":"BatteryVolts","label":"Volts","format":"{{value}}","min":"46","max":"63","colors":["#ff0000","#e6e600","#00b700"],"seg1":"","seg2":"","x":1810,"y":620,"wires":[]},{"id":"3b5845ba.552d8a","type":"ui_chart","z":"27cd102b.b84a5","name":"","group":"bda2cbde.f2edc8","order":9,"width":"0","height":"0","label":"BatteryVolts","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"No Data","dot":false,"ymin":"46","ymax":"63","removeOlder":"7","removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":true,"x":1806.0664367675781,"y":674.0666275024414,"wires":[[],[]]},{"id":"dfe48fb3.070b2","type":"change","z":"27cd102b.b84a5","name":"BatteryVolts","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.BatteryVolts","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1503.9998779296875,"y":672.9999465942383,"wires":[["11fa3ccd.4e1303","3b5845ba.552d8a","1a37c91a.18dd97","22d5dca9.677f94"]]},{"id":"1a37c91a.18dd97","type":"function","z":"27cd102b.b84a5","name":"Date","func":"msg.payload = Date();\nreturn msg;","outputs":1,"noerr":0,"x":1786.0664367675781,"y":714.0666275024414,"wires":[["c71c4f75.09ba8"]]},{"id":"c71c4f75.09ba8","type":"ui_text","z":"27cd102b.b84a5","group":"bda2cbde.f2edc8","order":6,"width":0,"height":0,"name":"","label":"Battery Volts Timestamp","format":"{{msg.payload}}","layout":"row-spread","x":2006.0664367675781,"y":714.0666275024414,"wires":[]},{"id":"22d5dca9.677f94","type":"function","z":"27cd102b.b84a5","name":"Set global battery volts to midnite battery volts","func":"global.set(\"battery_volts\",msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":1930,"y":580,"wires":[[]]},{"id":"884615ee.3ead88","type":"mqtt-broker","z":"","name":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"15","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""},{"id":"bda2cbde.f2edc8","type":"ui_group","z":"","name":"Darkling Power","tab":"fdc4aa12.d8f4f8","order":1,"disp":true,"width":"10","collapse":false},{"id":"fdc4aa12.d8f4f8","type":"ui_tab","z":"","name":"Home","icon":"dashboard","order":1}]
Title: Re: Node-Red to Classic Modbus for beginners
Post by: ClassicCrazy on November 04, 2018, 09:27:52 PM
thanks Jedon,
I copied your code - pasted it in my flow. But I have to go back and figure out how I did the display graphics because I don't remember how to get them up on the screen now.

Larry

Title: Re: Node-Red to Classic Modbus for beginners
Post by: jedon on December 14, 2018, 04:20:05 PM
You need to configure the dashboard using the tab on the right bar.
Title: Re: Node-Red to Classic Modbus for beginners
Post by: ClassicCrazy on December 14, 2018, 05:29:25 PM
You need to configure the dashboard using the tab on the right bar.
Thanks -- I will give that a try next time I get at it again.

Larry
Title: Re: Node-Red to Classic Modbus for beginners
Post by: ClassicCrazy on March 01, 2019, 12:03:24 PM
I watched this last night and it presents some interesting ways to use Node Red in conjunction with another program that can deal with large amounts of data and display them.

https://youtu.be/JdV4x925au0

Larry
Title: Re: Node-Red to Classic Modbus for beginners
Post by: mcsarge on December 11, 2019, 02:14:49 PM
All, I got this running on my Pi remotely - I used ngrok to forward port 502 of the Classic out from behind the firewall that the cellular company has for my cellular modem. Worked perfectly!

Matt
Title: Re: Node-Red to Classic Modbus for beginners
Post by: ClassicCrazy on December 11, 2019, 07:30:39 PM
All, I got this running on my Pi remotely - I used ngrok to forward port 502 of the Classic out from behind the firewall that the cellular company has for my cellular modem. Worked perfectly!

Matt

Good to know that you found a way to make it work !
Will look forward to seeing what kind of graphics and data you make using Node Red.
If you would like to share your Node Red flows I would be glad to see how you put it together.

Larry
Title: Re: Node-Red to Classic Modbus for beginners
Post by: mcsarge on December 13, 2019, 04:47:12 PM
Oh,

I just got the basic one setup - I did not want to do it on the remote Raspberry Pi since I will not be there until April. That way if anything goes wrong, I just break the connection.  I think I am going to put a RPi on the wall (I have a touch screen I am not using) and display the system for the family when they are there.

Matt
Title: Re: Node-Red to Classic Modbus for beginners
Post by: ClassicCrazy on December 13, 2019, 05:34:05 PM
Oh,

I just got the basic one setup - I did not want to do it on the remote Raspberry Pi since I will not be there until April. That way if anything goes wrong, I just break the connection.  I think I am going to put a RPi on the wall (I have a touch screen I am not using) and display the system for the family when they are there.

Matt

For that kind of local display it would be hard to beat Grahams Android Classic Monitoring App on any inexpensive android tablet.

Larry
Title: Re: Node-Red to Classic Modbus for beginners
Post by: mcsarge on December 14, 2019, 03:35:27 PM
Oh, that is a good idea - where can I get the app?
Title: Re: Node-Red to Classic Modbus for beginners
Post by: mcsarge on December 14, 2019, 04:02:42 PM
Never mind, I found it! Very cool and you are exactly right a cheap tablet on the wall will work great.

I ran it on my phone by using an SSH forward of the 502 port, but in the future when I deploy the newer Cradlepoint, I will just install the Perimeter network client on a tablet and the Software will think the Classic is on the local network.

I have been thinking about setting up an MQTT server on the Raspberry Pi on the island, and use it to publish the information gleaned from the Modbus interface. If I can do that, then I can have many copies of the app running since they will not be fighting to occupy port 502. I will just have to modify the app to subscribe to the MQTT subject...

Matt
Title: Re: Node-Red to Classic Modbus for beginners
Post by: ClassicCrazy on December 14, 2019, 09:21:49 PM
Never mind, I found it! Very cool and you are exactly right a cheap tablet on the wall will work great.

I ran it on my phone by using an SSH forward of the 502 port, but in the future when I deploy the newer Cradlepoint, I will just install the Perimeter network client on a tablet and the Software will think the Classic is on the local network.

I have been thinking about setting up an MQTT server on the Raspberry Pi on the island, and use it to publish the information gleaned from the Modbus interface. If I can do that, then I can have many copies of the app running since they will not be fighting to occupy port 502. I will just have to modify the app to subscribe to the MQTT subject...

Matt

good glad you found it - available on Play Store or Graham has a link to his files on the discussion. Not sure if you are also talking about the new mqtt one that he was working on . The original just works via modbus over ip . Remember though that only one modbus over ip can connect at a time - so you can't use the Local App and Grahams at the same time. Going over serial input should not interfere with those I don't think.  I was going to play around some more with the serial input I had to Classic but discovered it won't work any more when the Classics are in FollowMe mode.

Larry
Title: Re: Node-Red to Classic Modbus for beginners
Post by: ClassicCrazy on December 14, 2019, 09:27:04 PM
By the way - I have been using Amazon Fire 7 inch tablets that they sell on sale for $30 . Over the years there has been a cat and mouse game of if you could hack them and root them to get rid of Amazon operating system and put in a custom Android . It has been yes because of a flaw in firmware, then the firmware got patched by Amazon and another way was found to get around that , then Amazon patched it up , but recently a much better way was found to get control of it - at least for the 5th and 7th generations of the tablets ( not sure if newest ones they are selling are different or supported now ) . If you are interested in it read about how to do it on XDA  https://forum.xda-developers.com/amazon-fire/development/unlock-fire-t3899860

Larry
Title: Re: Node-Red to Classic Modbus for beginners
Post by: mcsarge on December 15, 2019, 11:54:41 AM
Larry,

I am an old hand at rooting Android/Fire devices, I have had Android for many years. I will try to grab one that I can hack easily. I have some access to some old Asus Android tablets which may allow me to forego doing any rooting.

I did not know that he was working on an MQTT one, that is awesome. I will work on my Modbus to MQTT program. I am only running a single Classic, so Serial would work for me. For now, though, I can write a program that connect via TCP to the Classic and load it on one of my local Pis - since I am the only one using the Local App, it will not be hard for me to stop the service while I need to use the Local App.

Matt
Title: Re: Node-Red to Classic Modbus for beginners
Post by: ClassicCrazy on December 15, 2019, 12:19:47 PM
Larry,

I am an old hand at rooting Android/Fire devices, I have had Android for many years. I will try to grab one that I can hack easily. I have some access to some old Asus Android tablets which may allow me to forego doing any rooting.

I did not know that he was working on an MQTT one, that is awesome. I will work on my Modbus to MQTT program. I am only running a single Classic, so Serial would work for me. For now, though, I can write a program that connect via TCP to the Classic and load it on one of my local Pis - since I am the only one using the Local App, it will not be hard for me to stop the service while I need to use the Local App.

Matt

Matt - take a look here
http://midniteftp.com/forum/index.php?topic=4464.0

Larry