6 Archivos adjunto(s)
[NODERED] Conexion con PYLONTECH via console port
En este hilo vamos a intentar sacar un flujo de datos desde baterias pylontech por puerto consola que es un puerto serie RS232 de toda la vida.
Es importante destacar que ha habido un cambio a la hora de escribir este hilo y es que el conector de consola ha cambiado de unas USx000B a USx000C. En el primero es un RJ11 y en el segundo un RJ45.
Archivo adjunto 24475
Archivo adjunto 24476
Una imagen de un conversor RS232-USB con chipset PL2303 para RJ45 :
Archivo adjunto 24477
La mejor forma de identificar en nuestra raspberry PI los conversores es modificando el archivo rules en etc/udev/rules.d/99-conversores.rules
La identificacion podemos hacerla por product/vendor del conversor si tenemos varios conversores de diferente marca o bien tendriamos que hacerla por direccion fisica del conector usb si tuvieramos conversores de la misma marca.
Voy a hacerla por product/vendor para varios conversores de diferente marca.
Imaginamos que tenemos dos conversores USB-RS232 de este tipo al hacer un lsusb en consola:
raspberrypi:~ $ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter -- (Pylon)
Bus 001 Device 003: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port -- (MAX)
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Aqui tenemos un QinHeng y un PL2303, uno lo usamos para las Pylontech y otro para el Axpert Max.
Para no tener que ir cambiando el ttyUSB en el nodo serial lo mejor es fijarlo en el archivo etc/udev/rules.d/99-conversores.rules de la siguiente forma:
Archivo 99-conversores.rules
ACTION==”add”, SUBSYSTEM=="tty", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", SYMLINK+="pylontech"
ACTION==”add”, SUBSYSTEM=="tty", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", SYMLINK+="axpertmax"
Reiniciamos la raspberry pi y en el directorio /dev deberiamos de ver los symlink pylontech y axpertmax apuntando a sus respectivos ttyUSBx. De esta forma en el nodo serial solo tendremos que poner
/dev/pylontech para referirnos al conversor para las baterias o /dev/axpertmax para el conversor hacia el hibrido independientemente de si son ttyUSB0, 1, 2 etc.
*********** Apartado para varios conversores con el mismo chipset ******* Saltar este paso si no es el caso*******
Si tuvieramos varios conversores con el mismo chipset conectados a la raspberry pi este archivo rules no nos valdria y tendriamos que usar otro archivo donde fijaramos el symlink al conector fisico usb de la raspberry pi.
Imaginad que tuvieramos dos conversores PL2303, uno a las pylontech y otro al hibrido.
El archivo 99-conversores.rules tendria una forma de este tipo:
ACTION=="add", SUBSYSTEM=="tty", ENV{ID_PATH_TAG}=="platform-3f980000_usb-usb-0_1_4_1_0", SYMLINK+="axpertmax"
ACTION=="add", SUBSYSTEM=="tty", ENV{ID_PATH_TAG}=="platform-3f980000_usb-usb-0_1_5_1_0", SYMLINK+="undispositivo"
ACTION=="add", SUBSYSTEM=="tty", ENV{ID_PATH_TAG}=="platform-3f980000_usb-usb-0_1_2_1_0", SYMLINK+="pylontech"
ACTION=="add", SUBSYSTEM=="tty", ENV{ID_PATH_TAG}=="platform-3f980000_usb-usb-0_1_3_1_0", SYMLINK+="otrodispositivo"
En este caso los platform apuntan a un conector USB concreto de la raspberry Pi.
Para una raspberry Pi3 estos serian los punteros platform:
Archivo adjunto 24478
************************************************** ************************************************** *************************************************
Una vez tenemos ya los conversores identificados para nuestro nodo serie vamos a hacer el flujo de conexion con la pylontech
El puerto de consola de las pylontech por defecto trae 1200 baudios 8N1.
Podemos configurar la velocidad de conexion a 115200 baudios lanzando este buffer hacia el puerto consola desde una conexion 1200,8,N,1
7E 32 30 30 31 34 36 38 32 43 30 30 34 38 35 32 30 46 43 43 33 0D
De esta forma el puerto consola pasara a ser un 115200,8,N,1 siendo la conexion serie mucho mas rapida.
Esto se haria de esta forma en node red:
Archivo adjunto 24482
Con este flujo: Código HTML:
[{"id":"68321624.12cd78","type":"serial request","z":"59ef5e12.0051b","name":"Pylontech","serial":"8a30ba0c.911268","x":530,"y":100,"wires":[["5071b408.d65ccc"]]},{"id":"8a30ba0c.911268","type":"serial-port","z":"","serialport":"/dev/pylontech","serialbaud":"1200","databits":"8","parity":"none","stopbits":"1","waitfor":"","dtr":"none","rts":"none","cts":"none","dsr":"none","newline":"\\r","bin":"false","out":"char","addchar":"","responsetimeout":"10000"}]
Para ver si nuestra conexion 115200,8,N,1 con el conversor funciona vamos a injectar un comando info segun este flujo:
Archivo adjunto 24483
Código HTML:
[{"id":"1bb0ce15.003722","type":"inject","z":"59ef5e12.0051b","name":"Info","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Info","payload":"[105,110,102,111,13]","payloadType":"bin","x":200,"y":100,"wires":[["68321624.12cd78"]]}]
Y hasta aqui voy a parar a ver si verdaderamente funciona o no. Como no tengo pylontech, veamos si algun forero con pylontech y nodered lo puede corroborar. Si funcionase y mandase respuesta al comando info ya solo habria que tratar esa respuesta con un nodo funcion para extraer los datos y presentarlos en un JSON para postproceso en tablas, dashboard, mqtt, etc.
Posteriormente se podrian usar mas comandos tipo pwrsys, etc para sacar mas info de las baterias. Cada comando llevaria su nodo extractor y salida JSON.
Lo que no se tampoco es si la bateria en consola se pone primero en pylon> prompt o se pone directamente en pylon_debug> prompt. El comando info y demas comandos de datos tiene que ser en pylon_debug> Es lo malo de no tener esas baterias para saber estas cosas tan elementales a la hora de hacer un flujo.
Re: [NODERED] Conexion con PYLONTECH via console port
Cita:
Iniciado por
TjObie The flow
Código HTML:
[{"id":"38c7c06f.91bde","type":"tab","label":"Pylon Connection","disabled":false,"info":""},{"id":"ef1c7c5b.d906","type":"comment","z":"38c7c06f.91bde","name":"RS232-USB PL2303 or FTDI Conversor transparente (NO TTL)","info":"","x":470,"y":60,"wires":[]},{"id":"4905e6b9.67a498","type":"debug","z":"38c7c06f.91bde","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":770,"y":100,"wires":[]},{"id":"be30c92d.24a888","type":"serial request","z":"38c7c06f.91bde","name":"Get Pylon Batteries","serial":"a4822951.b73cc8","x":570,"y":120,"wires":[["4905e6b9.67a498"]]},{"id":"d35c1d3f.4263","type":"inject","z":"38c7c06f.91bde","name":"Pylon INFO","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Get the Pylon values INFO","payload":"\"info\\n\"","payloadType":"jsonata","x":170,"y":200,"wires":[["2e3e8822.35bb68"]]},{"id":"1f93bd3e.c85453","type":"inject","z":"38c7c06f.91bde","name":"Pylon PWR","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Get the Pylon values PWR","payload":"\"pwr\\n\"","payloadType":"jsonata","x":170,"y":240,"wires":[["2e3e8822.35bb68"]]},{"id":"a283d8aa.8cf0c8","type":"inject","z":"38c7c06f.91bde","name":"Pylon PWRSYS","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Get the Pylon values PWRSYS","payload":"\"pwrsys\\n\"","payloadType":"jsonata","x":180,"y":280,"wires":[["2e3e8822.35bb68"]]},{"id":"2e3e8822.35bb68","type":"link out","z":"38c7c06f.91bde","name":"SendToSerialConverter","links":["ad93eb1f.0e10d8"],"x":365,"y":200,"wires":[]},{"id":"ad93eb1f.0e10d8","type":"link in","z":"38c7c06f.91bde","name":"GetBatteryData","links":["2e3e8822.35bb68"],"x":395,"y":120,"wires":[["be30c92d.24a888"]]},{"id":"28f3fa92.87e8b6","type":"inject","z":"38c7c06f.91bde","name":"Pylon SOCD","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Get the Pylon values SOCD","payload":"\"socd\\n\"","payloadType":"jsonata","x":170,"y":320,"wires":[["2e3e8822.35bb68"]]},{"id":"9a904c9a.d0ada","type":"inject","z":"38c7c06f.91bde","name":"Pylon SOCD","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Get the Pylon values SOH","payload":"\"soh\\n\"","payloadType":"jsonata","x":170,"y":360,"wires":[["2e3e8822.35bb68"]]},{"id":"a4822951.b73cc8","type":"serial-port","serialport":"/dev/ttyUSB1","serialbaud":"115200","databits":"8","parity":"none","stopbits":"1","waitfor":"","dtr":"none","rts":"none","cts":"none","dsr":"none","newline":"\\n","bin":"false","out":"char","addchar":"","responsetimeout":"2000"}]
Try that:
Código HTML:
[{"id":"717af324.4d6cbc","type":"comment","z":"1906516a.4125ef","name":"RS232-USB PL2303 or FTDI Conversor transparente (NO TTL)","info":"","x":470,"y":60,"wires":[]},{"id":"33cbff76.f207b","type":"debug","z":"1906516a.4125ef","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":770,"y":100,"wires":[]},{"id":"b44c894.e086578","type":"serial request","z":"1906516a.4125ef","name":"Get Pylon Batteries","serial":"f9a3a1fe.cc3a7","x":570,"y":120,"wires":[["33cbff76.f207b"]]},{"id":"546456da.829698","type":"inject","z":"1906516a.4125ef","name":"Pylon INFO","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Get the Pylon values INFO","payload":"[105,110,102,111,13]","payloadType":"bin","x":170,"y":200,"wires":[["740d3c66.42e8d4"]]},{"id":"4f3f9020.ef044","type":"inject","z":"1906516a.4125ef","name":"Pylon PWR","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Get the Pylon values PWR","payload":"[112,119,114,13]","payloadType":"bin","x":170,"y":240,"wires":[["740d3c66.42e8d4"]]},{"id":"9e9f426.5a94cc","type":"inject","z":"1906516a.4125ef","name":"Pylon PWRSYS","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Get the Pylon values PWRSYS","payload":"[112,119,114,115,121,115,13]","payloadType":"bin","x":180,"y":280,"wires":[["740d3c66.42e8d4"]]},{"id":"740d3c66.42e8d4","type":"link out","z":"1906516a.4125ef","name":"SendToSerialConverter","links":["2cb13ea3.7eded2"],"x":365,"y":200,"wires":[]},{"id":"2cb13ea3.7eded2","type":"link in","z":"1906516a.4125ef","name":"GetBatteryData","links":["740d3c66.42e8d4"],"x":395,"y":120,"wires":[["b44c894.e086578"]]},{"id":"3d139ecc.224d12","type":"inject","z":"1906516a.4125ef","name":"Pylon SOCD","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Get the Pylon values SOCD","payload":"[115,111,99,100,13]","payloadType":"bin","x":170,"y":320,"wires":[["740d3c66.42e8d4"]]},{"id":"7050cec4.747c1","type":"inject","z":"1906516a.4125ef","name":"Pylon SOH","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Get the Pylon values SOH","payload":"[115,111,104,13]","payloadType":"bin","x":160,"y":360,"wires":[["740d3c66.42e8d4"]]},{"id":"f9a3a1fe.cc3a7","type":"serial-port","z":"","serialport":"/dev/ttyUSB1","serialbaud":"115200","databits":"8","parity":"none","stopbits":"1","waitfor":"","dtr":"none","rts":"none","cts":"none","dsr":"none","newline":"\\r","bin":"false","out":"char","addchar":"","responsetimeout":"2000"}]
7 Archivos adjunto(s)
Re: [NODERED] Connection with PYLONTECH via console port
OK 2 things
Firstly the SYMLINKS is not working
I add the converters.rules with the two lines but nothing when I reboot
Getting error 'device not found' in NodeRed when I use /dev/pylontech or /dev/axpertmax in the serial node...
Archivo adjunto 24493
I am using a Pi 4 (maybe something different)
Secondly
I added the 1st Serial node at 1200 1n8 and injected
7E 32 30 30 31 34 36 38 32 43 30 30 34 38 35 32 30 46 43 43 33 0D
I then go to 2nd Serial Node at 11500 1N8 and inject [105,110,102,111,13]
Nothing happens ...
I then rebooted Pi and in minicom opened the port /dev/USB1 and I get
Archivo adjunto 24495
Then I press 'Enter' and I get the 'Pylon_Debug>' promp...
Archivo adjunto 24496
I then quit minicom and go back to NODERED and inject [105,110,102,111,13] or "info\n" into the 2nd Serial
Archivo adjunto 24501
And I get in the Debug window....
Archivo adjunto 24497
I had to setup the serial port
Archivo adjunto 24500
Then tried "pwr\n" and "pwrsys\n"
Archivo adjunto 24499
The only problem now is that the initilize is not working and every time I 'Deploy' I have to go back to minicom and open port again then 'Enter' before I can carry on....
Getting somewhere at least...
Any ideas
1 Archivos adjunto(s)
Re: [NODERED] Conexion con PYLONTECH via console port
1.- I think you write incorrectly 99-converter.rules .
Lines on this file are:
ACTION==”add”, SUBSYSTEM=="tty", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", SYMLINK+="pylontech"
ACTION==”add”, SUBSYSTEM=="tty", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", SYMLINK+="axpertmax"
In your screenshot console I dont see "==" between ACTION and "add" and more. Please fix lines as above. Copy and paste correctly.
If you write correctly and reboot PI, you has to watch on /dev directory some files with pylontech and axpertmax names symlinked to ttyUSBx device.
2.- pylon_debug> prompt is mandatory to send info, pwr, pwrsys commands. I think when you access console port pylontech at first, prompt is only pylon> If you return command (/r) you get pylon_debug> prompt. /r is 13 in decimal byte buffer or 0D in hexadecimal byte buffer.
Then you need an inject node only with /r command linked to serial node like that:
Archivo adjunto 24504
Código HTML:
[{"id":"e8749e93.8e4c","type":"inject","z":"1906516a.4125ef","name":"Init pylon_debug prompt","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"Init pylon_debug prompt","payload":"[13]","payloadType":"bin","x":610,"y":140,"wires":[[]]}]
I think /n command is not necessary at the end. /n is 10 in decimal byte buffer or 0A in hexadecimal byte buffer. I only put 13 as end byte on commands.
Try commands without /n /n is new line and is different from /r (return carriage)
Pd: 7E 32 30 30 31 34 36 38 32 43 30 30 34 38 35 32 30 46 43 43 33 0D is only to setup 115200 baud on console port. Its not necessary to do that if console port is 115200 baud. Only it has to do when console port is on 1200 baud (default mode).
Pd2: If you setup on serial node split $$ at input i dont think you can get nothing. Last byte on input inject node commands is /r or 13 in decimal format. Try /r on setup serial node.
1 Archivos adjunto(s)
Re: [NODERED] Conexion con PYLONTECH via console port
OK
I tried to copy the Symlinks again and noticed that the problem was in Google Translation... It was translating the lines very differently.
I will copy and try the new ones later.
In the mean time I restarted the batteries and the whole system this morning and this morning.
When I first started up the battery port was in 1200 1N8 and I then send the string
7E 32 30 3 31 34 36 38 32 43 30 30 34 38 35 32 30 46 43 43 33 0D
I then changed to the Serial node to 11500 1n8 baud rate and send anything to the batteries.
I get the response Pylon> back
If I send "info\n" and "help\n"
Archivo adjunto 24505
If it will help I am happy that you log into the Pi with VNC and check for yourself.
It may be easier for you to check. I can PM you the VNC details?
(I am still stupid on the Pi as I only started to experiment a month ago and still have to google everything I need to do)
1 Archivos adjunto(s)
Re: [NODERED] Conexion con PYLONTECH via console port
We think problem timeout node serial is QinHeng Electronics HL-340 USB-Serial adapter. May be this converter dont manage correctly 115200 baud.
I think PL2303 converter is better than QinHeng converter.
Then if you connect two PL2303 converter at the same RPi you need modify 99-converter.rules like I posted in #1, but if you use RPi4 rules are different from RPi3.
For RPi4 if you use unique USB connector to differentiate them, 99-converter.rules will be:
SUBSYSTEM=="tty", ENV{ID_PATH_TAG}=="platform-fd500000_pcie-pci-0000_01_00_0-usb-0_1_3_1_0", SYMLINK+="axpertmax"
SUBSYSTEM=="tty", ENV{ID_PATH_TAG}=="platform-fd500000_pcie-pci-0000_01_00_0-usb-0_1_1_1_0", SYMLINK+="onedevice"
SUBSYSTEM=="tty", ENV{ID_PATH_TAG}=="platform-fd500000_pcie-pci-0000_01_00_0-usb-0_1_4_1_0", SYMLINK+="pylontech"
SUBSYSTEM=="tty", ENV{ID_PATH_TAG}=="platform-fd500000_pcie-pci-0000_01_00_0-usb-0_1_2_1_0", SYMLINK+="anotherdevice"
Then axpertmax and pylontech pl2303 converters will be on USB 2.0 connectors perfectly differentiated to /dev/pylontech and /dev/axpertmax on each USB connector.
Archivo adjunto 24524
Plattforms are get from udevadm info /dev/ttyUSBx command.
1 Archivos adjunto(s)
Re: [NODERED] Conexion con PYLONTECH via console port
I changed the USB - serial converter today to another PL2303...
Archivo adjunto 24530
And I added the rules like this
ACTION=="add", SUBSYSTEM=="tty", ENV{ID_PATH_TAG}=="platform-fd500000_pcie-pci-0000_01_00_0-usb-0_1_3_1_0", SYMLINK+="pylontech"
ACTION=="add", SUBSYSTEM=="tty", ENV{ID_PATH_TAG}=="platform-fd500000_pcie-pci-0000_01_00_0-usb-0_1_4_1_0", SYMLINK+="axpertmax"
I reboot and nothing...
I changed rules to (takeout ACTION=="add", )
SUBSYSTEM=="tty", ENV{ID_PATH_TAG}=="platform-fd500000_pcie-pci-0000_01_00_0-usb-0_1_3_1_0", SYMLINK+="pylontech"
SUBSYSTEM=="tty", ENV{ID_PATH_TAG}=="platform-fd500000_pcie-pci-0000_01_00_0-usb-0_1_4_1_0", SYMLINK+="axpertmax"
and now it works... and can see the two new dev's in ls -l /dev
I also restarted batteries this morning.
I checked and the batteries is definitely in 11500 1N8 baud at start up. (So I did not have to send long string to change baud rate.)
First command to batteries return prompt [Pylon> ]
Then I had to send command "login debug\n" and new prompt [Pylon_debug>] appear
Then send command "help\n" and get all the possible command.
It is all working fine now. It must be the QinHeng Electronics HL-340 USB-Serial adapter that is intermitted or not compatible.
I can send commands and get the data from the batteries, deploy flows many times without getting the timeout errors.
When I analyse the data returned I can see every line end with \n\r and every batch starts with a "@" and end with a "$$".
Here is my sample test flow with basic commands ... need to now add all the extraction.
I'm sure Tejote will do this more elegant :-)
Código HTML:
[{"id":"38c7c06f.91bde","type":"tab","label":"Pylon Connection","disabled":false,"info":""},{"id":"4905e6b9.67a498","type":"debug","z":"38c7c06f.91bde","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1150,"y":60,"wires":[]},{"id":"d35c1d3f.4263","type":"inject","z":"38c7c06f.91bde","name":"Pylon INFO","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"INFO Pylon","payload":"\"info\\n\"","payloadType":"jsonata","x":150,"y":320,"wires":[["2e3e8822.35bb68"]]},{"id":"1f93bd3e.c85453","type":"inject","z":"38c7c06f.91bde","name":"Pylon PWR","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"PWR Pylon","payload":"\"pwr\\n\"","payloadType":"jsonata","x":150,"y":360,"wires":[["2e3e8822.35bb68"]]},{"id":"a283d8aa.8cf0c8","type":"inject","z":"38c7c06f.91bde","name":"Pylon PWRSYS","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"PWRSYS Pylon","payload":"\"pwrsys\\n\"","payloadType":"jsonata","x":160,"y":400,"wires":[["2e3e8822.35bb68"]]},{"id":"2e3e8822.35bb68","type":"link out","z":"38c7c06f.91bde","name":"Send To Serial Converter","links":["ad93eb1f.0e10d8"],"x":570,"y":260,"wires":[],"l":true},{"id":"ad93eb1f.0e10d8","type":"link in","z":"38c7c06f.91bde","name":"Get Pylon Serial Data","links":["2e3e8822.35bb68"],"x":580,"y":140,"wires":[["c73c03f0.1962","de48f746.092e18"]],"l":true},{"id":"28f3fa92.87e8b6","type":"inject","z":"38c7c06f.91bde","name":"Pylon SOCD","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"SOCD Pylon","payload":"\"socd\\n\"","payloadType":"jsonata","x":150,"y":440,"wires":[["2e3e8822.35bb68"]]},{"id":"9a904c9a.d0ada","type":"inject","z":"38c7c06f.91bde","name":"Pylon SOCH","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"SOH Pylon","payload":"\"soh\\n\"","payloadType":"jsonata","x":150,"y":480,"wires":[["2e3e8822.35bb68"]]},{"id":"e493a067.bd032","type":"switch","z":"38c7c06f.91bde","name":"","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"INFO Pylon","vt":"str"},{"t":"eq","v":"PWR Pylon","vt":"str"},{"t":"eq","v":"PWRSYS Pylon","vt":"str"},{"t":"eq","v":"SOCD Pylon","vt":"str"},{"t":"eq","v":"SOH Pylon","vt":"str"}],"checkall":"true","repair":false,"outputs":5,"x":770,"y":520,"wires":[[],["e6706c56.352e9"],["2ed3744c.bb262c"],[],[]]},{"id":"b5b17b1a.3b0e08","type":"link out","z":"38c7c06f.91bde","name":"Pylon Stream Data Input","links":["9cdc0bba.241748"],"x":1190,"y":200,"wires":[],"l":true},{"id":"9cdc0bba.241748","type":"link in","z":"38c7c06f.91bde","name":"Pylyn Stream Input","links":["b5b17b1a.3b0e08"],"x":630,"y":440,"wires":[["e493a067.bd032"]],"l":true},{"id":"e6706c56.352e9","type":"function","z":"38c7c06f.91bde","name":"Extract PWR","func":"var output = msg.payload;\nlet pylon1_no = parseFloat(output.slice((output.indexOf(\"\\r\\n1\")),(output.indexOf(\"\\r\\n1\"))+5));\nlet pylon1_volt = parseFloat(output.slice((output.indexOf(\"\\r\\n1\"))+7,(output.indexOf(\"\\r\\n1\"))+13));\nlet pylon1_current = parseFloat(output.slice((output.indexOf(\"\\r\\n1\"))+14,(output.indexOf(\"\\r\\n1\"))+20));\nlet pylon1_temp = parseFloat(output.slice((output.indexOf(\"\\r\\n1\"))+21,(output.indexOf(\"\\r\\n1\"))+27));\nlet pylon1_state = (output.slice((output.indexOf(\"\\r\\n1\"))+56,(output.indexOf(\"\\r\\n1\"))+63));\nlet pylon1_soc = parseFloat(output.slice((output.indexOf(\"\\r\\n1\"))+91,(output.indexOf(\"\\r\\n1\"))+98));\nlet pylon2_no = parseFloat(output.slice((output.indexOf(\"\\r\\n2\")),(output.indexOf(\"\\r\\n2\"))+5));\nlet pylon2_volt = parseFloat(output.slice((output.indexOf(\"\\r\\n2\"))+7,(output.indexOf(\"\\r\\n2\"))+13));\nlet pylon2_current = parseFloat(output.slice((output.indexOf(\"\\r\\n2\"))+14,(output.indexOf(\"\\r\\n2\"))+20));\nlet pylon2_temp = parseFloat(output.slice((output.indexOf(\"\\r\\n2\"))+21,(output.indexOf(\"\\r\\n2\"))+27));\nlet pylon2_state = (output.slice((output.indexOf(\"\\r\\n2\"))+56,(output.indexOf(\"\\r\\n2\"))+63));\nlet pylon2_soc = parseFloat(output.slice((output.indexOf(\"\\r\\n2\"))+91,(output.indexOf(\"\\r\\n2\"))+99));\nlet pylon3_no = parseFloat(output.slice((output.indexOf(\"\\r\\n3\")),(output.indexOf(\"\\r\\n3\"))+5));\nlet pylon3_volt = parseFloat(output.slice((output.indexOf(\"\\r\\n3\"))+7,(output.indexOf(\"\\r\\n3\"))+13));\nlet pylon3_current = parseFloat(output.slice((output.indexOf(\"\\r\\n3\"))+14,(output.indexOf(\"\\r\\n3\"))+20));\nlet pylon3_temp = parseFloat(output.slice((output.indexOf(\"\\r\\n3\"))+21,(output.indexOf(\"\\r\\n3\"))+27));\nlet pylon3_state = (output.slice((output.indexOf(\"\\r\\n3\"))+56,(output.indexOf(\"\\r\\n3\"))+63));\nlet pylon3_soc = parseFloat(output.slice((output.indexOf(\"\\r\\n3\"))+91,(output.indexOf(\"\\r\\n3\"))+99));\nreturn [\n {\n payload: {\n pylon1_no: pylon1_no,\n pylon1_volt: pylon1_volt,\n pylon1_current: pylon1_current,\n pylon1_temp: pylon1_temp,\n pylon1_state: pylon1_state,\n pylon1_soc: pylon1_soc,\n pylon2_no: pylon2_no,\n pylon2_volt: pylon2_volt,\n pylon2_current: pylon2_current,\n pylon2_temp: pylon2_temp,\n pylon2_state: pylon2_state,\n pylon2_soc: pylon2_soc,\n pylon3_no: pylon3_no,\n pylon3_volt: pylon3_volt,\n pylon3_current: pylon3_current,\n pylon3_temp: pylon3_temp,\n pylon3_state: pylon3_state,\n pylon3_soc: pylon3_soc\n }\n }\n]","outputs":1,"noerr":0,"initialize":"","finalize":"","x":970,"y":520,"wires":[["fdb8bfd6.82355","e488f5a4.58af68"]]},{"id":"2ed3744c.bb262c","type":"function","z":"38c7c06f.91bde","name":"Extract PWRSYS","func":"var output = msg.payload;\nlet pylon_count = parseFloat(output.slice((output.indexOf(\"Total Num\"))+27,(output.indexOf(\"Total Num\"))+35));\nlet pylon_system_volt = parseFloat(output.slice((output.indexOf(\"System Volt\"))+27,(output.indexOf(\"System Volt\"))+35))/1000;\nlet pylon_system_current = parseFloat(output.slice((output.indexOf(\"System Curr\"))+27,(output.indexOf(\"System Curr\"))+35))/1000;\nlet pylon_system_rem_mah = parseFloat(output.slice((output.indexOf(\"System RC\"))+27,(output.indexOf(\"System RC\"))+35));\nlet pylon_system_full_mah = parseFloat(output.slice((output.indexOf(\"System FCC\"))+27,(output.indexOf(\"System FCC\"))+35));\nlet pylon_soc = parseFloat(output.slice((output.indexOf(\"System SOC\"))+27,(output.indexOf(\"System SOC\"))+35));\nlet pylon_soh = parseFloat(output.slice((output.indexOf(\"System SOH\"))+27,(output.indexOf(\"System SOH\"))+35));\nlet pylon_avg_temp = parseFloat(output.slice((output.indexOf(\"Average temperature\"))+27,(output.indexOf(\"Average temperature\"))+35))/1000;\nreturn [\n {\n payload: {\n pylon_count: pylon_count,\n pylon_system_volt: pylon_system_volt,\n pylon_system_current: pylon_system_current,\n pylon_system_rem_mah: pylon_system_rem_mah,\n pylon_system_full_mah: pylon_system_full_mah,\n pylon_soc: pylon_soc,\n pylon_soh: pylon_soh,\n pylon_avg_temp: pylon_avg_temp\n }\n }\n]","outputs":1,"noerr":0,"initialize":"","finalize":"","x":990,"y":560,"wires":[["a3102f35.97a76","90252fed.a65d7"]]},{"id":"a3102f35.97a76","type":"debug","z":"38c7c06f.91bde","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1270,"y":440,"wires":[]},{"id":"21cfc6cc.7f5eda","type":"inject","z":"38c7c06f.91bde","name":"Init Long String","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Info","payload":"7E 32 30 30 31 34 36 38 32 43 30 30 34 38 35 32 30 46 43 43 33 0D","payloadType":"str","x":140,"y":40,"wires":[[]]},{"id":"c73c03f0.1962","type":"debug","z":"38c7c06f.91bde","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":790,"y":60,"wires":[]},{"id":"ae08c7c9.c3b0d8","type":"inject","z":"38c7c06f.91bde","name":"Login Debug","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"1","topic":"Login Debug","payload":"\"login debug\\n\"","payloadType":"jsonata","x":150,"y":260,"wires":[["2e3e8822.35bb68"]]},{"id":"21cab73b.bad528","type":"inject","z":"38c7c06f.91bde","name":"Pylon BAT 1","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"INFO BAT","payload":"\"bat 1\\n\"","payloadType":"jsonata","x":150,"y":520,"wires":[["2e3e8822.35bb68"]]},{"id":"f2b4ce1a.ba732","type":"inject","z":"38c7c06f.91bde","name":"Pylon HLP","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"HELP Pylon","payload":"\"help\\n\"","payloadType":"jsonata","x":220,"y":780,"wires":[["2e3e8822.35bb68"]]},{"id":"d913813d.3f4cc","type":"inject","z":"38c7c06f.91bde","name":"Pylon INIT 13","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Init Pylon","payload":"\"\\r\"","payloadType":"jsonata","x":230,"y":820,"wires":[["2e3e8822.35bb68"]]},{"id":"fb255572.3ed2d8","type":"inject","z":"38c7c06f.91bde","name":"Pylon GETPWR","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"GETPWR Pylon","payload":"\"getpwr\\n\"","payloadType":"jsonata","x":160,"y":560,"wires":[["2e3e8822.35bb68"]]},{"id":"de48f746.092e18","type":"serial request","z":"38c7c06f.91bde","name":"","serial":"b02a04a1.f46368","x":810,"y":160,"wires":[["4905e6b9.67a498","b5b17b1a.3b0e08"]]},{"id":"90252fed.a65d7","type":"link out","z":"38c7c06f.91bde","name":"Send to Pylon DB","links":["9bfa0f15.7ceff"],"x":1270,"y":560,"wires":[],"l":true},{"id":"fdb8bfd6.82355","type":"debug","z":"38c7c06f.91bde","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1230,"y":400,"wires":[]},{"id":"e488f5a4.58af68","type":"link out","z":"38c7c06f.91bde","name":"Send to Pylon batteries","links":["f907eb74.be7008"],"x":1290,"y":520,"wires":[],"l":true},{"id":"ef91f397.14924","type":"inject","z":"38c7c06f.91bde","name":"Pylon STATS","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Stats Pylon","payload":"\"stat\\n\"","payloadType":"jsonata","x":150,"y":600,"wires":[["2e3e8822.35bb68"]]},{"id":"31fdf25e.0b2a0e","type":"inject","z":"38c7c06f.91bde","name":"Pylon FULLCHARGETIME","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"FullChargeTime Pylon","payload":"\"fullchg\\n\"","payloadType":"jsonata","x":190,"y":640,"wires":[["2e3e8822.35bb68"]]},{"id":"b02a04a1.f46368","type":"serial-port","serialport":"/dev/pylontech","serialbaud":"115200","databits":"8","parity":"none","stopbits":"1","waitfor":"","dtr":"none","rts":"none","cts":"none","dsr":"none","newline":"$$","bin":"false","out":"char","addchar":"","responsetimeout":"1000"}]
1 Archivos adjunto(s)
Re: [NODERED] Conexion con PYLONTECH via console port
I dont know why doesnt work with ACTION=="add" line on *.rules.
I have all my converters with ACTION=="add" at first on the line. The difference is that I have several files *.rules, one *.rules by each device.
Archivo adjunto 24532
My plattforms are different from RPi4 because I use a HUB USB 3.0 where I put all my converters. Then on HUB plattforms are different.
YOu can research what plattforms are on HUB USB with udevadm info /ttyUSBx command
Re: [NODERED] Conexion con PYLONTECH via console port
Hola TJota, ¿donde puedo encontrar el USB chipset PL2303 no TTL por favor?
todos los que veo tienen la conversión para YYL.
gracias de antemano
Re: [NODERED] Conexion con PYLONTECH via console port
Cita:
Iniciado por
docshock Hola TJota, ¿donde puedo encontrar el USB chipset PL2303 no TTL por favor?
todos los que veo tienen la conversión para YYL.
gracias de antemano
Que es para el puerto de consola de pylontech??
La mayoria de los NO TTL q hay por ahi llevan conectores DB9 Machos o RJ45s, los TTLs van con cables sueltos o solo la placa con el USB.
Los que llevan RJ45s no coinciden con los pines de la consola pylon. Bueno, coinciden el TXD y RXD pero no la masa. Cuidado con esto. Podrias pillar uno de esos que acaban en RJ45, cortarlo y crimparte un rj45 con las conexiones de consola pylon que hay en #1.
En el universo Aliexpress si que hay USB-RS232 no TTL con cables sueltos. Yo es lo que he usado, los que acaban en RJ45 no los he usado pero en teoria crimpando un nuevo rj45 deberian funcionar.
Te dejo link de los chinos con los que he usado y funcionan tanto para las pylontech en consola como para los voltronics en su rj45 de comunicaciones:
https://es.aliexpress.com/item/742260858.html Despues ya eliges q carcasa quieres o si quieres terminacion en DB9 macho.
Re: [NODERED] Conexion con PYLONTECH via console port
Gracias TeJota, si es para el puerto de la Pylontech "CONSOLE", me gostaria para conectar al Raspeberry PI 400 para intentar controlar las cargas y consumos.
Hace duas semanas que las tengo a trabajar en mi casa aislada, conectadas a un inversor Voltronic MAX 8000, y ha muchos problemas de conexión.
Con este cable queria para ja conectar las baterias, Y mas tarde hacer un entre inversor "CONSOLE" i la PI.
El cable PYL entre baterias y inversor ja está echo y funciona.
Gracias crak, eres dos mejores!
Re: [NODERED] Conexion con PYLONTECH via console port
Re: [NODERED] Conexion con PYLONTECH via console port
Muchas gracies Tejota, eres un krack!