You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First off, this is amazing. I'm thrilled to have stumbled on this this morning. I built a cable for my Pi0w and connected it to my Renogy 30A. After a minor struggle getting node installed, I started node-renogy and saw this come in on my mqtt server:
Shortly thereafter though, the excitement came to a halt.
[1701278609650] INFO (3084 on gatepi): Starting NodeRenogy...
[1701278609756] INFO (3084 on gatepi): Connected to controller!
node:internal/errors:478
ErrorCaptureStackTrace(err);
^
RangeError [ERR_OUT_OF_RANGE]: The value of "value" is out of range. It must be >= -32768 and <= 32767. Received 33305
at new NodeError (node:internal/errors:387:5)
at checkInt (node:internal/buffer:72:11)
at writeU_Int16BE (node:internal/buffer:832:3)
at Buffer.writeInt16BE (node:internal/buffer:894:10)
at Object.setData (/home/hpeyerl/NodeRenogy/renogy.js:24:13)
at Object.getData (/home/hpeyerl/NodeRenogy/renogy.js:199:22)
at async Timeout._onTimeout (/home/hpeyerl/NodeRenogy/index.js:25:32) {
code: 'ERR_OUT_OF_RANGE'
}
The problem appears to be that my unit thinks the controller temp is 130degC which is far hotter than it actually is; thus it is returning 0x8219 which is larger than an int16.
As an experiment, I changed to UInt16BE:
diff --git a/renogy.js b/renogy.js
index 8143f15..8f45e4a 100644
--- a/renogy.js
+++ b/renogy.js
@@ -21,7 +21,7 @@ const renogyValues = {
//Register 0x103 - Battery/Controller Temperature - 3
//0x103 returns two bytes, one for battery and one for controller temp in c
const buf = Buffer.alloc(2)
- buf.writeInt16BE(rawData[3]);
+ buf.writeUInt16BE(rawData[3]);
this.controlT = buf[0];
this.battT = buf[1];
//Register 0x104 - Load Voltage - 4
and now I get reasonably cogent data out of my unit.
First off, this is amazing. I'm thrilled to have stumbled on this this morning. I built a cable for my Pi0w and connected it to my Renogy 30A. After a minor struggle getting node installed, I started node-renogy and saw this come in on my mqtt server:
Shortly thereafter though, the excitement came to a halt.
The problem appears to be that my unit thinks the controller temp is 130degC which is far hotter than it actually is; thus it is returning 0x8219 which is larger than an int16.
As an experiment, I changed to UInt16BE:
and now I get reasonably cogent data out of my unit.
I can send a pull req if you like or if you suggest some other fix I can try that. I don't really speak js though.
The text was updated successfully, but these errors were encountered: