# Light4dCLI CLI PowerShell pour la gestion des configurations de sorties d'éclairage **0-10V** (**ECxLight4D**) sur des automates Distech Controls Eclypse. --- > **IMPORTANT : Ce projet est un développement personnel indépendant.** > > Ce projet a été développé par Charles-Arthur DAVID à titre personnel. > Distech Controls n'est pas responsable de ce projet et ne le supporte pas. > Aucune demande de support ne sera prise en charge par Distech Controls. > Distech Controls ne fournit aucune garantie ni assistance technique pour ce projet. --- ## Prérequis - Windows 10 ou Windows 11 - Automates **Distech Controls ECY Facilities (V2)** - Être connecté au même réseau que les automates (réseau local ou VPN) - Avoir les identifiants de connexion aux automates (nom d'utilisateur et mot de passe) ## Fonctionnalités - **Read** : Lit la configuration des modules ECxLight4D et génère un rapport CSV (une ligne par sortie) - **Write** : Modifie les propriétés des sorties 0-10V à partir du CSV enrichi ## Utilisation avec cadMasterCLI Ce script peut être piloté depuis **[cadMasterCLI](https://git.cadjou.net/DistechControls/cadMasterCLI)**, qui évite d'avoir à utiliser PowerShell manuellement. 1. Lancez `cadMasterCLI.ps1` 2. Sélectionnez **Light4dCLI** dans la liste des scripts à gauche. 3. Choisissez l'action `Read` ou `Write` (RadioButtons). 4. Renseignez `CsvInput` avec le bouton **Parcourir...** (voir le [format CSV d'entrée](#format-csv-dentrée-automates) ci-dessous). 5. Renseignez `Username` / `Password` si besoin (sinon `admin` / vide par défaut). 6. Cliquez sur **Lancer le script** et suivez la progression dans le journal d'exécution intégré. ## Utilisation en ligne de commande (script autonome) ### Lecture des configurations ```powershell .\Light4dCLI.ps1 -Action Read -CsvInput ".\automates.csv" ``` Génère un fichier `light4d_YYYY-MM-DD_HHhmm.csv` avec les propriétés de chaque sortie. ### Écriture des configurations ```powershell .\Light4dCLI.ps1 -Action Write -CsvInput ".\light4d_2026-08-11_18h00.csv" ``` ### Avec mot de passe ```powershell .\Light4dCLI.ps1 -Action Read -CsvInput ".\automates.csv" -Password "MonMotDePasse" ``` ### Aide ```powershell Get-Help .\Light4dCLI.ps1 -Detailed ``` ### Format CSV d'entrée (automates) Séparateur : point-virgule (`;`) ```csv Hostname;Current Ip;HttpPort;HttpsPort Eclypse-RDC;192.168.1.11;0;443 Eclypse-Etage1;192.168.1.12;0;443 ``` Colonnes optionnelles : `Username`, `Password` (surcharge les credentials par défaut `admin` / vide). ### Format CSV de sortie (Read) Une ligne par sortie 0-10V : | Colonne | Description | |---------|-------------| | Hostname | Nom de l'automate | | Current Ip | Adresse IP | | HttpPort | Port HTTP | | HttpsPort | Port HTTPS | | ModuleKey | Identifiant du module | | ModuleName | Nom du module | | OutputKey | Identifiant de la sortie | | OutputName | Nom de la sortie | | DefaultValue | Valeur par défaut | | DimmingTime | Temps de variation (secondes) | | DimmingManagement | Mode de gestion de la variation | | DisableDimming | Variation désactivée (True/False) | ### Filtrage Seuls les modules de type **ECxLight4D** sont traités. Les autres types (ECxLightDaliA, etc.) sont ignorés automatiquement. ### API - **Endpoint** : `/api/rest/v2/services/subnet/devices/light-sunblind/modules` - **Auth** : Basic Auth - **TLS 1.2** avec support des certificats auto-signés ### Structure du projet ``` Light4dCLI/ ├── Light4dCLI.ps1 # Script unique (Logger, CsvHandler, ApiClient, Parser, Main) └── README.md ``` # Light4dCLI PowerShell CLI for managing **0-10V** lighting output configurations (**ECxLight4D**) on Distech Controls Eclypse controllers. --- > **IMPORTANT: This project is an independent personal project.** > > This project was developed by Charles-Arthur DAVID on a personal basis. > Distech Controls is not responsible for this project and does not support it. > No support request will be handled by Distech Controls. > Distech Controls provides no warranty or technical assistance for this project. --- ## Requirements - Windows 10 or Windows 11 - **Distech Controls ECY Facilities (V2)** controllers - Connected to the same network as the controllers (local network or VPN) - Controller login credentials (username and password) ## Features - **Read**: Reads the ECxLight4D modules configuration and generates a CSV report (one line per output) - **Write**: Updates 0-10V output properties from the enriched CSV ## Usage with cadMasterCLI This script can be run from **[cadMasterCLI](https://git.cadjou.net/DistechControls/cadMasterCLI)**, which avoids having to use PowerShell manually. 1. Launch `cadMasterCLI.ps1` 2. Select **Light4dCLI** in the script list on the left. 3. Choose the `Read` or `Write` action (RadioButtons). 4. Set `CsvInput` using the **Browse...** button (see the [input CSV format](#input-csv-format-controllers) below). 5. Set `Username` / `Password` if needed (otherwise defaults to `admin` / empty). 6. Click **Run script** and follow the progress in the built-in execution log. ## Command-line usage (standalone script) ### Reading configurations ```powershell .\Light4dCLI.ps1 -Action Read -CsvInput ".\automates.csv" ``` Generates a `light4d_YYYY-MM-DD_HHhmm.csv` file with the properties of each output. ### Writing configurations ```powershell .\Light4dCLI.ps1 -Action Write -CsvInput ".\light4d_2026-08-11_18h00.csv" ``` ### With password ```powershell .\Light4dCLI.ps1 -Action Read -CsvInput ".\automates.csv" -Password "MyPassword" ``` ### Help ```powershell Get-Help .\Light4dCLI.ps1 -Detailed ``` ### Input CSV format (controllers) Separator: semicolon (`;`) ```csv Hostname;Current Ip;HttpPort;HttpsPort Eclypse-RDC;192.168.1.11;0;443 Eclypse-Etage1;192.168.1.12;0;443 ``` Optional columns: `Username`, `Password` (overrides the default `admin` / empty credentials). ### Output CSV format (Read) One line per 0-10V output: | Column | Description | |---------|-------------| | Hostname | Controller name | | Current Ip | IP address | | HttpPort | HTTP port | | HttpsPort | HTTPS port | | ModuleKey | Module identifier | | ModuleName | Module name | | OutputKey | Output identifier | | OutputName | Output name | | DefaultValue | Default value | | DimmingTime | Dimming time (seconds) | | DimmingManagement | Dimming management mode | | DisableDimming | Dimming disabled (True/False) | ### Filtering Only **ECxLight4D** module types are processed. Other types (ECxLightDaliA, etc.) are automatically ignored. ### API - **Endpoint**: `/api/rest/v2/services/subnet/devices/light-sunblind/modules` - **Auth**: Basic Auth - **TLS 1.2** with self-signed certificate support ### Project structure ``` Light4dCLI/ ├── Light4dCLI.ps1 # Single file (Logger, CsvHandler, ApiClient, Parser, Main) └── README.md ```