diff --git a/README.md b/README.md index 4baee0c4d0fe5d20f6e5f92be9befa2b9eac73e5..6cea4fd42cb69c3deb66fff8587d69b5724dfa80 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,7 @@ nav: - Konnectors: - Introduction: konnectors/index.md - Enedis: konnectors/enedis.md + - Enedis: konnectors/enedis-sge.md - GRDF: konnectors/grdf.md - Eau du Grand Lyon: konnectors/egl.md - Proxy: diff --git a/docs/konnectors/enedis-sge.md b/docs/konnectors/enedis-sge.md new file mode 100644 index 0000000000000000000000000000000000000000..ab302a50f6e6c8c85e817a809dec259b2f69cd00 --- /dev/null +++ b/docs/konnectors/enedis-sge.md @@ -0,0 +1,119 @@ +This konnector fetches consumptions measures from Enedis SGE SOAP API. + +You should also check Cozy's official documentations for konnectors : +[https://docs.cozy.io/en/tutorials/konnector/getting-started/](https://docs.cozy.io/en/tutorials/konnector/getting-started/) + +# Enedis SGE Konnector + +!!! warning "This konnector is in a POC state" + +## Enedis context + +The API's used by this konnector are the one used by all energy providers (edf, total...), this one is supposed to have a high availability and disponibility. Contrary to enedis oauth konnector, this is a regular auth konnector. + +## Technical overview + +### Lib used + +- xml2js: Lib allowing easy parsing to json +- easy-soap-request: Lib making soap request + +### WSO2 + +For now enedis API's are proxied by WSO1 api manager. You can find documentation and devportal [here](https://apis.grandlyon.fr/devportal). + +### Scaffolding + +- Aggregate.js: file holding method responsible for month and year aggregation +- parsing.js: contain all methods for xml to json parsing and data formating +- request.js: hold SGE query methods +- types.js: file containing type definition to allow js type check. +- index.js: main file where default konnector methods are launch (start, ...) + +### ts-check + +In order to have better comfort while coding, we have enable ts-checking with vs-code. The verification is based on js-doc, please take time to maintain the js-doc. + +!!! note "ts-check" + The ts-check is none blocking. It will only put information in vs-code ide. + + +### Konnector Methods +| Method | Description | +| ------ | ------ | +| start | Main method of konnector. Handle global flow and init method with prvided params | +| getDataStartDate | Retrieve user contract *startDate* in order to request an accurate time range of data | +| getData | Get daily data | +| getMaxPowerData | Get daily Max Power data | +| getHalfHourData | Get half-hour data | +| processData | Given a doctype, parse and format data before storing and aggregating | +| processStartDate | Save startDate and process queries time range | +| storeData | Save data to user's cozy | +| agregateMonthAndYearData | Sum daily data for months and years | + +## Dataflow + +### Overview + +[Lien du schéma](https://whimsical.com/sge-tech-DxbYM8DdajRjTr6WZat1bV) + +### Authentication + +**TODO: Write this part when full implementation will be done.** + +Informations required: + +- Name +- Surname +- PointID (PDL) +- Full address + +### Fetch Data + +In order to get data from the SGE API we have to request the following route : + +1. Get user contrat startDate + +Method : **POST** + +Data Route : **enedis_SGE_ConsultationDonneesTechniquesContractuelles/1.0** + +```xml +<soapenv:Body> + <v2:consulterDonneesTechniquesContractuelles> + <pointId>${pointId}</pointId> + <loginUtilisateur>${userLogin}</loginUtilisateur> + <autorisationClient>true</autorisationClient> + </v2:consulterDonneesTechniquesContractuelles> +</soapenv:Body> +``` + +2. Get daily data +3. Get Max Power data +4. Get Half-hour data + +The same endpoint is used to get the data. The soap body is the follwing: + +Method : **POST** + +Data Route : **enedis_SGE_ConsultationDonneesTechniquesContractuelles/1.0** + +```xml +<soapenv:Body> + <v2:consulterMesuresDetaillees> + <demande> + <initiateurLogin>${userLogin}</initiateurLogin> + <pointId>${pointId}</pointId> + <mesuresTypeCode>${mesureType}</mesuresTypeCode> + <grandeurPhysique>${unit}</grandeurPhysique> + <soutirage>true</soutirage> + <injection>false</injection> + <dateDebut>${startDt}</dateDebut> + <dateFin>${endDt}</dateFin> + <mesuresCorrigees>false</mesuresCorrigees> + <accordClient>true</accordClient> + </demande> + </v2:consulterMesuresDetaillees> +</soapenv:Body> +``` + diff --git a/mkdocs.yml b/mkdocs.yml index b10b87c21e2cd741dcd067bbb19b040e522e1012..78404ed2d4314dc1a47439d8747a6a25d88f3aa8 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -6,7 +6,7 @@ repo_url: "https://forge.grandlyon.com/web-et-numerique/llle_project/self-data-t theme: name: "material" - logo: 'img/self_data_grdlyon.png' + logo: "img/self_data_grdlyon.png" favicon: "img/self_data_grdlyon.png" palette: scheme: dracula @@ -33,15 +33,13 @@ markdown_extensions: - pymdownx.tabbed: alternate_style: true - - extra_css: - "stylesheets/extra.css" plugins: - search - git-revision-date-localized - + nav: - Home: - Getting started: index.md @@ -144,6 +142,7 @@ nav: - Konnectors: - Introduction: konnectors/index.md - Enedis: konnectors/enedis.md + - Enedis SGE: konnectors/enedis-sge.md - GRDF: konnectors/grdf.md - Eau du Grand Lyon: konnectors/egl.md - Proxy: