diff --git a/src/coordinator/helpers/inverterController.ts b/src/coordinator/helpers/inverterController.ts index 557aca7..a681f4b 100644 --- a/src/coordinator/helpers/inverterController.ts +++ b/src/coordinator/helpers/inverterController.ts @@ -55,6 +55,7 @@ export type InverterConfiguration = | { type: 'disconnect' } | { type: 'limit'; + exportLimitWatts: number; invertersCount: number; targetSolarWatts: number; targetSolarPowerRatio: number; @@ -355,6 +356,7 @@ export class InverterController { return { type: 'limit', + exportLimitWatts: configuration.exportLimitWatts, invertersCount: configuration.invertersCount, targetSolarWatts: rampedTargetSolarWatts, targetSolarPowerRatio: rampedTargetSolarPowerRatio, @@ -458,6 +460,7 @@ export function calculateInverterConfiguration({ return { type: 'limit', + exportLimitWatts, invertersCount: maxInvertersCount, targetSolarWatts, targetSolarPowerRatio: roundToDecimals(targetSolarPowerRatio, 4), diff --git a/src/inverter/goodwe/et.ts b/src/inverter/goodwe/et.ts index c2bb270..d8459dc 100644 --- a/src/inverter/goodwe/et.ts +++ b/src/inverter/goodwe/et.ts @@ -86,12 +86,30 @@ export class GoodweEtInverterDataPoller extends InverterDataPollerBase { this.connection.onDestroy(); } - // eslint-disable-next-line @typescript-eslint/require-await override async onControl( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - _inverterConfiguration: InverterConfiguration, + inverterConfiguration: InverterConfiguration, ): Promise { - throw new Error('Method not implemented.'); + switch (inverterConfiguration.type) { + case 'disconnect': + throw new Error('Disconnect not supported'); + case 'limit': { + const deviceParameters = + await this.connection.getDeviceParameters(); + + const exportLimitPercentageOfRatedPower = Math.min( + inverterConfiguration.exportLimitWatts / + deviceParameters.RatePower, + 1, + ); + + await this.connection.setMeterControl({ + FeedPowerEnable: true, + FeedPowerPara: Math.floor( + exportLimitPercentageOfRatedPower * 10000, + ), + }); + } + } } }