In simple terms, Home Assistant uses ‘sensor entities’ that hold ‘state values’, almost all of which are created (registered with HA) by the various ‘integrations’. The creating integration (some of which are built-in) is then responsible for updating the entity state.
Here, we are using the Octopus Energy (Bottlecap Dave) integration. There is quite a lot going on in this integration, and it can be worth reading the documentation if you want to get the most from it. To get a graphical display of usage to work requires many things to be set correctly.
The entity sensors we require here are the previous accumulative consumption (electricity / gas) and the documentation for this can be found at
Note the warning message - the latest data is always for yesterday and may not arrive until very late in the day.
I note that in the latest version 10+ we now have “latest available data timestamp” attribute in this sensor, which should indicate if the consumption values now relate to yesterday (updated) or the day before (yet to update)
Since there is a limit on how many API calls can be made to Octopus Energy each day, the call to update the previous consumption figures will clearly only happen infrequently.
https://bottlecapdave.github.io/HomeAssistant-OctopusEnergy/faq/#how-often-is-data-refreshed
The integration also includes a service call that can be used to force a refresh (useful where you have just added the integration and would like existing data to be loaded into the sensors).
To get the data for yesterday to arrive into the sensor
- Octopus has to read the meter and update your account meter reading history. This only happens during the early morning to late afternoon
- The integration has to make the necessary API call to obtain the latest meter readings / consumption. This only happens every 30 minutes or so.
- The integration has to process the data and update the sensor.
My electricity consumption has only just updated, and I am still waiting for the gas figures. For most days, I only get to see “yesterday” for gas during the late afternoon-evening, and yesterday my gas figures updated just before midnight, which makes for little practical use. For this reason, the integration configuration allows for changing the previous consumption days offset from 1 (yesterday) to 2 (the day before yesterday) or greater - which would show a full day of figures all day, but for the day before yesterday.
So… here is my latest Octopus Electricity (Import) previous consumption sensor - attributes. You will see that it was last evaluated at 15:37, which is when the graph actually updated with yesterdays figures because the integration actually found something new. The data was last retrieved at 17:37 (which is the integration just going around every 30 minutes looking to see if anything has changed). And the ‘latest available data timestamp’ shows 01:00, which is midnight last night (UTC - BST difference) when the end of yesterday’s figures comes to (allowing for the fact that the consumption figures end at 23:00 yesterday and not midnight).
I am sure that Albert Einstein would have no problems at all understanding this ‘smart meter’ stuff.