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/