removed wit specific refresh interval
MODIFY
src/integration/asset/wit/WitAssetIntegration.ts
src/integration/asset/wit/WitAssetIntegration.ts
@@ -28,13 +28,13 @@ export default class WitAssetIntegration extends AssetIntegration<AssetSetting>
}
public async retrieveConsumptions(asset: Asset, manualCall: boolean): Promise<AbstractCurrentConsumption[]> {
- if (asset.lastConsumption?.timestamp && moment(asset.lastConsumption.timestamp).add(this.connection.witConnection.refreshInterval, 'minutes') > moment()) {
+ if (asset.lastConsumption?.timestamp && moment(asset.lastConsumption.timestamp).add(this.connection.refreshIntervalMins, 'minutes') > moment()) {
return [];
}
// Set new Token
const token = await this.connect();
const request = manualCall ?
- `${this.connection.url}/${asset.meterID}?From=${moment().subtract(this.connection.witConnection.refreshInterval, 'minutes').toISOString()}` :
+ `${this.connection.url}/${asset.meterID}?From=${moment().subtract(this.connection.refreshIntervalMins, 'minutes').toISOString()}` :
// Check if it is first consumption for this asset
`${this.connection.url}/${asset.meterID}?From=${(asset.lastConsumption?.timestamp) ? asset.lastConsumption.timestamp.toISOString() : moment().startOf('day').toISOString()}`;
try {
@@ -75,7 +75,7 @@ export default class WitAssetIntegration extends AssetIntegration<AssetSetting>
case AssetType.CONSUMPTION:
consumption.currentInstantWatts = Utils.createDecimal(dataset.V).mul(1000).toNumber();
consumption.currentConsumptionWh = Utils.createDecimal(consumption.currentInstantWatts).
- mul(Utils.createDecimal(this.connection.witConnection.refreshInterval / 60)).toNumber() ;
+ mul(Utils.createDecimal(this.connection.refreshIntervalMins / 60)).toNumber() ;
consumption.lastConsumption = {
timestamp: dataset.T,
value: consumption.currentConsumptionWh
@@ -84,7 +84,7 @@ export default class WitAssetIntegration extends AssetIntegration<AssetSetting>
case AssetType.PRODUCTION:
consumption.currentInstantWatts = Utils.createDecimal(dataset.V).mul(-1000).toNumber();
consumption.currentConsumptionWh = Utils.createDecimal(consumption.currentInstantWatts).
- mul(Utils.createDecimal(this.connection.witConnection.refreshInterval / 60)).toNumber() ;
+ mul(Utils.createDecimal(this.connection.refreshIntervalMins / 60)).toNumber() ;
consumption.lastConsumption = {
timestamp: dataset.T,
value: consumption.currentConsumptionWh

MODIFY
src/server/rest/v1/service/security/SettingSecurity.ts
src/server/rest/v1/service/security/SettingSecurity.ts
@@ -238,7 +238,6 @@ export default class SettingSecurity {
case AssetConnectionType.WIT:
sanitizedConnection.witConnection = {
authenticationUrl: sanitize(connection.witConnection.authenticationUrl),
- refreshInterval: sanitize(connection.witConnection.refreshInterval),
clientId: sanitize(connection.witConnection.clientId),
clientSecret: sanitize(connection.witConnection.clientSecret),
user: sanitize(connection.witConnection.user),

MODIFY
src/types/Setting.ts
src/types/Setting.ts
@@ -311,7 +311,6 @@ export interface AssetWitConnectionType extends AssetUserPasswordConnectionType
clientId: string;
clientSecret: string;
authenticationUrl: string;
- refreshInterval: number;
}
export enum CarConnectorSettingsType {

removed wit specific refresh interval