Skip to content

Conversation

@eliaslecomte
Copy link
Contributor

I've added Belgium to the data points 🥳 and then noticed that the co2 data wasn't from 2024. I've updated all listed / included countries.

@evcc-bot evcc-bot added the enhancement New feature or request label Jan 4, 2026
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • Consider adding an explicit year field (e.g. year: 2024) alongside the co2 values so it’s clear which dataset these numbers correspond to and future updates are less error-prone.
  • You may want to define and export a Region type/interface for the { name, co2 } objects so that any future additions (like Belgium here) are type-checked consistently across the codebase.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider adding an explicit `year` field (e.g. `year: 2024`) alongside the `co2` values so it’s clear which dataset these numbers correspond to and future updates are less error-prone.
- You may want to define and export a `Region` type/interface for the `{ name, co2 }` objects so that any future additions (like Belgium here) are type-checked consistently across the codebase.

## Individual Comments

### Comment 1
<location> `assets/js/components/Savings/co2Reference.ts:6-15` </location>
<code_context>
-  { name: "United Kingdom", co2: 257 },
-  { name: "United States", co2: 367 },
-  { name: "World", co2: 436 },
+  { name: "Australia", co2: 552 },
+  { name: "Austria", co2: 103 },
+  { name: "Belgium", co2: 118 },
+  { name: "Canada", co2: 175 },
+  { name: "Czech Republic", co2: 414 },
+  { name: "Denmark", co2: 143 },
+  { name: "Estonia", co2: 341 },
+  { name: "Europe", co2: 284 },
+  { name: "Finland", co2: 72 },
+  { name: "France", co2: 44 },
+  { name: "Germany", co2: 344 },
+  { name: "Netherlands", co2: 253 },
+  { name: "Norway", co2: 31 },
+  { name: "Poland", co2: 615 },
+  { name: "Sweden", co2: 36 },
+  { name: "Switzerland", co2: 37 },
+  { name: "United Kingdom", co2: 211 },
+  { name: "United States", co2: 384 },
+  { name: "World", co2: 473 },
 ];

</code_context>

<issue_to_address>
**suggestion (bug_risk):** Clarify or centralize the assumed units for `co2` values to avoid subtle misinterpretations elsewhere.

Since these values’ meaning depends on their units (e.g. gCO₂/kWh vs kgCO₂/MWh), consider exporting a shared unit constant alongside `regions` so all consumers format and convert them consistently and don’t accidentally assume a different scale.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@eliaslecomte
Copy link
Contributor Author

eliaslecomte commented Jan 5, 2026

Updated the tests and added 2024 to the comments. I think adding a Region interface / or adding 2024 to the data itself is a bit to much.

@eliaslecomte eliaslecomte force-pushed the feature/co2-add-belgium branch from 052ca88 to 0921553 Compare January 5, 2026 14:06
@naltatis
Copy link
Member

naltatis commented Jan 7, 2026

Thanks for the update!

@naltatis naltatis merged commit 51af4d4 into evcc-io:master Jan 7, 2026
7 checks passed
@eliaslecomte eliaslecomte deleted the feature/co2-add-belgium branch January 7, 2026 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants