Home Energy Advisor - have you ever wondered what each device actually cost to run? Home generation and battery taken into account

Hi all,

Repository: GitHub - consultingtedds/ha-home-energy-advisor: Home Assistant integration explaining the financial impact of per-device energy usage · GitHub

Have you ever wanted to know how much your individual devices are actually costing? How about when you’re running on batteries and solar power, how much am I saving? We have the Energy Dashboard and that’s great for showing how much energy a device is using, but it doesn’t really let me know where my money is going, when I’m making the right choices about energy usage, and where I could be improving.

I’ve been building an integration for my own house. It’s reached the point where it might be useful for yours, so I’m sharing it.

For each device you track, it works out what it cost to run, what the same energy would have cost straight from the grid, and how much your own generation and battery saved you.

It answers questions like:

  • What did the dishwasher cost me this month?
  • Which of my devices costs the most to run?
  • How much did my solar or home generation actually save me, in money rather than kWh?
  • Is the washing machine cheaper overnight on my tariff, or at midday when the panels are producing?

It’s most useful on a dynamic or time-of-use tariff, or if you generate some of your own electricity. It still works on a flat rate with no generation: you get a plain per-device cost breakdown.

Installing
Through HACS, as a custom repository - this button opens it in your own Home Assistant: Open your Home Assistant instance and open a repository inside the Home Assistant Community  Store.

Then select Download, restart Home Assistant, and add it under Settings > Devices & services. Full steps, including installing without HACS, are in the README.

How it works:
Every five minutes it looks at where the house’s energy came from (grid at the current price, your own generation, or the battery) and shares that cost out across the devices that were drawing at the time. I considered these things important:

  • The figures add up. Anything you don’t track goes into an “Untracked” figure, so the devices plus Untracked always match what the meter says the energy cost. If they ever don’t, a sensor tells you.
  • Battery energy is priced at what it cost to store, not at today’s rate. Charge cheaply overnight and use it at peak, and it shows as the saving it is.
  • You don’t need to track everything. Track two devices or fifty.

What you get

  • Sensors per device: energy used, actual cost, cost at grid price, savings, and the energy split by grid, generation and battery. Daily and monthly totals come with them.
  • A ready-made dashboard (Add dashboard > Home Energy Advisor), plus individual cards you can put anywhere.
  • Setup entirely in the UI. If you’ve set up the Energy Dashboard, most of the house inputs are filled in for you.

What you need

  • Home Assistant 2026.7 or newer
  • A sensor with your current import price per kWh. On a fixed rate, a Number helper with your rate in it works.
  • Your cumulative grid import meter (kWh)
  • An energy or power sensor for each device you want costed

Things worth knowing on a fresh install

  • Nothing shows up at first. The sensors take about 20 minutes to start moving, and the dashboard can take up to about an hour and a half, because it waits for Home Assistant’s hourly statistics.
  • You may get notifications about a unit changing to your currency. They’re harmless and safe to accept. The cause is a quirk in Home Assistant’s utility meter, and I’m pursuing a fix upstream.
  • It isn’t your bill. Standing charges and export payments aren’t included, so the total will not match exactly with utility bill.

Where it’s at
This is 0.1.0. I’ve been running it in my own home for a couple of months, with a full validation week where the per-device figures added up to the meter every day. It hasn’t been installed anywhere else yet, so yours may well find something mine didn’t. It’s maintained by one person, me, and I’ll help where I have time.

If something looks wrong, the troubleshooting page covers the common cases. Questions are best asked in GitHub Discussions, where other people can answer and it stays findable.

I’d love to hear from anyone who tries it, especially on setups different from mine.

A note on how it’s built
I have worked as a software engineer and managed teams of software developers for many years, however I’ve built this with AI assistance, and I want to be upfront about that. This is the first Home Assistant integration that I’ve worked on, but I’ve held it to the engineering standards I’d expect of any production code:

  • Every change starts as a ticket, and tests are written first. Nothing gets coded without a ticket saying what it’s for (the ticketing system is not publicly available).
  • Significant decisions are written down. The docs/adr/ folder records each one, including the options that were rejected and why. I make the design calls myself.
  • The accounting engine is plain Python with no Home Assistant code in it, so the maths can be tested on its own.
  • One rule is tested above all others: the figures must add up. Tracked devices plus Untracked must always equal what the meter recorded.
  • Every change has to pass the same checks: linting and formatting, strict type checking, a test suite that must cover at least 90% of the code, and a SonarQube quality gate. CI also runs Home Assistant’s own hassfest and HACS validation, against both the oldest Home Assistant version I support and the latest.
  • Browser tests drive a real Home Assistant instance, in English and Spanish. They check what the dashboard actually shows. They have caught bugs the unit tests couldn’t, such as the dashboard breaking on a Spanish install.
  • It was checked against real data before release. It ran in my own home through a validation week where the device figures added up to the whole house every day, cross-checked against an independent calculation.
  • Releases happen only after the checks pass. The version number comes from the commit history, so nobody edits it by hand.
  • Privacy is checked automatically. The repository is scanned so no real household data ends up in it, and the diagnostics download hides entity ids and device names.
2 Likes

Setup does not accept an input_number - has to be sensor.xxxx. Easy enough to do, but just so you know… :grin:

