Per-device electricity cost explorer for your smart home

By General Input

Pick any date range and see what each device in your home actually cost to run, not just how many kilowatt-hours it used.

Integrations

  • Home Assistant
  • Google Sheets

Type

App

Categories

  • Finance
  • Personal Productivity

Build me an app for exploring what electricity actually costs me, device by device. I pick a date range at the top, and the main view ranks every energy sensor in my home by what it cost me over that window, showing kilowatt-hours used, the cost in my currency, and the change versus the previous equivalent period, meaning the same number of days immediately before the selected window. Clicking a device row opens a detail view with a usage chart for that device across the window.

Find my energy sensors with Home Assistant List States, keeping entities whose device_class is energy and whose unit is kWh or Wh. Store that list in app settings so I can tick devices on and off, because I have sensors that overlap (a whole-home monitor plus individual smart plugs) and I do not want them double counted in the ranking. Let me give devices friendlier display names than the raw entity ids.

Pull consumption with Home Assistant Get History, always narrowed with filter_entity_id plus start_time and end_time, never unbounded, because my instance runs on a Raspberry Pi and wide history calls will crawl. Timestamps must be ISO 8601 and URL encoded. Here is the detail that matters most: nearly all of these sensors are cumulative totals (state_class total_increasing), so usage for a window is the last reading minus the first reading inside that window, not a sum of the readings. Handle counter resets, so if a reading is lower than the one before it the counter reset and you add the pre-reset accumulation rather than producing a negative number. Skip unavailable and unknown states instead of treating them as zero. If a sensor turns out to be an instantaneous power reading in watts rather than a cumulative energy total, integrate it over time instead. If a device has no readings at all in the window, show it as no data rather than a zero cost.

Pricing lives in a Google Sheets tariff table that I maintain, read with Get Values. Rows define named rate windows (peak, off-peak, shoulder), each with a start time, an end time, and a price per kWh, plus a separate daily standing charge. Cost each device by splitting its usage across the rate windows it actually ran in and applying the matching rate, so a dishwasher that runs at 2am is priced at off-peak. Show the standing charge as its own line in the total, calculated as the daily rate times the number of days in the window, kept clearly separate from device costs because it is not attributable to any single device.

I want to edit those rates without leaving the app. Give me a tariff panel where I can change the windows, the prices, and the standing charge, and saving writes them straight back to the sheet with Update Values, after which the whole breakdown recalculates. Validate before saving: prices must be positive numbers, and the rate windows must cover the full 24 hours with no gaps and no overlaps.

Two more actions in the toolbar. First, export the current breakdown to my costs spreadsheet with Append Values, writing one row per device for the selected window (date range, device name, kWh, cost, change versus previous period), plus a row for the standing charge. Second, publish my month to date total cost back into Home Assistant with Create or Update State, writing to a sensor entity I name in settings, something like sensor.home_energy_cost_mtd, with the currency and a friendly name in the attributes so it can sit on my wall tablet dashboard. Note that Create or Update State writes a state representation only, it does not command any device, and Home Assistant drops these values on restart, so make the publish button easy to hit again.

Add an Explain this spike button on every device row and on any day in the device chart. It starts a background agent, and the app shows that device's explanation as pending while the agent runs, then displays the finished result in the detail view. The agent pulls Get History for that device across the window in question, pulls Get History for the rest of the home's energy sensors over the same window for context, and compares against a baseline period such as the same weekday previously or the previous equivalent window. It works out what was running when the cost jumped: a longer runtime, more cycles than usual, running during a peak rate window instead of off-peak, or another heavy device being on at the same time. Then it writes a plain-language explanation of what happened, in the tone of talking to a housemate rather than an engineer, plus two or three concrete savings suggestions tied to my actual tariff windows, for example shifting a specific appliance to a specific time of night. The explanation lands back in the app and also gets appended to a log tab in my spreadsheet with Append Values, so I build up a history of everything that has been explained.

Keep in app settings: my tariff spreadsheet id and tab name, my costs spreadsheet id and its export and explanation log tabs, my currency symbol, the entity id to publish the running total to, my device selections and display names, and my last used date range so the app reopens where I left it. Give me sensible date range presets: this month, last month, last 7 days, last 30 days, and custom.

To be clear about scope: this app reports costs and publishes derived values. It does not switch anything on or off, and none of its copy should suggest that it can.

Related prompts

Explore more prompts
Call overdue Xero customers with an AI collections agentLocal listing health board for every location you manageLet support send one-off Loops emails without an engineerStop cold emails to anyone with a live deal in PipedriveiMessage campaign console with pre-flight checks and delivery boardLinkedIn Ads budget pacing dashboard for every client accountFront desk appointment confirmation board for the next 3 daysGive your team Looker numbers without buying more seatsBuild audience segments from product usage and push to LoopsTurn the people who engage with your posts into Pipedrive leads