@enerlence/suntropy-cli 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/suntropy.js +2926 -0
- package/dist/bin/suntropy.js.map +1 -0
- package/package.json +35 -0
- package/skills/inventory-create-kit.md +245 -0
- package/skills/inventory-create.md +210 -0
- package/skills/solar-study.md +337 -0
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@enerlence/suntropy-cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Agent-first CLI for Suntropy solar platform",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"suntropy": "./dist/bin/suntropy.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"skills"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsup",
|
|
15
|
+
"dev": "tsx bin/suntropy.ts",
|
|
16
|
+
"start": "node dist/bin/suntropy.js",
|
|
17
|
+
"prepublishOnly": "npm run build"
|
|
18
|
+
},
|
|
19
|
+
"keywords": ["suntropy", "solar", "cli", "agent"],
|
|
20
|
+
"license": "UNLICENSED",
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"axios": "^1.7.0",
|
|
23
|
+
"chalk": "^5.3.0",
|
|
24
|
+
"cli-table3": "^0.6.5",
|
|
25
|
+
"commander": "^12.1.0",
|
|
26
|
+
"energy-types": "^0.0.127",
|
|
27
|
+
"form-data": "^4.0.0"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/node": "^20.14.0",
|
|
31
|
+
"tsup": "^8.1.0",
|
|
32
|
+
"tsx": "^4.15.0",
|
|
33
|
+
"typescript": "^5.5.0"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
Guía detallada para crear kits solares, kits de cargadores VE y kits de aerotermia, incluyendo la asociación de componentes y equipos personalizados (custom assets).
|
|
2
|
+
|
|
3
|
+
## Conceptos clave
|
|
4
|
+
|
|
5
|
+
Un kit agrupa componentes en un producto comercializable. Existen tres tipos:
|
|
6
|
+
|
|
7
|
+
| Tipo | Comando | Componente principal | Custom assets |
|
|
8
|
+
|------|---------|---------------------|---------------|
|
|
9
|
+
| Kit solar | `suntropy inventory kits` | KitSolarPanel + KitInverter + Battery | SolarKitCustomAsset |
|
|
10
|
+
| Kit cargador VE | `suntropy inventory charger-kits` | Charger | VEChargerKitCustomAsset |
|
|
11
|
+
| Kit aerotermia | `suntropy inventory heatpump-kits` | Heatpump | HeatpumpKitCustomAsset |
|
|
12
|
+
|
|
13
|
+
**Importante:** Los componentes de un kit solar (KitSolarPanel, KitInverter) son entidades **separadas** de los paneles e inversores del inventario general. Tienen sus propios IDs y campos. Esto permite que un kit defina su panel/inversor específico sin modificar el inventario.
|
|
14
|
+
|
|
15
|
+
## Flujo completo: Kit solar
|
|
16
|
+
|
|
17
|
+
### Paso 1: Crear componentes del kit
|
|
18
|
+
|
|
19
|
+
#### Panel del kit
|
|
20
|
+
```bash
|
|
21
|
+
suntropy inventory kits panels create --data '{
|
|
22
|
+
"name": "Panel Kit 450W",
|
|
23
|
+
"peakPower": 450,
|
|
24
|
+
"efficiency": 21.3,
|
|
25
|
+
"panelDegradation": 0.55,
|
|
26
|
+
"width": 1134,
|
|
27
|
+
"heigth": 1762,
|
|
28
|
+
"costPerUnit": 120,
|
|
29
|
+
"manufacturer": {"idManufacturer": <id>}
|
|
30
|
+
}'
|
|
31
|
+
```
|
|
32
|
+
Guarda el `idKitSolarPanel` del resultado.
|
|
33
|
+
|
|
34
|
+
Campos disponibles: name, peakPower, efficiency, panelDegradation, technology, width, heigth, depth, costPerUnit, referenceId, imageUrl, manufacturer, manufacturingWarranty, materialsWarranty, description
|
|
35
|
+
|
|
36
|
+
#### Inversor del kit
|
|
37
|
+
```bash
|
|
38
|
+
suntropy inventory kits inverters create --data '{
|
|
39
|
+
"name": "Inversor Kit 5kW",
|
|
40
|
+
"nominalPower": 5000,
|
|
41
|
+
"efficiency": 98.4,
|
|
42
|
+
"isMicroinverter": false,
|
|
43
|
+
"costPerUnit": 800,
|
|
44
|
+
"manufacturer": {"idManufacturer": <id>}
|
|
45
|
+
}'
|
|
46
|
+
```
|
|
47
|
+
Guarda el `idKitInverter` del resultado.
|
|
48
|
+
|
|
49
|
+
Campos disponibles: name, nominalPower, efficiency, isMicroinverter, costPerUnit, referenceId, imageUrl, manufacturer, manufacturingWarranty, materialsWarranty, description
|
|
50
|
+
|
|
51
|
+
#### Batería (opcional)
|
|
52
|
+
Los kits referencian baterías del inventario general directamente (no tienen entidad separada):
|
|
53
|
+
```bash
|
|
54
|
+
# Buscar baterías existentes
|
|
55
|
+
suntropy inventory batteries list --fields batteryId,name,capacity,costPerUnit
|
|
56
|
+
|
|
57
|
+
# O crear una nueva
|
|
58
|
+
suntropy inventory batteries create --data '{"name":"LUNA2000-5","capacity":5,"costPerUnit":2500}'
|
|
59
|
+
```
|
|
60
|
+
Guarda el `batteryId`.
|
|
61
|
+
|
|
62
|
+
### Paso 2: Preparar custom assets (opcional)
|
|
63
|
+
|
|
64
|
+
Los custom assets del kit referencian equipos personalizados existentes del inventario. Cada asociación incluye un campo `units` (cantidad).
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Buscar custom assets existentes
|
|
68
|
+
suntropy inventory custom-assets list --fields idCustomAsset,label,costPerUnit,customAssetType
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Si no existe el asset que necesitas, créalo primero siguiendo la guía de [equipos personalizados](inventory-create.md).
|
|
72
|
+
|
|
73
|
+
### Paso 3: Ensamblar el kit (método recomendado)
|
|
74
|
+
|
|
75
|
+
Usa el comando `assemble` para crear el kit referenciando componentes por ID con flags explícitos. Esto evita construir JSON anidado y hace el comando autoexplicativo:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
suntropy inventory kits assemble \
|
|
79
|
+
--name "Kit Solar Premium 5kW" \
|
|
80
|
+
--panel <kitPanelId> \
|
|
81
|
+
--inverter <kitInverterId> \
|
|
82
|
+
--battery <batteryId> \
|
|
83
|
+
--panels-count 12 \
|
|
84
|
+
--inverters-count 1 \
|
|
85
|
+
--batteries-count 1 \
|
|
86
|
+
--peak-power 5.4 \
|
|
87
|
+
--price 6500 \
|
|
88
|
+
--phase single_phase \
|
|
89
|
+
--coplanar \
|
|
90
|
+
--taxes 21 \
|
|
91
|
+
--custom-asset <assetId1>:12 \
|
|
92
|
+
--custom-asset <assetId2>:1
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Opciones de `assemble`:**
|
|
96
|
+
|
|
97
|
+
| Flag | Default | Descripción |
|
|
98
|
+
|------|---------|-------------|
|
|
99
|
+
| `--name` | (obligatorio) | Nombre/identificador del kit |
|
|
100
|
+
| `--panel` | - | ID del panel del kit (idKitSolarPanel) |
|
|
101
|
+
| `--inverter` | - | ID del inversor del kit (idKitInverter) |
|
|
102
|
+
| `--battery` | - | ID de batería del inventario (batteryId) |
|
|
103
|
+
| `--panels-count` | 12 | Cantidad de paneles |
|
|
104
|
+
| `--inverters-count` | 1 | Cantidad de inversores |
|
|
105
|
+
| `--batteries-count` | 0 | Cantidad de baterías |
|
|
106
|
+
| `--peak-power` | - | Potencia pico total (kW) |
|
|
107
|
+
| `--price` | - | Precio del kit (€) |
|
|
108
|
+
| `--phase` | single_phase | single_phase o three_phase |
|
|
109
|
+
| `--coplanar` | false | Montaje coplanar |
|
|
110
|
+
| `--taxes` | 21 | IVA por defecto (%) |
|
|
111
|
+
| `--custom-asset` | - | Equipo personalizado como `<id>:<unidades>` (repetible) |
|
|
112
|
+
|
|
113
|
+
**Ejemplo completo:**
|
|
114
|
+
```bash
|
|
115
|
+
suntropy inventory kits assemble \
|
|
116
|
+
--name "Kit Residencial 5.4kW" \
|
|
117
|
+
--panel 57532 --inverter 23359 \
|
|
118
|
+
--panels-count 12 --peak-power 5.4 --price 6500 \
|
|
119
|
+
--coplanar \
|
|
120
|
+
--custom-asset 2281:12 --custom-asset 2282:1
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Alternativa: Crear con JSON completo
|
|
124
|
+
|
|
125
|
+
Para campos avanzados (garantías, useTotalKitCostAsPrice, etc.) usa `create --data`:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
suntropy inventory kits create --data '{
|
|
129
|
+
"identifier": "Kit Solar Premium 5kW",
|
|
130
|
+
"kitSolarPanel": {"idKitSolarPanel": <panelId>},
|
|
131
|
+
"kitInverter": {"idKitInverter": <inverterId>},
|
|
132
|
+
"battery": {"batteryId": <batteryId>},
|
|
133
|
+
"panelNumber": 12,
|
|
134
|
+
"inverterNumber": 1,
|
|
135
|
+
"peakPower": 5.4,
|
|
136
|
+
"price": 6500,
|
|
137
|
+
"phaseNumber": "single_phase",
|
|
138
|
+
"coplanar": true,
|
|
139
|
+
"defaultTaxesPercentage": 21,
|
|
140
|
+
"manufacturingWarranty": 10,
|
|
141
|
+
"materialsWarranty": 5,
|
|
142
|
+
"useTotalKitCostAsPrice": false,
|
|
143
|
+
"active": true,
|
|
144
|
+
"solarKitCustomAssets": [
|
|
145
|
+
{"customAsset": {"idCustomAsset": <assetId1>}, "units": 12},
|
|
146
|
+
{"customAsset": {"idCustomAsset": <assetId2>}, "units": 1}
|
|
147
|
+
]
|
|
148
|
+
}'
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Paso 4: Verificar el kit creado
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
suntropy inventory kits get <kitId>
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Gestión de custom assets en un kit existente
|
|
158
|
+
|
|
159
|
+
### Añadir custom assets
|
|
160
|
+
Actualiza el kit incluyendo los custom assets existentes MÁS los nuevos:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
# Primero obtén los custom assets actuales
|
|
164
|
+
suntropy inventory kits get <kitId> --fields solarKitCustomAssets
|
|
165
|
+
|
|
166
|
+
# Luego actualiza incluyendo todos (existentes + nuevos)
|
|
167
|
+
suntropy inventory kits update <kitId> --data '{
|
|
168
|
+
"solarKitCustomAssets": [
|
|
169
|
+
{"idSolarKitCustomAsset": <existente1>, "customAsset": {"idCustomAsset": <id>}, "units": 12},
|
|
170
|
+
{"idSolarKitCustomAsset": <existente2>, "customAsset": {"idCustomAsset": <id>}, "units": 1},
|
|
171
|
+
{"customAsset": {"idCustomAsset": <nuevoAssetId>}, "units": 3}
|
|
172
|
+
]
|
|
173
|
+
}'
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**Lógica del backend en update:**
|
|
177
|
+
- Elementos CON `idSolarKitCustomAsset` → se actualizan (solo `units`)
|
|
178
|
+
- Elementos SIN `idSolarKitCustomAsset` → se crean nuevos
|
|
179
|
+
- Elementos existentes NO incluidos en el array → se eliminan
|
|
180
|
+
|
|
181
|
+
Esto significa que para eliminar un custom asset de un kit, simplemente lo omites del array en el update.
|
|
182
|
+
|
|
183
|
+
### Cambiar cantidad
|
|
184
|
+
```bash
|
|
185
|
+
suntropy inventory kits update <kitId> --data '{
|
|
186
|
+
"solarKitCustomAssets": [
|
|
187
|
+
{"idSolarKitCustomAsset": <id>, "customAsset": {"idCustomAsset": <id>}, "units": 20}
|
|
188
|
+
]
|
|
189
|
+
}'
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Kit de cargador VE
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
# Crear el kit referenciando un cargador existente
|
|
196
|
+
suntropy inventory charger-kits create --data '{
|
|
197
|
+
"identifier": "Kit Wallbox Premium",
|
|
198
|
+
"charger": {"idCharger": <chargerId>},
|
|
199
|
+
"price": 1200,
|
|
200
|
+
"phaseNumber": 1,
|
|
201
|
+
"defaultTaxesPercentage": 21,
|
|
202
|
+
"useTotalKitCostAsPrice": false,
|
|
203
|
+
"active": true,
|
|
204
|
+
"veChargerKitCustomAssets": [
|
|
205
|
+
{"customAsset": {"idCustomAsset": <assetId>}, "units": 1}
|
|
206
|
+
]
|
|
207
|
+
}'
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## Kit de aerotermia
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
# Crear el kit referenciando una aerotermia existente
|
|
214
|
+
suntropy inventory heatpump-kits create --data '{
|
|
215
|
+
"identifier": "Kit Aerotermia Daikin 8kW",
|
|
216
|
+
"heatpump": {"idHeatpump": <heatpumpId>},
|
|
217
|
+
"price": 8500,
|
|
218
|
+
"phaseNumber": 1,
|
|
219
|
+
"defaultTaxesPercentage": 21,
|
|
220
|
+
"useTotalKitCostAsPrice": false,
|
|
221
|
+
"active": true,
|
|
222
|
+
"heatpumpKitCustomAssets": [
|
|
223
|
+
{"customAsset": {"idCustomAsset": <assetId>}, "units": 1}
|
|
224
|
+
]
|
|
225
|
+
}'
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## Otros comandos útiles
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
# Listar componentes del kit
|
|
232
|
+
suntropy inventory kits panels list
|
|
233
|
+
suntropy inventory kits inverters list
|
|
234
|
+
suntropy inventory kits batteries list
|
|
235
|
+
|
|
236
|
+
# Archivar kit (soft delete)
|
|
237
|
+
suntropy inventory kits archive <kitId>
|
|
238
|
+
|
|
239
|
+
# Marcar panel/inversor como destacado
|
|
240
|
+
suntropy inventory kits panels featured <kitPanelId>
|
|
241
|
+
suntropy inventory kits inverters featured <kitInverterId>
|
|
242
|
+
|
|
243
|
+
# Buscar fabricantes para los componentes
|
|
244
|
+
suntropy inventory manufacturers list
|
|
245
|
+
```
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
Crea elementos en el inventario de Suntropy usando la CLI. El inventario incluye: paneles solares, inversores, baterías, cargadores VE, aerotermias, equipos personalizados (custom assets) y kits.
|
|
2
|
+
|
|
3
|
+
## Parámetros de entrada
|
|
4
|
+
|
|
5
|
+
Pregunta al usuario qué tipo de elemento quiere crear. Si no especifica, pregunta.
|
|
6
|
+
|
|
7
|
+
## Tipos de elementos y sus campos
|
|
8
|
+
|
|
9
|
+
### Paneles solares (`suntropy inventory panels create`)
|
|
10
|
+
| Campo | Tipo | Obligatorio | Ejemplo |
|
|
11
|
+
|-------|------|-------------|---------|
|
|
12
|
+
| name | string | Sí | "JA Solar 450W" |
|
|
13
|
+
| peakPower | number | Sí | 450 (Wp) |
|
|
14
|
+
| efficiency | number | No | 21.3 (%) |
|
|
15
|
+
| manufacturer | object | No | {"idManufacturer": N} |
|
|
16
|
+
| panelDegradation | number | No | 0.55 (%) |
|
|
17
|
+
| width | number | No | 1134 (mm) |
|
|
18
|
+
| heigth | number | No | 1762 (mm) |
|
|
19
|
+
| costPerUnit | number | No | 120 (€) |
|
|
20
|
+
| active | boolean | No | true |
|
|
21
|
+
| referenceId | string | No | "JAM72S30-450" |
|
|
22
|
+
| description | string | No | - |
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
suntropy inventory panels create --data '{"name":"JA Solar 450W","peakPower":450,"efficiency":21.3,"costPerUnit":120,"active":true}'
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Inversores (`suntropy inventory inverters create`)
|
|
29
|
+
| Campo | Tipo | Obligatorio | Ejemplo |
|
|
30
|
+
|-------|------|-------------|---------|
|
|
31
|
+
| name | string | Sí | "Huawei SUN2000-5KTL" |
|
|
32
|
+
| nominalPower | number | Sí | 5000 (W) |
|
|
33
|
+
| efficiency | number | No | 98.4 (%) |
|
|
34
|
+
| manufacturer | object | No | {"idManufacturer": N} |
|
|
35
|
+
| phaseNumber | string | No | "single_phase" o "three_phase" |
|
|
36
|
+
| isMicroinverter | boolean | No | false |
|
|
37
|
+
| isHybrid | boolean | No | false |
|
|
38
|
+
| maxCapacityOfBattery | number | No | 15 (kWh) |
|
|
39
|
+
| costPerUnit | number | No | 800 (€) |
|
|
40
|
+
| active | boolean | No | true |
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
suntropy inventory inverters create --data '{"name":"Huawei SUN2000-5KTL","nominalPower":5000,"efficiency":98.4,"phaseNumber":"single_phase","costPerUnit":800}'
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Baterías (`suntropy inventory batteries create`)
|
|
47
|
+
| Campo | Tipo | Obligatorio | Ejemplo |
|
|
48
|
+
|-------|------|-------------|---------|
|
|
49
|
+
| name | string | Sí | "Huawei LUNA2000-5" |
|
|
50
|
+
| capacity | number | Sí | 5 (kWh) |
|
|
51
|
+
| manufacturer | object | No | {"idManufacturer": N} |
|
|
52
|
+
| isModular | boolean | No | true |
|
|
53
|
+
| maxNumberOfModules | number | No | 3 |
|
|
54
|
+
| availableCapacities | string | No | "5,10,15" |
|
|
55
|
+
| price | number | No | 2500 (€) |
|
|
56
|
+
| costPerUnit | number | No | 2500 (€) |
|
|
57
|
+
| active | boolean | No | true |
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
suntropy inventory batteries create --data '{"name":"Huawei LUNA2000-5","capacity":5,"isModular":true,"costPerUnit":2500}'
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Cargadores VE (`suntropy inventory chargers create`)
|
|
64
|
+
| Campo | Tipo | Obligatorio | Ejemplo |
|
|
65
|
+
|-------|------|-------------|---------|
|
|
66
|
+
| name | string | Sí | "Wallbox Pulsar Plus" |
|
|
67
|
+
| maxPower | number | Sí | 7400 (W) |
|
|
68
|
+
| connectorType | string | No | TYPE_1, TYPE_2, CCS1, CCS2, GBT, CHAdeMO |
|
|
69
|
+
| phaseNumber | number | No | 1 |
|
|
70
|
+
| includedPlug | boolean | No | true |
|
|
71
|
+
| price | number | No | 650 (€) |
|
|
72
|
+
| costPerUnit | number | No | 650 (€) |
|
|
73
|
+
| active | boolean | No | true |
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
suntropy inventory chargers create --data '{"name":"Wallbox Pulsar Plus","maxPower":7400,"connectorType":"TYPE_2","costPerUnit":650}'
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Aerotermias (`suntropy inventory heatpumps create`)
|
|
80
|
+
| Campo | Tipo | Obligatorio | Ejemplo |
|
|
81
|
+
|-------|------|-------------|---------|
|
|
82
|
+
| identifier | string | Sí | "Daikin Altherma 3 8kW" |
|
|
83
|
+
| lowerPower | number | No | 4000 (W) |
|
|
84
|
+
| upperPower | number | No | 8000 (W) |
|
|
85
|
+
| scop | number | No | 4.5 |
|
|
86
|
+
| phases_number | number | No | 1 |
|
|
87
|
+
| manufacturer | object | No | {"idManufacturer": N} |
|
|
88
|
+
| price | number | No | 4500 (€) |
|
|
89
|
+
| costPerUnit | number | No | 4500 (€) |
|
|
90
|
+
| active | boolean | No | true |
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
suntropy inventory heatpumps create --data '{"identifier":"Daikin Altherma 3 8kW","lowerPower":4000,"upperPower":8000,"scop":4.5,"costPerUnit":4500}'
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Equipos personalizados (Custom Assets)
|
|
97
|
+
|
|
98
|
+
Los custom assets tienen una estructura jerárquica: **Tipo → Campos → Asset**
|
|
99
|
+
|
|
100
|
+
#### Paso 1: Buscar o crear un tipo
|
|
101
|
+
|
|
102
|
+
Primero busca si ya existe un tipo adecuado:
|
|
103
|
+
```bash
|
|
104
|
+
suntropy inventory custom-asset-types list
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Si necesitas crear uno nuevo:
|
|
108
|
+
```bash
|
|
109
|
+
suntropy inventory custom-asset-types create --data '{
|
|
110
|
+
"label": "Nombre del tipo",
|
|
111
|
+
"image": "wrench",
|
|
112
|
+
"isMaterialConcept": true,
|
|
113
|
+
"panelsQuantity": false,
|
|
114
|
+
"uniqueCustomAssetSelection": false,
|
|
115
|
+
"customFields": [
|
|
116
|
+
{"label": "Campo texto", "type": "text"},
|
|
117
|
+
{"label": "Campo numérico", "type": "number"},
|
|
118
|
+
{"label": "Campo opciones", "type": "options", "customFieldOptions": [
|
|
119
|
+
{"label": "Opción A", "value": "a"},
|
|
120
|
+
{"label": "Opción B", "value": "b"}
|
|
121
|
+
]}
|
|
122
|
+
]
|
|
123
|
+
}'
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**Flags del tipo:**
|
|
127
|
+
- `isMaterialConcept`: true = aparece como material en presupuestos
|
|
128
|
+
- `panelsQuantity`: true = la cantidad se iguala automáticamente al número de paneles
|
|
129
|
+
- `uniqueCustomAssetSelection`: true = solo se puede seleccionar un asset de este tipo por estudio
|
|
130
|
+
|
|
131
|
+
**Tipos de campo soportados:**
|
|
132
|
+
text, number, date, datetime, time, email, phonenumber, website, options, labels, currency, large_text, user
|
|
133
|
+
|
|
134
|
+
#### Paso 2: Obtener IDs de los campos del tipo
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
suntropy inventory custom-asset-types get <typeId>
|
|
138
|
+
```
|
|
139
|
+
Anota los `idCustomField` de cada campo en `customFields`.
|
|
140
|
+
|
|
141
|
+
#### Paso 3: Crear el asset
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
suntropy inventory custom-assets create --data '{
|
|
145
|
+
"label": "Nombre del equipo",
|
|
146
|
+
"identifier": "REF-001",
|
|
147
|
+
"costPerUnit": 100,
|
|
148
|
+
"isMaterial": true,
|
|
149
|
+
"hideOnBudget": false,
|
|
150
|
+
"description": "Descripción del equipo",
|
|
151
|
+
"customAssetType": {"idCustomAssetType": <typeId>},
|
|
152
|
+
"customAssetCustomField": [
|
|
153
|
+
{"customField": {"idCustomField": <fieldId1>}, "value": "valor1"},
|
|
154
|
+
{"customField": {"idCustomField": <fieldId2>}, "value": "42"},
|
|
155
|
+
{"customField": {"idCustomField": <fieldId3>}, "value": "a"}
|
|
156
|
+
]
|
|
157
|
+
}'
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**Campos del asset:**
|
|
161
|
+
- `label`: Nombre visible
|
|
162
|
+
- `identifier`: Referencia interna
|
|
163
|
+
- `costPerUnit`: Precio unitario (€)
|
|
164
|
+
- `isMaterial`: Es un concepto material
|
|
165
|
+
- `hideOnBudget`: Ocultar en presupuesto (pero incluir en coste)
|
|
166
|
+
- `customAssetType`: Referencia al tipo por ID
|
|
167
|
+
- `customAssetCustomField`: Array de valores para los campos del tipo. Para campos tipo `options`, el value es el `value` de la opción (no el label)
|
|
168
|
+
|
|
169
|
+
### Manufacturers
|
|
170
|
+
|
|
171
|
+
Si necesitas referenciar un fabricante, primero búscalo o créalo:
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
# Buscar fabricantes existentes
|
|
175
|
+
suntropy inventory manufacturers list
|
|
176
|
+
|
|
177
|
+
# Crear nuevo fabricante
|
|
178
|
+
suntropy inventory manufacturers create --data '{"name": "JA Solar"}'
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Luego referéncialo en el equipo: `"manufacturer": {"idManufacturer": <id>}`
|
|
182
|
+
|
|
183
|
+
### Kits (solar, cargador VE, aerotermia)
|
|
184
|
+
|
|
185
|
+
Para crear kits con todos sus componentes y equipos personalizados asociados, consulta la guía detallada:
|
|
186
|
+
|
|
187
|
+
**[Crear kits y asociar componentes](inventory-create-kit.md)**
|
|
188
|
+
|
|
189
|
+
Resumen rápido de un kit solar básico:
|
|
190
|
+
```bash
|
|
191
|
+
# 1. Crear panel y inversor del kit
|
|
192
|
+
suntropy inventory kits panels create --data '{"name":"Panel Kit","peakPower":450,"efficiency":21}'
|
|
193
|
+
suntropy inventory kits inverters create --data '{"name":"Inversor Kit","nominalPower":5000}'
|
|
194
|
+
|
|
195
|
+
# 2. Ensamblar el kit (método recomendado)
|
|
196
|
+
suntropy inventory kits assemble \
|
|
197
|
+
--name "Kit Solar 5kW" \
|
|
198
|
+
--panel <panelId> --inverter <inverterId> \
|
|
199
|
+
--panels-count 12 --peak-power 5.4 --price 3500 \
|
|
200
|
+
--custom-asset <assetId>:12
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Notas
|
|
204
|
+
|
|
205
|
+
- Todos los comandos devuelven JSON con el elemento creado (incluido su ID)
|
|
206
|
+
- Para actualizar: `suntropy inventory <tipo> update <id> --data '{"campo": "nuevo_valor"}'`
|
|
207
|
+
- Para eliminar: `suntropy inventory <tipo> delete <id>`
|
|
208
|
+
- Para listar con filtros: `suntropy inventory <tipo> list --limit 10 --active-only`
|
|
209
|
+
- Usa `--fields campo1,campo2` para seleccionar campos en el output
|
|
210
|
+
- Usa `--format human` para vista legible en tabla
|