Carbon footprint sensor?

There are plenty of carbon footprint calculators out there. Did any of you construct a sensor working in a similar fashion?

Essentially that would be something that could pull info from your gas meter, electricity meter or car mileage if you have it hooked up to HA.

Has anybody done it already by any chance? Ideas?

1 Like

Answering to myself - coulnd’t find anything like that :frowning:
What I did find, somewhat related:
Carbon intensity sensor (not home related, general), UK: GitHub - tonytw1/home-assistant-carbon-intensity: Adds Home Assistant support for the National Grid's Carbon Intensity API in Great Britain.
… and somewhat related blog entry: Home Improvements with Home Assistant | Carbon Co-op

There is also CO2 Signal - Home Assistant

I use it to get the current CO2eq/kWh of the power grid. Perhaps there is some way to use Integration - Riemann sum integral - Home Assistant and calculate the total CO2eq you have produced for a given time interval.

Of course this does not give you a full Carbon footprint, it only works well when everything at home is powered by electricity (as is the case for me).

Just stumbled across this thread. I think I’ve basically done what @_Brian is suggesting (or something similar). I’ve also calculated the carbon emissions from my natural gas furnace based on the ecobee runtime state. Happy to share more details if people are interested.


Hi @ryanfobel That looks great. I am looking to do something similar.

Can you share more details of your setup please?


Hey Ryan

Would you mind sharing more details regarding your setup?

I’m planning of trying to find a way to calculate my Carbon footprint based on my car usage, utilities usage and the garbage. Would be good to know the backend of what you did in your dashboard



Hi all,

I have been looking at calculating emissions of CO2Equivalent for my energy consumption and thought the easiest path would be to augment the core energy dashboard and features (at least to test the ideas).

I have made some progress now and thought I’d share here as this thread has some interest on the topic. All the work is currently on a branch in my own repo. It needs to have quite a few tests added and quite a bit of refactoring.

I have added three new cards and some functionality in the energy modules to calculate emissions, offsets (if for example you purchase a “greenpower” energy package that has a guaranteed offset) and avoided/exported (“truly negative” emissions).

I added an “Energy emissions” graph card that is a chart with electrical emissions, offsets and avoided and gas emissions and offsets. An “Emissions table” with the various types of emissions as on the chart and a net emission and an absolute emission for the selected period. There is also an “Emissions gauge” showing net emissions. These all operate on the same period selection as the rest of the energy work.

I have been generating test energy flows on my development environment so it doesn’t match reality and looks a little weird (I will deploy to my home assistant after it is more robust).

The animated gif shows what it looks like on the energy dashboard:

Energy emissions graph and table daily:

Energy emissions graph and table weekly:

Energy emissions graph and table monthly:

My aim in making these changes was to enable me to track my absolute and net emissions accurately as my family looks to stay as close to zero absolute emissions as possible and to be very negative net emissions. I also want it to be usable for others to track their emissions just for understanding or to approach net zero or attempt close to absolute zero.

This currently works very well for all-electric homes and uses CO2 Sensor (as already configured in Energy). I wanted it to work for gas power also (using static conversion for co2equiv). I also added an ability to set the amount of offsets for the source as configuration.

I’ll need input on how to treat gas and appropriate conversions and defaults.

I think fossil-fuel powered vehicle mileage would be good to add also. I don’t even know how people are tracking that currently in home assistant.

I have also starting experimenting with embodied carbon of purchases (which I track separate to home assistant currently). I don’t think home assistant does well as a logger for tracking “manual inputs”. I also think it doesn’t fit in the energy tab anymore in that case (but not sure how it should be rehomed for emissions) so lots of discussion to go there.

Keen for thoughts and feedback and what you’d like to see in this area.



This is awesome, great work!

First, I think it’s great idea to augument Energy dashboard.
On gas calculations - I found this thread:

Interesting sources and calculations. Summing up - about 2.2 kg of CO2 per m3 of natural gas, but excluding transport/taxation/extraction, which may vary depending on source of the gas (they suggest it can be about 10% but may be more).

Re dashboard - it would be really cool to have visualisation of which activity emits most (just like it already is with energy, split into particular devies).

Hope that helps somehow, awesome work!


I would be very interested in testing your changes, do you think it would be ready to be shared?

Hi @kamaradclimber ,

Thanks. It is ready for some testing but there is the difficulty that as this is a small change to the backend core (energy API) and the front-end “core” that it isn’t as simple as getting an alpha of a component or card.

So testing would either be (a) a “build it yourself” on your own test environment or (b) installing a development build on your production instance.

I haven’t even worked out how to share the development build to my own production setup.

The changes are quite low risk. There is a basic change to the energy API and the rest is front-end data manipulation. So no risk of corrupting databases etc.

You look to have been around HA for a while would you be interested in either of those testing options?

Thanks. I’ll add in some gas defaults based on that and a configuration option.

The emissions are tracked at the “interface” to the grid or gas. I have broken down by their contributions there.

What breakdown are you keen to see? As we can only properly calculate emissions of exports vs imports.

Individual devices are “inside the house” or “behind the meter” and might be sourced by solar, or battery or grid.

I’d be up for the challenge of creating a “how was energy sourced at the time the device was in use with emissions for that” approximation of that is what you are keen to see.

1 Like

Sure, I’ve never built home-assistant from scratch but that should be doable given the number of contributors on the platform.

Thanks - It will be great to have your inputs.

Yes, it is pretty simple to setup the Dev environment. The vscode/docker containers are really easy to get going with.

I’ll read up a little on how to create a build that can be selected/installed easily (as I want to test on my production instance also and need that skillet). That will be more accessible for you and others if I solve it also.

Here are the getting started docs for trying to build it from scratch in a Dev environment.

Set up Development Environment | Home Assistant Developer Docs.

1 Like

I’m using the home assistant container, I’ll adapt to any distribution you can propose :slight_smile:

1 Like

I am currently reworking this whole piece of work to use the recorder/statistics.

I based my code off the fossil fuel proportion calculator but it is more similar to the energy cost in how it should be implemented.

(I won’t get back to this this week - my current unrelated HA challenge taking my time is that I just got twenty aqara ZigBee temperature sensors and as they aren’t properly following the ZigBee check-in/keep-alive they all after a couple of hours).


I too would be interested. I am looking to do something very similar.

1 Like

Great stuff. Would also be interested to use this in my setup!
Once it is more robust, can we request it to be implemented in the main HA release?

1 Like

Looks great, I was thinking of implementing something like this myself. What is the current status of this project? If possible, I would like to test is and maybe help finalizing it if needed.

1 Like

The very words I was just about to post. I also will volunteer to test, though it would have to be when the implementation is a little further along, as I could not complete a dev build due to issues with the kernel version I have (and I’m running Ubuntu Studio, which is not in complete sync with the more normative Ubuntu).

I also was thinking that the idea of entering gasoline/diesel gallons/litres would fit very nicely, as I’m already counting the kWh on my PHEV. A separate thread on this would better keep the idea alive, though.

@brodykenrick , can you share the current status of your carbon footprint sensor implementation? I am extremely interested.

1 Like