Integrations

Recorder

Spook adds an action to import long-term statistics into the recorder, and tells you when statistics belong to no entity anymore.

The recorder integration in Home Assistant stores everything that happens in your home. It is the backbone of the history and the logbook. It also keeps long-term statistics, which power the energy dashboard and other graphs you see in Home Assistant.

Actions

Spook adds one action for the recorder. You find it wherever you add an action, marked with a 👻.

Import statistics

Imports long-term statistics into the recorder database of Home Assistant.

Your energy history does not start the day you installed Home Assistant. Your energy provider has years of it, often as a CSV file you can download, and a previous system may have its own. This action writes that history into the long-term statistics, so it shows up in the energy dashboard and the statistics graphs.

How to use it

  1. Open the script that should do the import, and select Add action.
  2. Search for import statistics, and select Recorder: Import statistics 👻.
  3. Fill in Statistics ID, usually the entity ID of the sensor, and Source, usually recorder.
  4. Turn Has a mean and Has a sum on or off to match the kind of sensor: a meter that counts up has a sum, a temperature has a mean.
  5. Optionally, fill in Name and Unit of measurement.
  6. Fill in Statistics, the list of values to import, one per hour. This one is easiest in YAML, see the example below.
  7. Select Save, and run the script once.

Just want to see it work? Try this action opens it in your Home Assistant, ready to run once.

Importing writes straight into your long-term statistics, and there is no undo. Wrong numbers end up in your graphs and the energy dashboard. Try it on a statistic you can afford to lose first.
The Actions tool with Import statistics 👻 picked and filled in with an example.
What Try this action opens, filled in with an example.

Repairs

Spook looks through the recorder for long-term statistics that no entity belongs to anymore, and tells you in the repairs dashboard.

This one Spook can fix for you, straight from the repair. New to repairs? Follow Fix your first repair.

Orphaned long-term statistics

The recorder keeps long-term statistics for sensors that no longer exist, usually because a sensor was removed and its history was kept. Not harmful, but they take up database space, and keep showing up in pickers and graphs long after the sensor is gone.

The Orphaned long-term statistics repair, listing the statistic of a meter that is gone, with the choice to clear it.
The repair lists every statistic it would clear, before you choose.

How to fix it: Open the repair, and choose Clear these statistics to have Spook throw that history away, for good. Or choose Let me do it myself, which points you at Settings > Tools > Statistics. Want to keep them? Keep them, stop telling me leaves them alone and stops the repair coming back. The repair disappears by itself once it is fixed.

Use cases

What people use this for:

  • Import data into the recorder yourself. For example, history from a previous system, or the CSV file with your energy usage from your energy provider.

Missing something here?

An action, an entity or a repair this integration should have? Say so. Stuck, or found a bug? There is help.