Hi all!
I have a Ragtech Easy Pro UPS here in Brazil.
It has a USB port for a proprietary software of monitoring.
They dont provide any docs or support.
Sniffing the protocol I was able to build a nodered flow to request and process what I think are de bytes for temperatura, input voltage and battery level.
The device is conected to the USB port of my Home Assistant.
This this the JSON flow.
Hope it helps the Ragtech Nobreak UPS owners.
I would love to know more about the protocol. If anyone can help…
[{"id":"537ff01a.d5694","type":"tab","label":"Ragtech Serial","disabled":false,"info":""},{"id":"44db0922d68e743c","type":"serial in","z":"537ff01a.d5694","name":"Ragtech","serial":"9b6c3c03.9253f","x":160,"y":660,"wires":[["759d1abb8ff48d3e","7e50e59b048c9e5f","d9fe51c95bd00e49","b51abc5ae6f768ac"]]},{"id":"cd434a7afe7b4320","type":"debug","z":"537ff01a.d5694","name":"debug Serial IN","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":640,"y":660,"wires":[]},{"id":"e748060a380d9238","type":"inject","z":"537ff01a.d5694","name":"Request Data","props":[],"repeat":"10","crontab":"","once":false,"onceDelay":"1","topic":"","x":200,"y":80,"wires":[["0891718b676f7017"]]},{"id":"730f09a1629f5e24","type":"serial out","z":"537ff01a.d5694","name":"OUT","serial":"9b6c3c03.9253f","x":850,"y":80,"wires":[]},{"id":"0d05915730b253bb","type":"debug","z":"537ff01a.d5694","name":"debug OUT","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":850,"y":180,"wires":[]},{"id":"0891718b676f7017","type":"function","z":"537ff01a.d5694","name":"Request INFO","func":"//PEDE STATS\nmsg.payload = Buffer.from(\"AA0400801E9E\", \"hex\")\nreturn msg;\n\n\n//PEDE STATS\n//msg.payload = Buffer.from(\"AA0400F301F4AA0401360138AA0402020206AA0400801E9E\", \"hex\")\n//return msg;\n\n\n//PEDE STATS\n//msg.payload = Buffer.from(\"AA0400F301F4\", \"hex\")\n//return msg;\n\n\n","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":460,"y":80,"wires":[["730f09a1629f5e24","0d05915730b253bb"]]},{"id":"759d1abb8ff48d3e","type":"function","z":"537ff01a.d5694","name":"toHexString","func":"const toHexString = (bytes) => {\n return Array.from(bytes, (byte) => {\n return ('0' + (byte & 0xff).toString(16)).slice(-2);\n }).join(' ');\n};\n\nvar hexString = toHexString(msg.payload);\nmsg.payload = hexString;\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":370,"y":660,"wires":[["cd434a7afe7b4320"]]},{"id":"322f07daf1db6edb","type":"function","z":"537ff01a.d5694","name":"Primeiro Comando","func":"msg.payload = Buffer.from(\"A004FFE0088B\", \"hex\")\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":470,"y":180,"wires":[["730f09a1629f5e24","0d05915730b253bb"]]},{"id":"b5c1fc1459a82dbc","type":"inject","z":"537ff01a.d5694","name":"Request Data","props":[],"repeat":"","crontab":"","once":false,"onceDelay":"1","topic":"","x":190,"y":180,"wires":[["322f07daf1db6edb"]]},{"id":"0a6f018e6e9854e3","type":"function","z":"537ff01a.d5694","name":"Segundo Comando","func":"msg.payload = Buffer.from(\"FFFE008E018F\", \"hex\")\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":470,"y":260,"wires":[["0d05915730b253bb","730f09a1629f5e24"]]},{"id":"59c66a451c6dfe49","type":"inject","z":"537ff01a.d5694","name":"Request Data","props":[],"repeat":"","crontab":"","once":false,"onceDelay":"1","topic":"","x":190,"y":260,"wires":[["0a6f018e6e9854e3"]]},{"id":"7e50e59b048c9e5f","type":"function","z":"537ff01a.d5694","name":"getInputVoltage","func":"const toHexString = (bytes) => {\n return Array.from(bytes, (byte) => {\n return ('0' + (byte & 0xff).toString(16)).slice(-2);\n }).join('');\n};\n\nvar hexString = toHexString(msg.payload);\n\nif (hexString.length == 62) {\n\n var temp = '0x' + hexString.substring(52,54) \n let inputVoltage = parseInt(temp, 16);\n\n if (inputVoltage < 10) {\n inputVoltage = 0;\n }\n else {\n inputVoltage = inputVoltage + 5;\n }\n\n msg.payload = inputVoltage;\n return msg;\n}\nelse {\n return null;\n}","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":380,"y":540,"wires":[["dac93a4d6c919bcb"]]},{"id":"d9fe51c95bd00e49","type":"function","z":"537ff01a.d5694","name":"getBattery","func":"const toHexString = (bytes) => {\n return Array.from(bytes, (byte) => {\n return ('0' + (byte & 0xff).toString(16)).slice(-2);\n }).join('');\n};\n\nvar hexString = toHexString(msg.payload);\n\nif (hexString.length == 62) {\n\n var temp = '0x'+ hexString.substring(16,18)\n\n let batteryPercent = Math.round(parseInt(temp, 16)/2.55);\n\n msg.payload = batteryPercent;\n return msg;\n}\nelse {\n return null;\n}","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":370,"y":460,"wires":[["17b257f53136ef2e"]]},{"id":"b51abc5ae6f768ac","type":"function","z":"537ff01a.d5694","name":"getTemperature","func":"const toHexString = (bytes) => {\n return Array.from(bytes, (byte) => {\n return ('0' + (byte & 0xff).toString(16)).slice(-2);\n }).join('');\n};\n\n\nvar hexString = toHexString(msg.payload);\n\nif (hexString.length == 62) {\n\n var temp = '0x'+ hexString.substring(30,32)\n\n let temperature = parseInt(temp, 16);\n\n\n msg.payload = temperature;\n return msg;\n}\nelse {\n return null;\n}","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":380,"y":400,"wires":[["3ed2074b50a6439a"]]},{"id":"3ed2074b50a6439a","type":"ha-sensor","z":"537ff01a.d5694","name":"Ragtech Temperature","entityConfig":"5f030e19c85b66d7","version":0,"state":"payload","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":740,"y":400,"wires":[[]]},{"id":"17b257f53136ef2e","type":"ha-sensor","z":"537ff01a.d5694","name":"Ragtech Battery","entityConfig":"da00fe0c0350830d","version":0,"state":"payload","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":720,"y":460,"wires":[[]]},{"id":"dac93a4d6c919bcb","type":"ha-sensor","z":"537ff01a.d5694","name":"Ragtech Input Voltage","entityConfig":"1289139e401c0dbb","version":0,"state":"payload","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":740,"y":540,"wires":[[]]},{"id":"9b6c3c03.9253f","type":"serial-port","name":"Ragtech","serialport":"/dev/serial/by-id/usb-Ragtech_Sistemas_de_Energia_USB_Serial_Port-if00","serialbaud":"2400","databits":"8","parity":"none","stopbits":"1","waitfor":"0xaa","dtr":"none","rts":"none","cts":"none","dsr":"none","newline":"2000","bin":"bin","out":"time","addchar":"","responsetimeout":"5000"},{"id":"5f030e19c85b66d7","type":"ha-entity-config","server":"9074df74.a057","deviceConfig":"","name":"Ragtech Temperature","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Ragtech Temperature"},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":"temperature"},{"property":"unit_of_measurement","value":"°C"},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"da00fe0c0350830d","type":"ha-entity-config","server":"9074df74.a057","deviceConfig":"","name":"Ragtech Battery","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Ragtech Battery"},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":"battery"},{"property":"unit_of_measurement","value":"%"},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"1289139e401c0dbb","type":"ha-entity-config","server":"9074df74.a057","deviceConfig":"","name":"Ragtech Input Voltage","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Ragtech Input Voltage"},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":"voltage"},{"property":"unit_of_measurement","value":"V"},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"9074df74.a057","type":"server","name":"Home Assistant","addon":true}]