TL;DR
Can I read MODBUS registers (like these) directly from a device using Node Red using /dev/ttyUSB0? I just cant seem to make it work, mainly due to my very narrow scope of knowledge.
My current setup is a raspberry pi with a USB to RS485 Converter which is connected to my Epever 4210AN charge controller. Using these instructions as a foundation, I can read data from the solar charge controller that gets stored to a MySql database, this works great but I would love to have direct access to the charge controller via /dev/ttyUSB0. This is the current flow:
[{"id":"667e4b4.2c2ddb4","type":"tab","label":"Home","disabled":false,"info":""},{"id":"10052ee4.e1cb29","type":"mysql","z":"667e4b4.2c2ddb4","mydb":"b1efcb9b.8e44a8","name":"Solardata","x":340,"y":340,"wires":[["b33a969a.d67fa8"]]},{"id":"17e917a.b349668","type":"inject","z":"667e4b4.2c2ddb4","name":"","topic":"SELECT `timestamp`, `PV array voltage`, `PV array current`, `PV array power`, `Battery voltage`, `Battery charging current`, `Battery charging power`, `Load voltage`, `Load current`, `Load power`, `Battery temperature`, `Charger temperature`, `Heat sink temperature`, `Battery SOC`, `Remote battery temperature`, `System rated voltage`, `Battery status`, `Equipment status` FROM `stats` ORDER BY `timestamp` DESC LIMIT 1 ","payload":"","payloadType":"str","repeat":"10","crontab":"","once":false,"onceDelay":"1","x":150,"y":280,"wires":[["10052ee4.e1cb29"]]},{"id":"76c4ef38.d037a8","type":"ui_gauge","z":"667e4b4.2c2ddb4","name":"Battery Voltage","group":"45d13185.8fc46","order":4,"width":"6","height":"6","gtype":"gage","title":"Battery voltage","label":"Volts","format":"{{value}} V","min":"10","max":"14.4","colors":["#b50012","#ffff00","#00ff00"],"seg1":"11","seg2":"12.3","x":920,"y":220,"wires":[]},{"id":"b33a969a.d67fa8","type":"function","z":"667e4b4.2c2ddb4","name":"parse data","func":"var pvvoltage = msg.payload[0]['PV array voltage'];\nvar pvcurrent = msg.payload[0]['PV array current'];\nvar pvpower = msg.payload[0]['PV array power'];\nvar voltage = msg.payload[0]['Battery voltage'];\nvar battcurrent = msg.payload[0]['Battery charging current'];\nvar battpower = msg.payload[0]['Battery charging power'];\nvar battsoc = msg.payload[0]['Battery SOC'];\nvar loadvoltage = msg.payload[0]['Load voltage'];\nvar loadcurrent = msg.payload[0]['Load current'];\nvar loadpower = msg.payload[0]['Load power'];\nvar systemvoltage = msg.payload[0]['System rated voltage'];\nvar chargertemp = msg.payload[0]['Charger temperature'];\nvar batterytemp = msg.payload[0]['Battery temperature'];\nvar BattStatus = msg.payload[0]['Battery status'];\nvar chargerStatus = msg.payload[0]['Equipment status'];\nvar time = msg.payload[0]['timestamp'];\n\nif ((msg.payload.indexOf('Database') === -1) && msg.topic.indexOf('Database') === -1){\n\n\nvar msg1 = {topic:\"PV array voltage\", payload: pvvoltage};\nvar msg2 = {topic:\"PV array current\", payload: pvcurrent};\nvar msg3 = {topic:\"PV array power\", payload: pvpower};\nvar msg4 = {topic:\"Battery voltage\", payload: voltage};\nvar msg5 = {topic:\"Battery charging current\", payload: battcurrent};\nvar msg6 = {topic:\"Battery charging power\", payload: battpower};\nvar msg7 = {topic:\"Battery SOC\", payload: battsoc};\nvar msg8 = {topic:\"[`Load voltage`]\", payload: loadvoltage};\nvar msg9 = {topic:\"[`Load current`]\", payload: loadcurrent};\nvar msg10 = {topic:\"[`Load power`]\", payload: loadpower};\nvar msg11 = {topic:\"[`System rated voltage`]\", payload: systemvoltage};\nvar msg12 = {topic:\"[`Charger temperature`]\", payload: chargertemp};\nvar msg13 = {topic:\"[`Battery temperature`]\", payload: batterytemp};\nvar msg14 = {topic:\"[`Battery status`]\", payload: BattStatus};\nvar msg15 = {topic:\"[`Equipment status`]\", payload: chargerStatus};\nvar msg16 = {topic:\"[`timestamp`]\", payload: time};\n\nreturn [msg1,msg2,msg3,msg4,msg5,msg6,msg7,msg8,msg9,msg10,msg11,msg12,msg13,msg14,msg15,msg16];\n\n} else {\nreturn;\n}\n","outputs":16,"noerr":0,"x":530,"y":340,"wires":[["96f15064.623d08","2859335a.645c1c"],["96f15064.623d08","fcce6d79.bd5cc8"],["96f15064.623d08","e6f7ee90.a612f8"],["9e8f4740.2c9988","76c4ef38.d037a8","da8bfe82.6c27e8"],["9e8f4740.2c9988","9d2d8726.81c89"],["9e8f4740.2c9988","59a9024.73bfa7c"],["b0ca5242.a7d528"],["904e4906.1d825"],["5918bab0.0a7f74","2a205d54.c55962"],["52303b34.1b74c4"],["59da7916.cfab"],["b7599030.e45248"],["5a505a49.e54474"],["70d5e82b.9d8288"],["c1854510.93c628"],["23999d1e.2ff562"]]},{"id":"96f15064.623d08","type":"ui_chart","z":"667e4b4.2c2ddb4","name":"PV Performance","group":"3808d133.fb735e","order":1,"width":"20","height":"9","label":"Recent PV Performance","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"","removeOlder":"24","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":true,"x":1260,"y":380,"wires":[[],[]]},{"id":"2859335a.645c1c","type":"ui_gauge","z":"667e4b4.2c2ddb4","name":"PV Volts","group":"45d13185.8fc46","order":1,"width":"6","height":"6","gtype":"gage","title":"PV Volts","label":"Volts","format":"{{value}} V","min":"0","max":"60","colors":["#ff0000","#ffff00","#00ff00"],"seg1":"5","seg2":"30","x":900,"y":80,"wires":[]},{"id":"9d2d8726.81c89","type":"ui_gauge","z":"667e4b4.2c2ddb4","name":"","group":"45d13185.8fc46","order":5,"width":"6","height":"6","gtype":"gage","title":"Battery charging current","label":"Amps","format":"{{value}} A","min":0,"max":10,"colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":950,"y":260,"wires":[]},{"id":"59a9024.73bfa7c","type":"ui_gauge","z":"667e4b4.2c2ddb4","name":"Battery Charging Watts","group":"45d13185.8fc46","order":6,"width":"6","height":"6","gtype":"gage","title":"Battery charging power","label":"Watts","format":"{{value}} W","min":0,"max":"200","colors":["#00b500","#e6e600","#ca3838"],"seg1":"50","seg2":"100","x":950,"y":300,"wires":[]},{"id":"fcce6d79.bd5cc8","type":"ui_gauge","z":"667e4b4.2c2ddb4","name":"PV Amps","group":"45d13185.8fc46","order":2,"width":"6","height":"6","gtype":"gage","title":"PV Amps","label":"Amps","format":"{{value}} A","min":"0","max":"10","colors":["#ff0000","#ffff00","#00ff00"],"seg1":"1","seg2":"5","x":900,"y":120,"wires":[]},{"id":"e6f7ee90.a612f8","type":"ui_gauge","z":"667e4b4.2c2ddb4","name":"PV Watts","group":"45d13185.8fc46","order":3,"width":"6","height":"6","gtype":"gage","title":"PV Watts","label":"Watts","format":"{{value}} W","min":"0","max":"200","colors":["#00e606","#00e606","#ca3838"],"seg1":"","seg2":"100","x":900,"y":160,"wires":[]},{"id":"9e8f4740.2c9988","type":"ui_chart","z":"667e4b4.2c2ddb4","name":"Battery Performance","group":"3808d133.fb735e","order":3,"width":"20","height":"7","label":"Recent Battery Performance","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"","removeOlder":"36","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":true,"x":1280,"y":420,"wires":[[],[]]},{"id":"b0ca5242.a7d528","type":"ui_gauge","z":"667e4b4.2c2ddb4","name":"Battery SoC","group":"b9d11553.55a72","order":5,"width":"6","height":"6","gtype":"gage","title":"Battery SOC","label":"","format":"{{value}} %","min":0,"max":"100","colors":["#ff0000","#e6e600","#80ff00"],"seg1":"25","seg2":"50","x":910,"y":340,"wires":[]},{"id":"b10f8444.3004a","type":"ui_text","z":"667e4b4.2c2ddb4","group":"b9d11553.55a72","order":2,"width":"0","height":"0","name":"Charger status","label":"Charger status","format":"<font color= {{msg.color}}> <font size=\"3\"> {{msg.label}} </font></font> <i class=\"{{msg.icon}}\"></i>","layout":"row-spread","x":1060,"y":760,"wires":[]},{"id":"1e1204ee.e54453","type":"ui_text","z":"667e4b4.2c2ddb4","group":"b9d11553.55a72","order":3,"width":"0","height":"0","name":"BattStatus","label":"BattStatus","format":"<font color= {{msg.colour}}> {{msg.label}} </font> <i class=\"{{msg.icon}}\"></i>","layout":"row-spread","x":1050,"y":680,"wires":[]},{"id":"904e4906.1d825","type":"ui_gauge","z":"667e4b4.2c2ddb4","name":"Load Voltage","group":"45d13185.8fc46","order":7,"width":"6","height":"6","gtype":"gage","title":"Load Voltage","label":"Volts","format":"{{value}} V","min":"10","max":"14.4","colors":["#b50012","#ffff00","#00ff00"],"seg1":"11","seg2":"12.3","x":910,"y":400,"wires":[]},{"id":"5918bab0.0a7f74","type":"ui_gauge","z":"667e4b4.2c2ddb4","name":"Load Current","group":"45d13185.8fc46","order":8,"width":"6","height":"6","gtype":"gage","title":"Load current","label":"Amps","format":"{{value}} A","min":0,"max":10,"colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":910,"y":440,"wires":[]},{"id":"52303b34.1b74c4","type":"ui_gauge","z":"667e4b4.2c2ddb4","name":"Load Power","group":"45d13185.8fc46","order":9,"width":"6","height":"6","gtype":"gage","title":"Load Power","label":"Watts","format":"{{value}} W","min":0,"max":"200","colors":["#00b500","#e6e600","#ca3838"],"seg1":"50","seg2":"100","x":910,"y":480,"wires":[]},{"id":"59da7916.cfab","type":"ui_text","z":"667e4b4.2c2ddb4","group":"b9d11553.55a72","order":4,"width":"0","height":"0","name":"systemvoltage","label":"System Voltage","format":"{{msg.payload}} Volts","layout":"row-spread","x":920,"y":540,"wires":[]},{"id":"5a505a49.e54474","type":"ui_gauge","z":"667e4b4.2c2ddb4","name":"Battery Temp","group":"b9d11553.55a72","order":6,"width":"4","height":"4","gtype":"donut","title":"Battery Temp","label":"C","format":"{{value}}","min":0,"max":"80","colors":["#00b500","#e6e600","#ca3838"],"seg1":"28","seg2":"40","x":910,"y":620,"wires":[]},{"id":"b7599030.e45248","type":"ui_gauge","z":"667e4b4.2c2ddb4","name":"Charger Temp","group":"b9d11553.55a72","order":7,"width":"4","height":"4","gtype":"donut","title":"Charger Temp","label":"C","format":"{{value}}","min":0,"max":"80","colors":["#00b500","#e6e600","#ca3838"],"seg1":"28","seg2":"40","x":920,"y":580,"wires":[]},{"id":"70d5e82b.9d8288","type":"function","z":"667e4b4.2c2ddb4","name":"Battery Status","func":"var bs = +msg.payload;\nvar b = 0b11 & (bs >> 2);\n//var b = msg.payload[0]['Battery status'];\n//bl = 0b1111 & b;\n\n\n switch (b) {\n case 0: \n var bStatus = \"Normal\";\n msg.label = bStatus;\n //msg.colour = \"#45B222\";\n msg.icon = \"fa fa-thumbs-up fa-2x nr-dashboard-ok\"\n return msg;\n case 1: \n var bStatus = \"<font color=\\\"red\\\">Overvolt</font>\";\n msg.label = bStatus;\n msg.colour = \"red\";\n msg.background = \"green\";\n \n return msg;\n case 2: \n var bStatus = \"<font color=\\\"yellow\\\">Undervolt</font>\";\n msg.label = bStatus;\n msg.colour = \"red\";\n msg.background = \"green\";\n return msg;\n case 3: \n var bStatus = \"<font color=\\\"red\\\">Low volt disconnect</font>\";\n msg.label = bStatus;\n msg.colour = \"yellow\";\n msg.background = \"green\";\n return msg;\n case 4: \n {\n var bStatus = \"<font color=\\\"red\\\">FAULT</font>\";\n msg.label = bStatus;\n msg.colour = \"red\";\n msg.background = \"green\";\nreturn msg;\n }\n }","outputs":1,"noerr":0,"x":820,"y":680,"wires":[["1e1204ee.e54453"]]},{"id":"c1854510.93c628","type":"function","z":"667e4b4.2c2ddb4","name":"Charger Status","func":"var equipStatus = +msg.payload;\nvar chargStatus = 0b11 & (equipStatus >> 2);\n\nswitch (chargStatus) {\ncase 0: \n var eStatus = \"Not charging\";\n msg.label = eStatus;\n msg.icon = \"fa fa-bed fa-2x nr-dashboard-ok\"\n //node.warn(\"0\");\n return msg;\n \ncase 1: \n eStatus = \"Float (13.8V)\";\n msg.label = eStatus;\n msg.icon = \"fa fa-ship fa-2x nr-dashboard-ok\"\n //node.warn(\"1\");\n return msg;\n\ncase 2: \n var eStatus = \"Boost (14.4V)\";\n msg.label = eStatus;\n msg.icon = \"fa fa-rocket fa-2x nr-dashboard-ok\"\n //node.warn(\"2\");\n return msg;\n\ncase 3: \n var eStatus = \"Equalization (14.6V)\";\n msg.label = eStatus;\n //node.warn(\"3\");\n return msg;\n}\n\nif (equipStatus >> 4) {\n var eStatus = \"FAULT\";\n msg.label = eStatus;\n //node.warn(\"4\");\n return msg;\n}","outputs":1,"noerr":0,"x":820,"y":740,"wires":[["b10f8444.3004a"]]},{"id":"65962744.f35fb8","type":"ui_text","z":"667e4b4.2c2ddb4","group":"b9d11553.55a72","order":9,"width":"4","height":"1","name":"","label":"","format":"<font color= {{msg.colour}}> {{msg.label}} </font> <i class=\"{{msg.icon}}\"></i>","layout":"row-spread","x":430,"y":760,"wires":[]},{"id":"2a205d54.c55962","type":"function","z":"667e4b4.2c2ddb4","name":"Load Status","func":"var loadcurrent = +msg.payload\nif(loadcurrent == 0){\n msg.label = \"Load Off\";\n msg.payload = 0\n msg.topic = \"state\"\n msg.colour = \"#000\";\n msg.background = \"green\";\n msg.icon = \"fa fa-lightbulb-o fa-2x nr-dashboard-error\"\n return msg;\n}\n\n\nelse{\n msg.label = \"Load On\";\n msg.payload = 1\n msg.topic = \"state\"\n msg.colour = \"#f44242\";\n msg.background = \"red\";\n msg.icon = \"fa fa-lightbulb-o fa-2x nr-dashboard-ok\"\n return msg;\n}\nreturn msg;","outputs":1,"noerr":0,"x":230,"y":760,"wires":[["65962744.f35fb8","660d9be2.705d54"]]},{"id":"660d9be2.705d54","type":"ui_switch","z":"667e4b4.2c2ddb4","name":"","label":"Load on/off","group":"b9d11553.55a72","order":8,"width":"4","height":"1","passthru":false,"decouple":"false","topic":"state","style":"","onvalue":"1","onvalueType":"num","onicon":"","oncolor":"","offvalue":"0","offvalueType":"num","officon":"","offcolor":"","x":310,"y":860,"wires":[["60165eb.f4e742","3397a8db.f117"]]},{"id":"70e4f86d.0164d8","type":"switch","z":"667e4b4.2c2ddb4","name":"","property":"override","propertyType":"global","rules":[{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":290,"y":960,"wires":[["60165eb.f4e742"]]},{"id":"f8cbd4d7.4d641","type":"change","z":"667e4b4.2c2ddb4","name":"global override","rules":[{"t":"set","p":"override","pt":"global","to":"on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":665.0000076293945,"y":922.5,"wires":[["bad329ad.5b5998"]]},{"id":"3397a8db.f117","type":"switch","z":"667e4b4.2c2ddb4","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":482.50000762939453,"y":943.75,"wires":[["f8cbd4d7.4d641"],["a90d2335.99f42"]]},{"id":"a90d2335.99f42","type":"change","z":"667e4b4.2c2ddb4","name":"global override","rules":[{"t":"set","p":"override","pt":"global","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":667.5,"y":962.4999866485596,"wires":[["4fa01470.91178c"]]},{"id":"bad329ad.5b5998","type":"exec","z":"667e4b4.2c2ddb4","command":"sudo ./loadon.sh","addpay":true,"append":"","useSpawn":"false","timer":"5","oldrc":false,"name":"Turn Load On","x":1032.5000076293945,"y":885.0000019073486,"wires":[[],[],[]]},{"id":"4fa01470.91178c","type":"exec","z":"667e4b4.2c2ddb4","command":"sudo ./loadoff.sh","addpay":false,"append":"","useSpawn":"false","timer":"5","oldrc":false,"name":"Turn Load Off","x":1032.5000076293945,"y":965.0000019073486,"wires":[[],[],[]],"outputLabels":["Normal","",""]},{"id":"60165eb.f4e742","type":"smartswitch","z":"667e4b4.2c2ddb4","name":"switch","topic":"main","timeout":"0","x":550,"y":860,"wires":[[]]},{"id":"da8bfe82.6c27e8","type":"function","z":"667e4b4.2c2ddb4","name":"Battery Voltage Alert","func":"var voltage = +msg.payload\n\nif (voltage <= 11) {\n\nmsg = {\n payload :\"Battery level is low (\" + msg.payload + \" volts) - \" + Date().toString(),\n topic : \"Alert!\",\n}\n return msg;\n}","outputs":1,"noerr":0,"x":1280,"y":480,"wires":[["cc105bc5.27c3a"]]},{"id":"cc105bc5.27c3a","type":"e-mail","z":"667e4b4.2c2ddb4","server":"smtp.gmail.com","port":"465","secure":true,"name":"2088500464@vzwpix.com","dname":"Gmail","x":1490,"y":480,"wires":[]},{"id":"dc719985.5a6bd","type":"ui_text","z":"667e4b4.2c2ddb4","group":"b9d11553.55a72","order":1,"width":0,"height":0,"name":"","label":"TIme","format":"{{msg.payload}}","layout":"row-spread","x":1410,"y":600,"wires":[]},{"id":"23999d1e.2ff562","type":"moment","z":"667e4b4.2c2ddb4","name":"UTC-6","topic":"UTC-6","input":"payload","inputType":"msg","inTz":"ETC/GMT-6","adjAmount":0,"adjType":"days","adjDir":"add","format":"HH:mm:ss - ddd Do MMM YYYY","locale":"en_US","output":"payload","outputType":"msg","outTz":"America/Boise","x":1230,"y":600,"wires":[["dc719985.5a6bd"]]},{"id":"b1efcb9b.8e44a8","type":"MySQLdatabase","z":"","host":"127.0.0.1","port":"3306","db":"solardata","tz":""},{"id":"45d13185.8fc46","type":"ui_group","z":"","name":"Dashboard","tab":"c569e95d.e2ea7","order":3,"disp":true,"width":"20","collapse":true},{"id":"3808d133.fb735e","type":"ui_group","z":"","name":"Graphs","tab":"1efaaf44.9015f1","order":1,"disp":true,"width":"20","collapse":false},{"id":"b9d11553.55a72","type":"ui_group","z":"","name":"Status","tab":"c569e95d.e2ea7","order":4,"disp":true,"width":"8","collapse":true},{"id":"c569e95d.e2ea7","type":"ui_tab","z":"","name":"Home","icon":"dashboard","order":1},{"id":"1efaaf44.9015f1","type":"ui_tab","z":"","name":"Stats","icon":"dashboard","order":2}]
I would love to get direct access to charge controller so i can get data faster. I've attempted this flow as a start to help me understand the fundamentals but they still escape me. Do i need a MODBUS server and Modbus Read and a MODBUS response to get the information? And is a register the same as an address?
Any help would be appreciated, thank you.