diff --git a/scripts/config.template.js b/scripts/config.template.js index bf9b3f0e829110b68cfdf9f8eed33a1c11eaa227..cabc3165ec669ac7323634e921f51a0ce79f28c9 100644 --- a/scripts/config.template.js +++ b/scripts/config.template.js @@ -6,11 +6,14 @@ const authorization = const cookie = 'cozysessid=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' -const startingdate = DateTime.local() - .plus({ days: -120 }) - .startOf('day') -const endingDate = DateTime.local() - .plus({ days: -1 }) - .startOf('day') +const startingdate = DateTime.local().plus({ days: -120 }).startOf('day') +const endingDate = DateTime.local().plus({ days: -1 }).startOf('day') +const halfHourStartingdate = DateTime.local().plus({ days: -15 }).startOf('day') -module.exports = { authorization, cookie, startingdate, endingDate } +module.exports = { + authorization, + cookie, + startingdate, + endingDate, + halfHourStartingdate, +} diff --git a/scripts/createConnections.js b/scripts/createConnections.js index 55f85da6d37b21ae8de85adadb2d87e512d97de7..85e07a2f0108eefd3f77a07a4ff8805bd5cecee7 100644 --- a/scripts/createConnections.js +++ b/scripts/createConnections.js @@ -9,21 +9,22 @@ const headers = { } const dataEnedisAccount = JSON.stringify({ - account_type: 'enedisgrandlyon', + account_type: 'enedis-sge-grandlyon', name: '', - oauth: { - access_token: '', - expires_at: '2020-10-09T08:00:00.285910671+02:00', - refresh_token: '', - token_type: 'Bearer', + auth: { + address: '6 Rue Vaillant Couturier', + city: 'Vénissieux', + firstname: 'Jane', + lastname: 'Doe', + pointId: '19170766804121', + postalCode: '69200', }, - oauth_callback_results: { - issued_at: '1592232569642', - refresh_token_issued_at: '1592232569642', - scope: - '/v4/metering_data/production_load_curve.GET /v3/customers/usage_points/addresses.GET /v4/metering_data/consumption_load_curve.GET /v3/customers/usage_points/contracts.GET /v4/metering_data/daily_production.GET /v4/metering_data/daily_consumption.GET /v4/metering_data/daily_consumption_max_power.GET /v3/customers/identity.GET', - usage_points_id: '', + data: { + consentId: 43, }, + id: '70e68b8450cee09fe2f077610901094d', + identifier: 'address', + state: null, }) const dataGrdfAccount = JSON.stringify({ @@ -62,8 +63,8 @@ const dataEnedisTrigger = JSON.stringify({ debounce: '', options: null, message: { - account: '88e68b8450cee09fe2f077610901094d', - konnector: 'enedisgrandlyon', + account: '70e68b8450cee09fe2f077610901094d', + konnector: 'enedis-sge-grandlyon', }, cozyMetadata: { doctypeVersion: '1', @@ -132,7 +133,7 @@ async function launch() { // Enedis await axios({ method: 'put', - url: 'http://cozy.tools:8080/data/io.cozy.accounts/88e68b8450cee09fe2f077610901094d', + url: 'http://cozy.tools:8080/data/io.cozy.accounts/70e68b8450cee09fe2f077610901094d', headers: headers, data: dataEnedisAccount, }) diff --git a/scripts/createDayDataFiles.js b/scripts/createDayDataFiles.js index a6130c3350a4ad73613639ba77e1b3ee886ef377..d5abc98edde52c87860876cb53a4f3298855bf3b 100644 --- a/scripts/createDayDataFiles.js +++ b/scripts/createDayDataFiles.js @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-var-requires */ /* * Create dummy data files for each fluid. * Hourly data is not generated @@ -229,9 +228,10 @@ if (!fs.existsSync(dir)) { const startingdate = config.startingdate const endingDate = config.endingDate +const halfHourStartingdate = config.halfHourStartingdate const Elec = generateHalfAnHourData( - startingdate, + halfHourStartingdate, endingDate.endOf('day'), 0.12, 0.36 @@ -246,7 +246,7 @@ const dumpElec = { 'com.grandlyon.enedis.year': Elec.yearlyLoad, } const dumpStringElec = JSON.stringify(dumpElec) -fs.writeFile('data/dayData-elec.json', dumpStringElec, function(err) { +fs.writeFile('data/dayData-elec.json', dumpStringElec, function (err) { if (err) console.log('error', err) }) @@ -256,7 +256,7 @@ const dumpGas = { 'com.grandlyon.grdf.year': Gaz.yearlyLoad, } const dumpStringGas = JSON.stringify(dumpGas) -fs.writeFile('data/dayData-gas.json', dumpStringGas, function(err) { +fs.writeFile('data/dayData-gas.json', dumpStringGas, function (err) { if (err) console.log('error', err) }) @@ -266,7 +266,7 @@ const dumpWater = { 'com.grandlyon.egl.year': Eau.yearlyLoad, } const dumpStringWater = JSON.stringify(dumpWater) -fs.writeFile('data/dayData-water.json', dumpStringWater, function(err) { +fs.writeFile('data/dayData-water.json', dumpStringWater, function (err) { if (err) console.log('error', err) }) @@ -287,6 +287,6 @@ const dump = { const dumpString = JSON.stringify(dump) -fs.writeFile('data/dayData.json', dumpString, function(err) { +fs.writeFile('data/dayData.json', dumpString, function (err) { if (err) console.log('error', err) })