Skip to content

Commit

Permalink
added maxIndex["PM"]
Browse files Browse the repository at this point in the history
  • Loading branch information
git-kick committed May 24, 2024
1 parent 865a677 commit 3403860
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ class E3dcRscp extends utils.Adapter {
// For BAT and PVI, there is no COUNT request, so initialize maxIndex to a best guess upper bound.
// Error responses due to out-of range index are handled by processTree(), and maxIndex is adjusted dynamically.
this.maxIndex["BAT"] = 1; // E3/DC tag list states that BAT INDEX is always 0, BUT there are counterexamples (see Issue#96)
this.maxIndex["PM"] = 1;
this.maxIndex["PVI"] = 2;

// For triggering the polling and setting requests:
Expand Down Expand Up @@ -981,7 +982,7 @@ class E3dcRscp extends utils.Adapter {

queuePmRequestData( sml ) {
this.clearFrame();
for( let i = 0; i <= 0; i++ ) { // ALLGEMEIN: this.maxIndex["PM"]
for( let i = 0; i <= this.maxIndex["PM"]; i++ ) {
const pos = this.startContainer( "TAG_PM_REQ_DATA");
this.addTagtoFrame( "TAG_PM_INDEX", "", i );
this.addTagtoFrame( "TAG_PM_REQ_DEVICE_STATE", sml );
Expand Down Expand Up @@ -1414,6 +1415,12 @@ class E3dcRscp extends utils.Adapter {
this.log.info( `Adjusted BAT max. index to ${this.maxIndex["BAT"]}` );
continue;
}
if ( shortId == "PM.DEVICE_STATE" && rscpError[token.content] == "RSCP_ERR_NOT_AVAILABLE" ) {
// This is an error response due to out-of-range PM index, heuristically cut off the biggest one:
--this.maxIndex["PM"];
this.log.info( `Adjusted PM max. index to ${this.maxIndex["PM"]}` );
continue;
}
if ( stopPollingIds.includes( shortId ) && rscpError[token.content] == "RSCP_ERR_NOT_AVAILABLE" ) {
this.pollingInterval[tag] = "N";
this.log.info( `Device reports that ${shortId} is not available - setting polling interval to 'N'` );
Expand Down

0 comments on commit 3403860

Please sign in to comment.