Buenas noches
Veo en el ejemplo: Supervise su consumo energético con Gladys Assistant | Gladys Assistant
pero no encuentro mi contrato:
¿Qué debo hacer con el costo?
Gracias por su ayuda
mutmut
15 Octubre, 2026 20:12
2
Hola @Prof_Techno
normalmente el tarif bleu es el tarif regulado, por lo que debe ser este en los contratos:
No es muy explícito, lo sé
Buenas noches
Debo estar haciendo algo mal porque recibo este mensaje:
tariff.components: debe contener 16 elementos o menos
mutmut
16 Octubre, 2026 21:17
4
No puedo ayudar más, lamentablemente
@pierre-gilles , ¿alguna idea?
¡Hola a todos!
Este tema está ahora en desarrollo .
Se ha abierto una PR para corregir el error « demasiados componentes » en las plantillas Tarif Bleu EDF:
master ← claude/magical-planck-07oywr
ouvert 08:57AM - 19 Oct 26 UTC
### Description
**Bug:** picking the `edf-peak-off-peak 9 kVA` template (EDF Ta… rif Bleu, Heures Creuses) and clicking *Preview* fails with `tariff.components: must contain less than or equal to 16 items`.
**Root cause:** the community catalogue is only published in v1 (`contracts.json`), and Gladys converts it with `buildVariantTariff`. That function turns every **older** price range into dated rules plus a **dated `fixed` subscription component**. The EDF regulated tariffs have 23 price ranges since 2012, so these templates end up with `energy` + `subscription` + 22 dated subscriptions = **24 components** (the limit is 16). Tempo also goes over the limit: about 132 rules where 64 are allowed.
I converted and validated the live catalogue: **19 of the 187 templates were unusable**. They are every power of `edf-base`, `edf-peak-off-peak` (except 3 kVA, which has only one range) and `edf-tempo` (except 6 and 24 kVA).
**Fix:** before validating a contract tariff (create, update, preview), `pruneTariffToValidity` (new `tariff.prune.js`) removes the tariff parts that can never price an interval of the contract:
- consumption rules whose `dates` condition ends before `valid_from` or starts after `valid_to`
- `fixed` / `demand` components dated the same way
- taxes lose the removed components from `applies_to`, and a tax is removed when nothing is left in it
This doesn't change any cost, because those parts can never match an interval the contract prices. The preview prunes against the contract validity widened to its window, because the window (the last 7 days) can start before `valid_from`. Malformed `dates` are never removed, so validation still reports them.
**Result on the real catalogue:**
| `valid_from` | Templates still failing |
| --- | --- |
| 2026-10-01 (forum case) | 0 / 187 |
| 2024-01-01 | 0 / 187 |
| 2020-01-01 | 6 / 187 (only `edf-tempo` 9–36 kVA, over the 64-rule limit) |
| 2015-01-01 | 19 / 187 |
A contract going back that far still fails as before. It can be modelled as successive contracts, or we can decide separately to raise the limits.
**Trade-off (documented in the spec):** the stored tariff is the pruned one. If `valid_from` is later moved earlier, the dropped history does not come back (the undated rules price those dates) and the template has to be picked again.
Spec updated in the same diff: `docs/specs/energy-contracts.md`, in section 3 (new paragraph), the preview row of the API table and 9.4 (how the v1 conversion builds the history).
### Related request
Forum: https://community.gladysassistant.com/t/tarif-bleu-edf/11307
### Checklist
- [x] If a forum topic or GitHub issue exists, the description links it (`Forum: https://community.gladysassistant.com/t/...` or `Closes #...`)
- [x] Tests pass: `cd server && npm run coverage` (100% lines on `tariff.prune.js` and the changed lines of `contract.{create,update,preview,validate}.js`). No UI change.
- [x] Linter and prettier pass on the server (no front change)
- [x] No undocumented breaking change
---
_Generated by [Claude Code](https://claude.ai/code/session_01VwSfzT2b9MHU7rHhXHW6mp)_
No dudes en seguir la PR, probar (opcional, especialmente para pequeñas solicitudes) y dar tus comentarios aquí si es necesario.
¡Hola @Prof_Techno , gracias @mutmut !
Has elegido el modelo correcto: edf-peak-off-peak corresponde bien al Tarifa Azul Horas Válidas. El nombre no es nada explícito, lo vamos a mejorar.
El error no viene de ti, es un bug de Gladys. El modelo contiene todo el historial de precios de EDF desde 2012, es decir, 23 períodos con una suscripción por período. Esto hace 24 componentes mientras que Gladys solo acepta un máximo de 16. Los modelos EDF Base y Tempo también están afectados.
La corrección está lista: fix(energy-contract): drop tariff history outside the contract validity (EDF Tarif Bleu templates) by Pierre-Gilles · Pull Request #3235 · GladysAssistant/Gladys · GitHub
Gladys solo conservará el historial que coincide con el período de tu contrato. Estará en la próxima versión.
Mientras tanto, puedes solucionar el problema:
En el asistente, en el paso donde eliges tus horas válidas, activa « Avanzado: editar la definición de la tarifa (JSON) » .
Reemplaza todo el contenido con esto. He retomado los precios de tu captura, para adaptar si cambian:
{
"tariff_version": 1,
"components": [
{
"key": "energy",
"kind": "consumption",
"rules": [
{ "label": "Horas válidas", "when": { "time": [["22:30", "06:30"]] }, "price": 0.1589 }
],
"fallback": { "label": "Horas pico", "price": 0.2142 }
},
{ "key": "subscription", "kind": "fixed", "amount": 19.88, "per": "month" }
]
}
Haz clic en Vista previa , verifica los montos, luego guarda.
Con esta tarifa, los nuevos precios de EDF no se tendrán en cuenta automáticamente, tendrás que actualizarlos tú mismo. Después de la actualización de Gladys, podrás recrear tu contrato a partir del modelo si lo prefieres.
¡Gracias por el reporte!
Voy a esperar para ver si está listo pronto. Dada la velocidad a la que se suceden las actualizaciones, creo que solo es cuestión de horas o de unos pocos días.
He logrado vivir sin ello hasta ahora, así que podré seguir así un poco más. ¡De todos modos, hay tantas otras cosas que probar!