Manual Input Sensor with access to history

Hello all,

I want to keep an eye on my eletrical consumption, but I don’t have any connected device for that (and I don’t want to buy one). So I wanted to create an input field and manually report the value.

I found this answer : https://community.home-assistant.io/t/component-for-manual-meter-readings/34515/2.

This works well, but I have some old data stored in a google sheet that i’d like to add.
Do you know how to acces the history of the input_number ? Or is there another way to do so ?

Thank you !

Hi, I’m trying to find a solution to store historical data, like you.
But I don’t find a final solution in forum it self.

Normally all this requests came from meters, that the energy, water, gas… companies have in their websites for every customer, and if you download this data, all data are from “past” time, not real time.

I’m only have approximations, in order to summarize my findings:

  1. One approximation is doing “insert’s” data in database…
    :blue_book: Documented here: History - Home Assistant exists information about fields.

    Requested by:

  1. Another approximation is doing POST using API.
    :blue_book: Documented here: https://developers.home-assistant.io/docs/en/external_api_rest.html#post-apistatesltentity_id

    Requested by:

  1. Maybe another is set a file sensor
    :blue_book: Documented here: File - Home Assistant but note:

    :warning: Only the last line of the file is used.

One of my idea is to create a utility meter component:

utility_meter:
  daily_electricity:
    source: sensor.energy_in_kwh
    cycle: daily
  monthly_electricity:
    source: sensor.energy_in_kwh
    cycle: monthly

And we can use: sensor.integration (to help you convert Watt to KiloWatts) KWh = Power in W * time in minutes / (1000 * 60)

And I like the idea of number 1 and 2 (Database and POST solution) but for example of using “past date and time” inside a attribute when you POST state sensor, for the moment I can not get this.

If anyone have a “better” approximation or a final solution I will appreciate.

1 Like

Some time has passend, i am also looking for that, did you find a solution?

Hi, during this time something happen, cost of energy it’s important, then: Energy Management in Home Assistant - Home Assistant
and devices around energy Integrations - Home Assistant
And with this new explanation you will have an idea: Understanding Home Energy Management - Home Assistant but not for “historical measures”.

Maybe I’m wrong but I haven’t (yet) been able to find a “simple” solution.
:thinking:

I have been trying to do this as well. Were you able to find a solution? I get hourly sensor day from utilityapi but the API end point is only updated once per day. I can get the last several months of hourly data, but not real-time.

At the moment I have not found any solution to enter historical data.