Thank you for the response, I’ll take a look and see if that’s an easy fix. The sensor was chosen as it needs to handle changing tariffs, but obviously if you have a fixed rate, a sensor is potentially an unneccessary overhead.

Anyway, let me know if it works and how you get on. For me the results have been very interesting. Some things, like the air conditioning which I thought would be really expensive have turned out to be covered mostly by solar production and cost less than I imagined.

As a second follow up, this is definitely a bug, the system should work with a number, it’s just the front end doesn’t allow you to enter one. I’ll fix that and create a new release

1 Like

a new release (v0.1.1) is available with a fix for your issue, but I suspect now you don’t need it. It should be fixed for anyone else though

Going great so far. I have a sensor on my electricity meter, but no energy sensors on sockets etc. (too expensive to refit). I’m finding that Home Energy Advisor works well with the PowerCalc integration, however - that gives you “virtual” sensors based on a database of devices.

Trivial point, but some of your cost sensors have the “mdi:cash” icon by default and some have “mdi:counter”. Presumably this is because of the device class.

Thanks for declaring you used AI, which rules it out for me because of the harms normalising its use causes IMO. (I’ve explained more elsewhere so no need for a discussion here, just wanted to acknowledge your being up front and encourage everyone both to do that, and to look into the wider issues around AI.)

thank you for the feedback and interesting PowerCalc stuff. I’ll take a look at the other issue you pointed out and let you know.

That’s understandable and fair. I will say that I personally review all of the code that the AI generates, but again, it’s your system and for you to decide what you do or don’t want to install.

1 Like

Yes I read that but while code quality is a concern, my reasons are are much wider and of much more consequence to everyone. Thanks for your acknowledgement in good faith.

Good spot, and thanks. I’ve had a look into it, and I think it’s something I can fix, but it’s a small thing, so will probably bundle it in with other fixes.

A big thank you to all the people who have tried the integration, and especially to those of you who have given me feedback. The original release was only ever tested on my house with a small number of devices, so with the extra feedback, we’ve been able to resolve a lot of issues I was never aware of.

We are now at release version 0.3.1 (Release v0.3.1 · consultingtedds/ha-home-energy-advisor · GitHub) and my next step will be to get it added to the HACs default store.

There are a few more things in the pipeline, so please keep me updated on any ideas or problems you face.

Obviously this is designed for people with solar panels and batteries. I have neither, but I am still finding it very useful.

I am, however, having to disable a large number of entities and remove their statistics. Is it feasible to include some kind of setup option for people like me, so that they’re not created (or automatically disabled) in the first place?

Another observation (sorry!).

If a power/energy sensor feeding into Home Energy Advisor becomes unavailable for some reason you get a warning in the Edit Device popup.

However, the output entities still have a value - it just stops being incremented - which means that the problem could go unnoticed for some time.

I normally rely on Spook and Watchman to pick up missing entities, but they don’t spot this. A notification would be helpful.

Thanks for the feedback, these are both good points, and things that weren’t obvious to me as your setup is quite different to mine. I’ll take a look at this and get back to you, I think there’s some things I can fix on my side.

1 Like

Thanks for both of these, they were useful. Both are in 0.4.0.

On the unused entities, yes, feasible, and done. Without generation or a battery, five of the seven figures per device can’t tell you anything: two are always zero, and the other three just restate the sensor next to them. Cost at Grid Price is Actual Cost by another name when the grid is your only source, and Cost Savings is the difference between them, so it’s always nothing.

Those are now created switched off, along with their daily and monthly totals. Nothing is asked at setup, if you haven’t told the integration about panels or a battery, it already knows.

One thing to be straight about: **this won’t change your existing entities.**Home Assistant only applies a default like that when an entity is first created, so yours stay exactly as they are. That’s deliberate, I’m not willing to switch off entities someone might have in an automation or on a dashboard.

What it does mean for you:

  • Any device you add from now on will be clean automatically.
  • If you disable the rest by hand, the integration will now tidy up their daily and monthly helpers for you on the next restart. It wouldn’t have before, so that’s worth redoing if you left those behind.

On the sensor that goes unavailable, fixed too, but not the way I said I would, so it’s worth explaining.

The plan was to make our sensors go unavailable along with their source. I decided not to, we can’t tell a broken sensor from a device you’ve simply unplugged, and the second is far more common. Run a radiator all week and then put it away, and what it shows you is right, that really is what it cost. Blanking that figure for the eight months until you plug it back in would be fixing the rare case by breaking the ordinary one.

So instead each tracked device now has a Last Reading sensor, under Diagnostic on its device page. It says when that device’s sensor last reported something we could count, and it goes unavailable once that’s more than half an hour old. The cost figures stay exactly as they are.

That gives you two ways to catch it:

  • Read it. “3 days ago” on the device page, no tooling needed.
  • Watch it. Spook’s unavailable-entity check will pick it up, because it’s a genuinely unavailable entity. Watchman only reports on entities you reference yourself, so you’d want to add the Last Reading sensors to it.

Nothing raises a notification, deliberately, a heater that’s off for the season would otherwise nag you about it every few days until you plug it back in again.

1 Like

Fantastic! Thank you. And for the detailed explanation.