Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(#158): Convert units to CO2 or $ #159

Merged
merged 11 commits into from
Jan 28, 2024

Conversation

madsciencetist
Copy link
Contributor

@madsciencetist madsciencetist commented Jan 19, 2024

A sankey chart used to display energy usage (gas and/or electric) can now convert the native energy units (kWh or cubic feet of gas) into their corresponding monetary cost or CO2 intensity.

Cost:

energy_date_selection: true
convert_units_to: monetary
monetary_unit: USD
gas_price: 0.022405
electricity_price: 0.30112

image
Note that while HA's Energy Dashboard knows and tracks utility prices, the API does not make them available to us outside of over-summarizing statistics like total cost. Thus utility cost must be supplied to the sankey config, and only fixed rates are supported.

CO2 intensity:

energy_date_selection: true
convert_units_to: gCO2
unit_prefix: k

image

For carbon intensity, we are able to use (abuse) the HA API to actually get the carbon intensity of all electricity usage on an hourly basis. Gas is assumed to have a fixed (but configurable) carbon intensity of 66.6 gCO2 per cubic foot.

Closes #158

@madsciencetist
Copy link
Contributor Author

This is my first time using lovelace, TS or JS, so feel free to correct what doesn't make sense.

src/section.ts Outdated Show resolved Hide resolved
@MindFreeze MindFreeze added the enhancement New feature or request label Jan 20, 2024
per EIA 2022, natural gas emits 55.0 gCO2/ft3 when burned, but per "Life
Cycle GHG Perspective on U.S. Natural Gas Delivery Pathways"
(Littlefield, Rai & Skone), supply chain adds an average of 12.2
gCO2e/MJ (11.6 gCO2e/ft3) to the lifecycle embodied carbon, with the
actual amount varying by region.
@MindFreeze MindFreeze changed the title Convert units feat(#158): Convert units to CO2 or $ Jan 26, 2024
@MindFreeze MindFreeze merged commit 668f3d6 into MindFreeze:master Jan 28, 2024
1 check passed
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.

Convert energy to CO2 or $
2 participants