Graphing a statistic that doesn't have an entity (opower)

I’m new to HA, so apologies if this is a basic question.

I’m trying to use create an apex chart to graph my daily gas consumption, which I am getting via the opower integration with my PG&E account.

As I understand it, because the utility data can be delayed up to 24-48 hours the integration does not provide an entity, it only provides a statistic. For example, the Statistic ID I have is: opower:pge_gas_XXXXXXXXXX_energy_consumption

My question is: how do I graph this data? There is no entity or sensor that I can point to, from what I can tell. Is there a way to point to “statistic_id” instead of “sensor.XX”?

I set up the stock energy dashboard, and the Gas card is displaying gas consumption as expected.

Running v 2026.1.3

Thanks for your help!

Welcome to the forum!

My understanding is that there must be an associated entity ID. If you look at the underlying database tables, you’ll see the the statistics meta table has the entity ID as a lookup. Everything in HA is centred around entity IDs. HA performs the aggregations that go into the stats tables, and that must happen on an entity ID.

If you navigate to the device, have you checked all the available entities?

CORRECTION: I didn’t know you could log stats without an entity ID. TIL.

This is not a basic question at all!

Since utility meter consumption readings usually arrive as a block update of 24 hours, and a day or so late, they are not available immediately in the standard sensor.gas_energy_consumption entity. The standard “sensor.” entity will be captured by the HA Recorder every hour into the long-term statistics, and we can get at these value for plotting in an Apex Graph using the normal entity or from the long-term statistics table by using the extra statistics option. However, these entities will have a state value that typically only changes once per day, being the last consumption value from the previous day, updated only when the new block of consumption values arrives.

Integrations can however add back in to the long-term statistics table the appropriate records for each hour, with a consumption reading as it would have appeared if the data had been available live. These extra values are added using names such as octopus_energy:gas_energy_consumption where the . is replaced by :.

Since these additional records are not created by the Recorder, and do not have an owning entity, we have to access them slightly differently.

The standard Statistics Graph card will accept any sensor. entity and also any integration: entity, known as an “Entity without state”. You just have to type in the opower:pge_gas into the “Add a statistic” box and it should appear in the dropdown list for you to select.

You will probably need to set the stat type to “State”, and use the ‘hour’ period.

This graph shows the difference between the two “entities”.

The yellow line comes from the standard “sensor.octopus_energy_gas_accumulative_consumption” entity that exists in Home Assistant with a state value that is updated once per day, and shows the total consumption for a day before. In my case, the readings are coming in two days after, so the reading updated early today (3rd Feb) is for what was used during 1st Feb.

The blue line comes from the “octopus_energy:gas_accumulative_consumption” extra ‘entity without state’ that has been back-added later by the integration, and hence there are 24 hour records for the 1st of Feb, showing the use hour by hour up to the total that matches with the sensor, albeit a couple of days later.

As far as I know, there is no way to do this in Apex Graphs, so you should use this card instead.

Thank you @Biscuit! I was able to pull up my opower gas consumption statistic using the Statistics Graph card, like you said.

My next question, then, is: is there any way to access this “Entity without a state” via other means? For example if I wanted to create a template sensor to work with the data in some way?

I can’t seem to find this concept in the documentation.

thanks!

It’s not showing up in my list of entities or even under Dev Tools > States.

The only place I find this referred to is under Dev Tools > Statistics

There is an action called recorder.get_statistics where you can retrieve the raw data for this external statistic from the recorder. You can then pair that with a template sensor to parse the return data and compute something.

1 Like

thank you @karwosts!