add: Barry Energy — Archive (fournisseur d'électricité, 2021)
This commit is contained in:
@@ -0,0 +1,123 @@
|
|||||||
|
# Barry Energy — Archive (fournisseur d'électricité, 2021)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
<note important>**Barry Energy n'existe plus.** Cet article est conservé à titre d'archive.</note>
|
||||||
|
|
||||||
|
## Présentation
|
||||||
|
|
||||||
|
En **janvier 2021** est arrivé un nouveau fournisseur d'électricité, **Barry Energy**. En plus de permettre d'économiser sur le prix moyen du **kWh**, il offrait la possibilité de payer sa consommation sur le prix du marché, sans marge.
|
||||||
|
|
||||||
|
Les factures électriques sont habituellement basées sur un prix d'abonnement et un prix fixe au **kWh**. Certains abonnements permettent des tranches horaires où le prix du **kWh** peut varier : tarifs heures creuses / heures pleines, heures Week-End, heure JP, heure TEMPO, heure bleue, heure rouge...
|
||||||
|
|
||||||
|
Les **concurrents** au distributeur historique EDF proposent également des **tarifs plus ou moins avantageux**. En 2017, j'avais fait le choix de souscrire à l'offre **CDiscount Energie**, avec des économies de l'ordre de 100 à 200 € par an.
|
||||||
|
|
||||||
|
Avec **Barry**, on payait au plus juste la vraie consommation d'énergie : un prix au **kWh** différent chaque heure, dépendant du prix du marché et de la consommation heure par heure.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## API Barry Energy
|
||||||
|
|
||||||
|
Afin d'adapter les appareils à forte consommation (chauffe-eau, chauffage par accumulation, charge de voiture...) au meilleur tarif horaire, j'avais développé un commutateur intelligent s'appuyant sur l'API Barry.
|
||||||
|
|
||||||
|
L'API (documentation : https://developer.barry.energy/) permettait de se connecter sur les serveurs de Barry pour obtenir des informations tarifaires. Trois méthodes étaient disponibles : **getMeteringPoints**, **getAggregatedConsumption** et **getPrice**.
|
||||||
|
|
||||||
|
### Code PHP (Api.php)
|
||||||
|
|
||||||
|
```PHP
|
||||||
|
<?PHP
|
||||||
|
|
||||||
|
$priceArea = array(
|
||||||
|
'dk' => 'DK_NORDPOOL_SPOT_DK1',
|
||||||
|
'fr' => 'FR_EPEX_SPOT_FR'
|
||||||
|
);
|
||||||
|
|
||||||
|
function getMethod($postData) {
|
||||||
|
// Le token suivant n'est pas valide. Il faut le modifier avec le vôtre, obtenu dans l'application Barry Energy
|
||||||
|
$authToken = 'Bx6Da6v0h34MM7OhAjCaN9zak+IZLNe9tUlCebw7+LiP8+5SH6BcdNrOY85s9q7Sdfrmc/yyjWrJROlJ9vhlRCYY310TsHcGNodMzr3cGfZOwVYNPYWxGxcZHO94p6W98SJC/TdIYhsE+tRnvMMKHktTdkRjmMolHAtWpYyFzDw=';
|
||||||
|
$url = "https://jsonrpc.barry.energy/json-rpc";
|
||||||
|
|
||||||
|
$context = stream_context_create(array(
|
||||||
|
'http' => array(
|
||||||
|
'method' => 'POST',
|
||||||
|
'header' => "Authorization: Bearer {$authToken}\r\n".
|
||||||
|
"Content-Type: application/json\r\n",
|
||||||
|
'content' => json_encode($postData)
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
$response = file_get_contents($url, FALSE, $context);
|
||||||
|
|
||||||
|
if($response === FALSE){
|
||||||
|
die('Error');
|
||||||
|
}
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
function translateDate($strDate) {
|
||||||
|
$nomJourSemaineEN = array("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday");
|
||||||
|
$nomJourSemaineFR = array("Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi", "Dimanche");
|
||||||
|
$nomMoisEN = array("January","February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "Décember");
|
||||||
|
$nomMoisFR = array("Janvier","Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre");
|
||||||
|
$strDate = str_ireplace($nomMoisEN, $nomMoisFR, $strDate);
|
||||||
|
$strDate = str_ireplace($nomJourSemaineEN, $nomJourSemaineFR, $strDate);
|
||||||
|
return $strDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
setlocale(LC_ALL,'fr');
|
||||||
|
|
||||||
|
$dateJour = date('d F Y');
|
||||||
|
$dateJourDemain = date('d F Y', strtotime('+1 day', strtotime($dateJour)));
|
||||||
|
|
||||||
|
echo "<h1>Métriques de Barry Energy</h1>";
|
||||||
|
echo "<p>Rapport établi le ".translateDate(date('l d F Y'))." à ".date('H:i:s')."</p>";
|
||||||
|
|
||||||
|
echo "<h2>Etat de l'abonnement</h2>";
|
||||||
|
|
||||||
|
// getMeteringPoints
|
||||||
|
$postData = array(
|
||||||
|
'method' => 'co.getbarry.api.v1.OpenApiController.getMeteringPoints',
|
||||||
|
'id' => 0,
|
||||||
|
'jsonrpc' => '2.0',
|
||||||
|
'params' => array()
|
||||||
|
);
|
||||||
|
$response = getMethod($postData);
|
||||||
|
$responseData = json_decode($response, TRUE);
|
||||||
|
print_r($responseData);
|
||||||
|
|
||||||
|
echo "<h2>Consommation du $dateJour</h2>";
|
||||||
|
|
||||||
|
// getAggregatedConsumption
|
||||||
|
$postData = array(
|
||||||
|
'method' => 'co.getbarry.api.v1.OpenApiController.getAggregatedConsumption',
|
||||||
|
'id' => 0,
|
||||||
|
'jsonrpc' => '2.0',
|
||||||
|
'params' => array(date(DATE_ATOM, strtotime($dateJour)), date(DATE_ATOM, strtotime($dateJourDemain)))
|
||||||
|
);
|
||||||
|
$response = getMethod($postData);
|
||||||
|
$responseData = json_decode($response, TRUE);
|
||||||
|
print_r($responseData);
|
||||||
|
|
||||||
|
echo "<h2>Prix du $dateJour</h2>";
|
||||||
|
|
||||||
|
// getPrice
|
||||||
|
$postData = array(
|
||||||
|
'method' => 'co.getbarry.api.v1.OpenApiController.getPrice',
|
||||||
|
'id' => 0,
|
||||||
|
'jsonrpc' => '2.0',
|
||||||
|
'params' => array($priceArea['fr'], date(DATE_ATOM, strtotime($dateJour)), date(DATE_ATOM, strtotime($dateJourDemain)))
|
||||||
|
);
|
||||||
|
$response = getMethod($postData);
|
||||||
|
$responseData = json_decode($response, TRUE);
|
||||||
|
print_r($responseData);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Liens (archivés)
|
||||||
|
|
||||||
|
- API documentation : https://developer.barry.energy/
|
||||||
|
- Inscription : https://barry.energy/fr/signup
|
||||||
|
- État des services : https://barry.energy/fr/faq/360005006394
|
||||||
|
- Consommation électrique mondiale : https://www.electricitymap.org/zone/FR
|
||||||
|
- Roadmap développement : https://barry.energy/fr/roadmap
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"uuid": "8c68d55b-9a4d-498c-90ac-afb911046321",
|
||||||
|
"slug": "barry-energy-archive-fournisseur-d-electricite-2021",
|
||||||
|
"title": "Barry Energy — Archive (fournisseur d'électricité, 2021)",
|
||||||
|
"author": "cedric@abonnel.fr",
|
||||||
|
"published": false,
|
||||||
|
"featured": false,
|
||||||
|
"published_at": "2026-05-15 20:19:08",
|
||||||
|
"created_at": "2026-05-15 20:19:08",
|
||||||
|
"updated_at": "2026-05-15 20:19:08",
|
||||||
|
"revisions": [],
|
||||||
|
"cover": "",
|
||||||
|
"files_meta": [],
|
||||||
|
"external_links": [],
|
||||||
|
"seo_title": "",
|
||||||
|
"seo_description": "",
|
||||||
|
"og_image": "",
|
||||||
|
"category": "",
|
||||||
|
"tags": []
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user