# Skill CitrineOS - Cariflex Energy

## Description
Déploiement de CitrineOS (Charge Station Management System open-source) pour la gestion des bornes de recharge EV de Cariflex.

## Source
https://github.com/lfenergy/citrineos

## Prérequis
- Docker / Podman
- PostgreSQL
- OCPP 2.0.1 compatible charging stations

## Installation

### 1. Cloner CitrineOS
```bash
git clone https://github.com/lfenergy/citrineos.git /home/eric/cariflex/tools/citrineos
```

### 2. Déploiement Docker
```bash
cd /home/eric/cariflex/tools/citrineos
docker compose up -d
```

### 3. Configuration
```yaml
# docker-compose.yaml
services:
  citrineos:
    image: citrineos/citrineos:latest
    ports:
      - "8080:8080"
      - "8443:8443"
    environment:
      DB_URL: jdbc:postgresql://postgres:5432/citrineos
      OCPP_VERSION: 2.0.1
```

## Fonctionnalités
- Gestion des bornes OCPP 2.0.1
- Monitoring en temps réel
- Transactions de recharge
- Smart Charging (limitation puissance)
- Reporting et analytics
- API REST pour intégration FlexMeasures

## Intégration FlexMeasures

### Flux
```
Borne EV → OCPP 2.0.1 → CitrineOS → REST API → FlexMeasures
```

### API Endpoints
| Endpoint | Méthode | Usage |
|----------|---------|-------|
| /api/v1/charge-points | GET | Liste des bornes |
| /api/v1/transactions | GET | Transactions |
| /api/v1/meter-values | GET | Mesures |
| /api/v1/remote-start | POST | Démarrage distance |
| /api/v1/remote-stop | POST | Arrêt distance |
| /api/v1/change-availability | POST | Changer disponibilité |
| /api/v1/set-charging-profile | POST | Profil de charge |

## Liens
- GitHub: https://github.com/lfenergy/citrineos
- LF Energy: https://lfenergy.org/projects/citrineos/
- OCPP 2.0.1: https://www.openchargealliance.org/
