|
| 1 | +# CSV Import Examples |
| 2 | + |
| 3 | +This directory contains example CSV files for testing the CSV import functionality in EditDor. |
| 4 | + |
| 5 | +## Files |
| 6 | + |
| 7 | +### `valid.csv` |
| 8 | +A valid CSV file with correct data types and Modbus entities. This file should import without warnings. |
| 9 | + |
| 10 | +**Valid Types:** |
| 11 | +- `number` |
| 12 | +- `string` |
| 13 | +- `boolean` |
| 14 | + |
| 15 | +**Valid Modbus Entities:** |
| 16 | +- `HoldingRegister` |
| 17 | +- `InputRegister` |
| 18 | +- `Coil` |
| 19 | +- `DiscreteInput` |
| 20 | + |
| 21 | +### `invalid.csv` |
| 22 | +A CSV file with intentional validation errors to demonstrate the warning system. When imported, this file will trigger the following warnings: |
| 23 | + |
| 24 | +1. **Row 2, type**: `number123` is invalid (should be `number`, `string`, or `boolean`) |
| 25 | +2. **Row 2, modbus:entity**: `holdingregister` is invalid (case-sensitive, should be `HoldingRegister`) |
| 26 | +3. **Row 3, modbus:entity**: `InvalidRegister` is not a recognized Modbus entity |
| 27 | +4. **Row 4, type**: `invalid_type` is not a valid type |
| 28 | +5. **Row 5, modbus:entity**: `coil` is invalid (case-sensitive, should be `Coil`) |
| 29 | + |
| 30 | +## Usage |
| 31 | + |
| 32 | +1. Open EditDor |
| 33 | +2. Select "Thing Description" or "Thing Model" |
| 34 | +3. Click "Load a CSV File" |
| 35 | +4. Select either `valid.csv` or `invalid.csv` |
| 36 | +5. Observe the results: |
| 37 | + - `valid.csv`: Should load successfully without warnings |
| 38 | + - `invalid.csv`: Should display validation warnings but still load the data |
| 39 | + |
| 40 | +## CSV Format |
| 41 | + |
| 42 | +Required columns: |
| 43 | +- `name`: Property name (required) |
| 44 | +- `type`: Data type (number, string, or boolean) |
| 45 | +- `modbus:entity`: Modbus entity type |
| 46 | +- `modbus:address`: Modbus address (required) |
| 47 | +- `modbus:unitID`: Modbus unit ID |
| 48 | +- `modbus:quantity`: Number of registers |
| 49 | +- `modbus:zeroBasedAddressing`: Boolean (true/false) |
| 50 | +- `modbus:function`: Modbus function code |
| 51 | +- `modbus:mostSignificantByte`: Boolean (true/false) |
| 52 | +- `modbus:mostSignificantWord`: Boolean (true/false) |
| 53 | +- `href`: Property endpoint path |
| 54 | + |
| 55 | +Note: The validation is case-insensitive for Modbus entities, so `coil`, `Coil`, and `COIL` are all treated as equivalent. |
0 commit comments