Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions src/components/lists/TariffsList.astro
Original file line number Diff line number Diff line change
Expand Up @@ -30,34 +30,44 @@ const description =
? "Dynamische Stromtarife sowie Anbieter für CO₂-, PV- und Temperaturvorhersagen."
: "Dynamic electricity tariffs and CO₂, solar, and temperature forecast providers.";

function bucketFor(d: any): "price" | "co2" | "solar" | "temperature" {
const group = d.data.product.group ?? "";
return TARIFF_GROUPS[group] ?? "price";
}
type Bucket = "price" | "feedin" | "co2" | "solar" | "temperature";

const buckets: Record<"price" | "co2" | "solar" | "temperature", any[]> = {
const buckets: Record<Bucket, any[]> = {
price: [],
feedin: [],
co2: [],
solar: [],
temperature: [],
};
for (const d of devices) buckets[bucketFor(d)].push(d);
for (const d of devices) {
const group = TARIFF_GROUPS[d.data.product.group ?? ""] ?? "price";
if (group !== "price") {
buckets[group].push(d);
continue;
}
// price templates without usages fit both directions
const usages: string[] = d.data.usages ?? [];
if (usages.length === 0 || usages.includes("grid")) buckets.price.push(d);
if (usages.length === 0 || usages.includes("feedin")) buckets.feedin.push(d);
}

const sectionLabels = lang === "de"
? {
price: { id: "price", title: "Strompreise" },
price: { id: "price", title: "Netzbezugstarife" },
feedin: { id: "feedin", title: "Einspeisetarife" },
co2: { id: "co2", title: "CO₂-Vorhersagen" },
solar: { id: "solar", title: "Solar-Vorhersagen" },
temperature: { id: "temperature", title: "Temperaturvorhersagen" },
}
: {
price: { id: "price", title: "Electricity prices" },
price: { id: "price", title: "Grid tariffs" },
feedin: { id: "feedin", title: "Feed-in tariffs" },
co2: { id: "co2", title: "CO₂ forecasts" },
solar: { id: "solar", title: "Solar forecasts" },
temperature: { id: "temperature", title: "Temperature forecasts" },
};

const sectionOrder = ["price", "co2", "solar", "temperature"] as const;
const sectionOrder = ["price", "feedin", "co2", "solar", "temperature"] as const;

const headings = [
...(lang === "de"
Expand Down
1 change: 1 addition & 0 deletions src/content.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ const deviceSchema = z.object({
requirements: z.array(z.string()).optional(),
caveats: z.array(caveatSchema).optional(),
countries: z.array(z.string()).optional(),
usages: z.array(z.string()).optional(),
params: z.array(paramSchema).optional(),
});

Expand Down
7 changes: 6 additions & 1 deletion src/utils/devices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export const CODE_PREAMBLES: Record<string, string> = {
charge: "meters:\n - name: my_charger",
aux: "meters:\n - name: my_aux",
price: "tariffs:\n grid:",
feedin: "tariffs:\n feedin:",
co2: "tariffs:\n co2:",
solar: "tariffs:\n solar:",
temperature: "tariffs:\n temperature:",
Expand Down Expand Up @@ -129,6 +130,7 @@ export interface DeviceEntry {
requirements?: string[];
caveats?: Array<{ description?: string; link?: string }>;
countries?: string[];
usages?: string[];
};
}

Expand Down Expand Up @@ -408,7 +410,10 @@ export function buildCodeBlocks(
}
if (type === "tariff") {
const groupKey = TARIFF_GROUPS[entry.data.product.group ?? ""] ?? "price";
const preamble = CODE_PREAMBLES[groupKey];
const usages = entry.data.usages ?? [];
const feedinOnly =
groupKey === "price" && usages.length === 1 && usages[0] === "feedin";
const preamble = CODE_PREAMBLES[feedinOnly ? "feedin" : groupKey];
const list = groupKey === "solar";
return render.map((r) => {
const src = r.advanced ?? r.default;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ product:
description: Dynamische Abnahmevergütung
group: Dynamischer Strompreis
countries: ["CH"]
usages: ["feedin"]
requirements: ["skiptest"]
render:
- default: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ product:
description: Netz Home/Business dynamic
group: Dynamischer Strompreis
countries: ["CH"]
usages: ["grid"]
requirements: ["skiptest"]
render:
- default: |
Expand Down
1 change: 1 addition & 0 deletions templates/nightly/de/tariff/ekz.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ product:
brand: EKZ
group: Dynamischer Strompreis
countries: ["CH"]
usages: ["grid"]
requirements: ["skiptest"]
render:
- default: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ product:
description: Ökostrom Dynamisch
group: Dynamischer Strompreis
countries: ["DE"]
usages: ["grid"]
requirements: ["skiptest"]
description: |
Ein API-Key kann unter der E-Mail-Adresse api@ews-schoenau.de erfragt werden.
Expand Down
1 change: 1 addition & 0 deletions templates/nightly/de/tariff/groupe-e-vario-plus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ product:
description: Vario Plus
group: Dynamischer Strompreis
countries: ["CH"]
usages: ["grid"]
requirements: ["skiptest"]
render:
- default: |
Expand Down
1 change: 1 addition & 0 deletions templates/nightly/de/tariff/octopus-energy-germany.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ product:
description: Deutschland
group: Dynamischer Strompreis
countries: ["DE"]
usages: ["grid"]
requirements: ["skiptest"]
render:
- default: |
Expand Down
1 change: 1 addition & 0 deletions templates/nightly/de/tariff/ostrom.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ product:
brand: Ostrom
group: Dynamischer Strompreis
countries: ["DE"]
usages: ["grid"]
requirements: ["skiptest"]
description: |
Erzeuge einen 'Production Client' im Ostrom-Entwicklerportal: [developer.ostrom-api.io](https://developer.ostrom-api.io/)
Expand Down
1 change: 1 addition & 0 deletions templates/nightly/de/tariff/smartenergy-smartcontrol.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ product:
description: smartCONTROL
group: Dynamischer Strompreis
countries: ["AT"]
usages: ["grid"]
requirements: ["skiptest"]
render:
- default: |
Expand Down
1 change: 1 addition & 0 deletions templates/nightly/de/tariff/tibber.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ product:
brand: Tibber
group: Dynamischer Strompreis
countries: ["NO", "SE", "DE", "NL"]
usages: ["grid"]
requirements: ["skiptest"]
description: |
Hol dir deinen API-Token aus dem Tibber-Entwicklerportal: [developer.tibber.com](https://developer.tibber.com/)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ product:
description: Dynamic feed-in remuneration
group: Dynamic electricity price
countries: ["CH"]
usages: ["feedin"]
requirements: ["skiptest"]
render:
- default: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ product:
description: Netz Home/Business dynamic
group: Dynamic electricity price
countries: ["CH"]
usages: ["grid"]
requirements: ["skiptest"]
render:
- default: |
Expand Down
1 change: 1 addition & 0 deletions templates/nightly/en/tariff/ekz.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ product:
brand: EKZ
group: Dynamic electricity price
countries: ["CH"]
usages: ["grid"]
requirements: ["skiptest"]
render:
- default: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ product:
description: Ökostrom Dynamisch
group: Dynamic electricity price
countries: ["DE"]
usages: ["grid"]
requirements: ["skiptest"]
description: |
You can request an API key at api@ews-schoenau.de
Expand Down
1 change: 1 addition & 0 deletions templates/nightly/en/tariff/groupe-e-vario-plus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ product:
description: Vario Plus
group: Dynamic electricity price
countries: ["CH"]
usages: ["grid"]
requirements: ["skiptest"]
render:
- default: |
Expand Down
1 change: 1 addition & 0 deletions templates/nightly/en/tariff/octopus-energy-germany.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ product:
description: Germany
group: Dynamic electricity price
countries: ["DE"]
usages: ["grid"]
requirements: ["skiptest"]
render:
- default: |
Expand Down
1 change: 1 addition & 0 deletions templates/nightly/en/tariff/ostrom.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ product:
brand: Ostrom
group: Dynamic electricity price
countries: ["DE"]
usages: ["grid"]
requirements: ["skiptest"]
description: |
Create a 'Production Client' in the Ostrom developer portal: [developer.ostrom-api.io](https://developer.ostrom-api.io/)
Expand Down
1 change: 1 addition & 0 deletions templates/nightly/en/tariff/smartenergy-smartcontrol.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ product:
description: smartCONTROL
group: Dynamic electricity price
countries: ["AT"]
usages: ["grid"]
requirements: ["skiptest"]
render:
- default: |
Expand Down
1 change: 1 addition & 0 deletions templates/nightly/en/tariff/tibber.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ product:
brand: Tibber
group: Dynamic electricity price
countries: ["NO", "SE", "DE", "NL"]
usages: ["grid"]
requirements: ["skiptest"]
description: |
Get your API token from the Tibber developer portal: [developer.tibber.com](https://developer.tibber.com/)
Expand Down