async executeTimer(timerDefinition) {
        let action;

        switch (timerDefinition.action?.type) {
            case ValetudoTimer.ACTION_TYPE.FULL_CLEANUP:
                action = new ValetudoFullCleanupTimerAction({robot: this.robot});
                break;
            case ValetudoTimer.ACTION_TYPE.SEGMENT_CLEANUP:
                action = new ValetudoSegmentCleanupTimerAction({
                    robot: this.robot,
                    segmentIds: timerDefinition.action?.params?.segment_ids,
                    iterations: timerDefinition.action?.params?.iterations,
                    customOrder: timerDefinition.action?.params?.custom_order
                });
                break;
        }

        if (action === undefined) {
            Logger.warn(
                "Error while executing timer " + timerDefinition.id,
                "Couldn't find timer action for type: " + timerDefinition.action.type
            );

            return;
        }


        const preActions = [];
        if (Array.isArray(timerDefinition.pre_actions)) {
            for (const timerPreActionDefinition of timerDefinition.pre_actions) {
                let preAction;

                switch (timerPreActionDefinition.type) {
                    case ValetudoTimer.PRE_ACTION_TYPE.FAN_SPEED_CONTROL:
                        preAction = new ValetudoFanSpeedControlTimerPreAction({
                            robot: this.robot,
                            value: timerPreActionDefinition.params.value
                        });
                        break;
                    case ValetudoTimer.PRE_ACTION_TYPE.WATER_USAGE_CONTROL:
                        preAction = new ValetudoWaterUsageControlTimerPreAction({
                            robot: this.robot,
                            value: timerPreActionDefinition.params.value
                        });
                        break;
                    case ValetudoTimer.PRE_ACTION_TYPE.OPERATION_MODE_CONTROL:
                        preAction = new ValetudoOperationModeControlTimerPreAction({
                            robot: this.robot,
                            value: timerPreActionDefinition.params.value
                        });
                        break;
                }

                if (preAction !== undefined) {
                    preActions.push(preAction);
                } else {
                    Logger.warn(
                        "Error while executing timer " + timerDefinition.id,
                        "Couldn't find timer pre_action for type: " + timerPreActionDefinition.type
                    );

                    return;
                }
            }
        }

        // We have one loop to build the preActions array and this second one to execute them,
        // so that we don't partly execute a broken timer if some pre_action configs are invalid
        for (const preAction of preActions) {
            await preAction.run();
        }

        if (preActions.length > 0) {
            // Give the firmware some time to report back state changes to Valetudo before continuing
            await sleep(5_000);
        }


        await action.run();
    }
@param {import("../entities/core/ValetudoTimer")} timerDefinition