async function sync(fromStart = false) {
  logger.debug('Enedis: Syncing account');
  const usagePoints = await this.gladys.device.get({
    service: 'enedis',
  });
  logger.debug(`Enedis: Found ${usagePoints.length} usage points to sync`);
  // Foreach usage point
  return Promise.mapSeries(usagePoints, async (usagePoint) => {
    const usagePointFeature = getDeviceFeature(
      usagePoint,
      DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR,
      DEVICE_FEATURE_TYPES.ENERGY_SENSOR.DAILY_CONSUMPTION,
    );

    const lastDateSynced = getDeviceParam(usagePoint, LAST_DATE_SYNCED);
    let syncFromDate = lastDateSynced;

    // We take a 1 week margin in case some days were lost
    if (lastDateSynced && !fromStart) {
      syncFromDate = dayjs(lastDateSynced, 'YYYY-MM-DD')
        .subtract(7, 'days')
        .format('YYYY-MM-DD');
    } else {
      syncFromDate = undefined;
    }

    if (!usagePointFeature) {
      return null;
    }

    logger.debug(`Enedis: Usage point last sync was ${lastDateSynced}, syncing from ${syncFromDate}`);

    // syncing all batches
    const lastDateSync = await recursiveBatchCall(
      this.gladys,
      usagePointFeature.external_id,
      this.syncDelayBetweenCallsInMs,
      syncFromDate,
    );

    logger.debug(`Enedis: Saving new last data sync = ${lastDateSync}`);

    // save last date synced in DB
    await this.gladys.device.setParam(usagePoint, LAST_DATE_SYNCED, lastDateSync);

    return {
      syncFromDate,
      lastDateSynced,
      lastDateSync,
      usagePointExternalId: usagePointFeature.external_id,
    };
  });
}
@description Sync Enedis account.
@param {boolean} fromStart - Sync from start.
@returns {Promise} Resolving when finished.
@example
sync();