npeter / ioBroker.apsystems-ecu

Integrate APSystems inverters via ECU-R
MIT License
18 stars 4 forks source link

RequestLength #15

Closed TommyI81 closed 1 year ago

TommyI81 commented 1 year ago

Hi, just realized that the "RequestLenght" in ecu.js is fixed. As it is not documented, I just antizipated, based on the response that the request like "APS11xxxxYYYY" where xxxx should be the request length - same as in the response.

It perfectly fits for some of the requests, but for the GetPowerOfDay Request: "APS110039000321600xxxxxxENDdddddddd\n"

it is not matching - neither from APS to END nor including the dddddddd.

The code uses a second END tag: _(ecu.js - Line 373) const req = REQ_POWER_OF_DAY + this.ecuId + REQ_END + day + REQ_END + '\r';

This is not mentioned in the Readme but would explain the length of 39. In this case: Why "\r" at the end?

Could you please help to clear up the confusion? Thx

npeter commented 1 year ago

You are right!

The END tag is missed. Correct is: GetPowerOfDay : Request: "APS110039000321600xxxxxxENDddddddddEND\n GetEnergyOfWeekMonthYear: Request: "APS110039000421600xxxxxxENDppEND\n"

Its an documentation issue. Code is correct and working.

\r is new line in UNIX ... its better to use \n always.

peter

npeter commented 1 year ago

Solved with V0.2.10