Skip to content

Commit

Permalink
Fix sending genConnectStatus value as hex
Browse files Browse the repository at this point in the history
  • Loading branch information
longzheng committed Jul 24, 2024
1 parent 2be1522 commit 7f17151
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/sep2/models/derStatus.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ it('should generate DERStatus XML', () => {
</operationalModeStatus>
<genConnectStatus>
<dateTime>1682475028</dateTime>
<value>1</value>
<value>01</value>
</genConnectStatus>
</DERStatus>`);
});
3 changes: 2 additions & 1 deletion src/sep2/models/derStatus.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { ConnectStatus } from './connectStatus';
import { dateToStringSeconds } from '../helpers/date';
import { xmlns } from '../helpers/namespace';
import { numberToHex } from '../../number';

/// DER OperationalModeStatus value:
/// 0 - Not applicable / Unknown
Expand Down Expand Up @@ -45,7 +46,7 @@ export function generateDerStatusResponse({
dateTime: dateToStringSeconds(genConnectStatus.dateTime),
// TODO: in the handbook documentation this is explained as an explicit
// however in the spec this is a bitmap flag
value: genConnectStatus.value.toString(),
value: numberToHex(genConnectStatus.value).padStart(2, '0'),
},
},
};
Expand Down

0 comments on commit 7f17151

Please sign in to comment.