community services metrics endpoint (member perspective)
In this MR we implement two new endpoints:
/me/community_services
/me/community_services/metrics
/me/community_services
Returns all communities services in which a member is registered. This endpoint only takes in account active services.
{
"count": 1,
"data": [
{
"id_": 32,
"name": "Instalació Fotovoltaica Z",
"status": "active",
"type_": "fotovoltaic"
}
],
"links": {
"next_page": null,
"previous_page": null,
"self_": "https://foo.bar.coop/api/energy-communities/me/community_services"
},
"page": 1,
"total_results": 1
}
/me/community_services/metrics
Returns a set of related metrics of all communities services in which a member is registered and are active. This services must to have a monitoring service associated, in order to get those metrics
{
"count": 1,
"data": [
{
"consumption_selfconsumption_ratio": {
"unit": "percentage",
"value": 0.0497
},
"environment_saves": {
"unit": "grCO2",
"value": 98029.44000000002
},
"id_": 32,
"selfconsumption_consumption_ratio": {
"unit": "percentage",
"value": 0.0247
},
"selfconsumption_surplus_ratio": {
"unit": "percentage",
"value": 0.9753
},
"share_energy_production": {
"unit": "kWn",
"value": 24500.752
},
"shares": {
"unit": "percentage",
"value": 0.4
},
"type_": "fotovoltaic"
}
],
"links": {
"next_page": null,
"previous_page": null,
"self_": "https://foo.bar.coop/api/energy-communities/me/community_services/metrics"
},
"page": 1,
"total_results": 1
}
Implements:
- OP#313
- OP#469
Edited by Juan Pedro Sánchez