From ba3ca453b3b6245a6d11ccce4fe068ade45bdfa8 Mon Sep 17 00:00:00 2001 From: Hugo <hnouts@grandlyon.com> Date: Fri, 30 Jul 2021 17:11:32 +0200 Subject: [PATCH] added consumption alert service documentation --- README.md | 95 ++++++++++++++++++----- docs/ecolyo/services/consumption_alert.md | 29 +++++++ docs/konnectors/index.md | 3 +- mkdocs.yml | 1 + 4 files changed, 107 insertions(+), 21 deletions(-) create mode 100644 docs/ecolyo/services/consumption_alert.md diff --git a/README.md b/README.md index 8400e58..c0304eb 100644 --- a/README.md +++ b/README.md @@ -13,39 +13,94 @@ py -m pip install plantuml-markdown ## Setting files hierarchy - inside mkdocs.yml use the key nav: to configure the md files hierarchy - - nav: - - Home: index.md - - Pilote: - - Introduction: pilote/index.md - - Ecolyo: - - Introduction: ecolyo/index.md - - Getting started: + inside mkdocs.yml, configure the md files hierarchy + +nav: + - Home: index.md + - Easy Cozy: + - Configuration: easycozy/config.md + - Commands: easycozy/commands.md + - Known errors: easycozy/known_errors.md + - Scripts: easycozy/scripts.md + - Tips: easycozy/tips.md + - Ecolyo: + - Introduction: ecolyo/index.md + - Getting started: - Setup your environment: ecolyo/getting_started/setup_your_environment.md - Launch the application on local: ecolyo/getting_started/launch_local_application.md - Launch a konnector on local: ecolyo/getting_started/launch_local_konnector.md - - Project Architecture: + - Project Architecture: - Architecture: ecolyo/project_architecture/architecture.md - - Cozy: ecolyo/project_architecture/cozy.md + - Libraries: ecolyo/project_architecture/libraries.md - Environments: ecolyo/project_architecture/environments.md - DocTypes: ecolyo/project_architecture/doctypes.md - - Application: + - Remote DocTypes: ecolyo/project_architecture/remote_doctypes.md + - Application: - Description: ecolyo/application/description.md + - Redux: ecolyo/application/redux.md - Scaffolding: ecolyo/application/scaffolding.md - Services: ecolyo/application/services.md - Gitflow: ecolyo/application/gitflow.md - Deploy: ecolyo/application/deploy.md - - Konnectors: - - Introduction: ecolyo/konnectors/index.md - - Enedis: ecolyo/konnectors/enedis.md - - GRDF: ecolyo/konnectors/grdf.md - - Eau du Grand Lyon: ecolyo/konnectors/egl.md - - Proxy: + - Services: + - Description: ecolyo/services/index.md + - Monthly report notification: ecolyo/services/monthly_report_notification.md + - Aggregator usage events: ecolyo/services/aggregator_usage_events.md + - Consumption Alert: ecolyo/services/consumption_alert.md + - Functionalities: + - Initialization: ecolyo/functionalities/initialization.md + - Consumption: ecolyo/functionalities/consumption.md + - Ecogesture: ecolyo/functionalities/ecogesture.md + - Challenge: ecolyo/functionalities/challenge.md + - Profile Type: ecolyo/functionalities/profile_type.md + - Analysis: ecolyo/functionalities/analysis.md + - Usage events tracking: ecolyo/functionalities/usage_events_tracking.md + - Pilote: + - Pilote - TS - Back: + - Index: pilote/Pilote - TS - Back/index.md + - Application: + - Deploy: pilote/Pilote - TS - Back/application/deploy.md + - Functionalities: + - Routes: pilote/Pilote - TS - Back/functionalities/routes.md + - Getting Started: + - Launch the application on local: pilote/Pilote - TS - Back/getting_started/launch_local_application.md + - Setup your environment: pilote/Pilote - TS - Back/getting_started/setup_your_environment.md + - Project Architecture: pilote/Pilote - TS - Back/project_architecture/architecture.md + - Pilote - TS - Front: + - Index: pilote/Pilote - TS - Front/index.md + - Application: + - Deploy: pilote/Pilote - TS - Front/application/deploy.md + - Functionalities: + - Routes: pilote/Pilote - TS - Front/functionalities/functions.md + - Getting Started: + - Launch the application on local: pilote/Pilote - TS - Front/getting_started/launch_local_application.md + - Pilote - Usager: + - Application: + - Deploy: pilote/Pilote - Usager/application/deploy.md + - Doctypes: pilote/Pilote - Usager/application/doctypes.md + - Gitflow: pilote/Pilote - Usager/application/gitflow.md + - Scaffolding: pilote/Pilote - Usager/application/scaffolding.md + - Services: pilote/Pilote - Usager/application/services.md + - Store: pilote/Pilote - Usager/application/store.md + - Functionalities: + - Appointments: pilote/Pilote - Usager/functionalities/appointments.md + - Contact: pilote/Pilote - Usager/functionalities/contact.md + - Document: pilote/Pilote - Usager/functionalities/document.md + - Settings: pilote/Pilote - Usager/functionalities/setting.md + - Getting Started: + - Launch local doctypes: pilote/Pilote - Usager/getting_started/launch_local_doctypes.md + - Launch local services: pilote/Pilote - Usager/getting_started/launch_local_services.md + - Konnectors: + - Introduction: konnectors/index.md + - Enedis: konnectors/enedis.md + - GRDF: konnectors/grdf.md + - Eau du Grand Lyon: konnectors/egl.md + - Proxy: - Description: proxy/description.md + - Monitoring: proxy/monitoring.md - Use cases: - - Enedis: proxy/use_cases/enedis.md - - Grdf Adict: proxy/use_cases/grdfadict.md + - Enedis: proxy/use_cases/enedis.md + - Grdf Adict: proxy/use_cases/grdfadict.md ## Project layout diff --git a/docs/ecolyo/services/consumption_alert.md b/docs/ecolyo/services/consumption_alert.md new file mode 100644 index 0000000..252181c --- /dev/null +++ b/docs/ecolyo/services/consumption_alert.md @@ -0,0 +1,29 @@ +# Definition of the service +The service will run everyday at 10.00 am, as defined in the manifest: + +``` +"consumptionAlert": { + "type": "node", + "file": "services/consumptionAlert/ecolyo.js", + "trigger": "@cron 0 3 * * *" + } +``` +# Main responsabilities of the service + +The service is reponsible of sending a mail to user to warn him about an overload in his fluid consumption (based on a limit the user fixed in the option panel). + +For now it only monitors water consumptions. + +Main steps are the following: + - Check the "sendConsumptionAlert" and "waterDailyConsumptionLimit" attributes in the com.grandlyon.ecolyo.profile doctype. If "sendConsumptionAlert" is set to true and "waterDailyConsumptionLimit" is not set to 0, service will continue, else it will stop. + - Fetches metadata to customize the mail (Public name, instance url, consumption of the last day fetched by the egl konnector). + - Check that the last consumption is greater than the limit set by the user. If false the service will stop. + - Build the mail. + - Send the mail. + +# Sending mail + +Doc of cozy for sendmail worker: https://docs.cozy.io/en/cozy-stack/workers/#sendmail-worker + +!!! Send mail in local + In local you can use the mail hog tools to see the mail sent by the stack using http://cozy.tools:8025/ \ No newline at end of file diff --git a/docs/konnectors/index.md b/docs/konnectors/index.md index 796b640..f79fe88 100644 --- a/docs/konnectors/index.md +++ b/docs/konnectors/index.md @@ -10,4 +10,5 @@ All the konnectors are configured to retrieve user's data as far as 3 years back Some variation have to be considered : - When the user launches the konnector manually, it fetches 1 year of data (in order to reduce running time). -- When a konnector is launched by the cozy stack (at a random time between 10am and 11am), it fetches 3 years of data. \ No newline at end of file +- When a konnector is launched by the cozy stack (at a random time between 10am and 11am), it fetches 3 years of data. +- When a konnector retrieves a load at the half-hour timeline (ex: enedis), it fetches back to 4 weeks. \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index a57ce82..049da3a 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -53,6 +53,7 @@ nav: - Description: ecolyo/services/index.md - Monthly report notification: ecolyo/services/monthly_report_notification.md - Aggregator usage events: ecolyo/services/aggregator_usage_events.md + - Consumption Alert: ecolyo/services/consumption_alert.md - Functionalities: - Initialization: ecolyo/functionalities/initialization.md - Consumption: ecolyo/functionalities/consumption.md -- GitLab