API: allow external integrations to declare their own energy contract types

Hello everyone!

Today, energy tracking in Gladys has three types of contracts: Base, Off-Peak Hours, and Tempo. As soon as a contract falls outside these categories (weekend offer, holidays, seasonal tariff, spot price…), it can’t be used.

I’m currently changing this in depth :raising_hands:

What’s coming:

  • A real « contract » per meter, created in a few clicks: choose the meter, choose the model, adjust the parameters (your off-peak hours, your subscription…), and a preview of the cost over your last 7 days before saving.
  • Many more possible tariffs: off-peak hours, weekends, holidays, school vacations, seasons, consumption thresholds, prices that change every day… and not just in France.
  • Tariff calendars: holidays, Tempo colors, school vacations… Gladys uses them to apply the right price at the right time.
  • A « current price » widget on the dashboard, which displays the current price and the next change.
  • Scenes based on price: for example, « when we switch to off-peak hours, start the water heater ».
  • Contracts publishable by the community, without waiting for a Gladys update: either simply added to the community catalog, or as an external integration for more complex cases (calendars to keep up to date, specific price calculation…).

For the screenshots below, I created a small test integration, « France Weekend & Holidays », with three contracts: off-peak hours + weekend + holidays, a reduced offer during school vacations, and a loyalty offer calculated by the integration itself.

Your current contracts will be automatically migrated, you won’t have to do anything.

It’s still being reviewed before arriving in a next version :slight_smile:

The PR: https://github.com/GladysAssistant/Gladys/pull/3130

The Docker image if you want to test:

ghcr.io/gladysassistant/gladys-preview:claude-amazing-einstein-6f4ub7