Check your electricity consumption at home with Home Assistant using datadis and e-data

We have been using this system for more than a year and a half, and in our experience, you must be patient with the data obtained, since in many cases your supply data is not updated in real time, this is almost never due to e-data integration, but it is a Datadis service problem. Although on certain occasions we cannot see the consumption from yesterday or two days ago, we can see a complete history without problems, and we will know that it will be updated little by little as Datadis provides this data. In our case, our electricity supply is not updated every day, but weekly where all the previous data is obtained. However, when supplying family members with the same system, it is always updated daily, and even though the installation is exactly the same, nothing changes except the Datadis service, so you must take that into account.

Once you know what we can do, we are going to show you how to sign up for the free service and start seeing all your electricity consumption.

Sign up for Datadis

The first thing we must do is register in Datadis To obtain access to all our supplies, depending on the identification (DNI or digital certificate), access will take a few days until they verify that everything is correct, or it will be instantaneous if you do it with the digital certificate. We have always verified the identity through the digital certificate, logically the owner of the supply must correspond to the owner of the digital certificate, otherwise, we will not have access to the data since it is private.

Access is done through the official website of the service, we go to the registration section, we will say that we are individuals and we fill in the name, surname, ID, email and password to access the service. Then we have to verify our identity, either with a DNI (verification will take time) or with a digital certificate (it is instant).

Once you have registered and verified your identity, we can access all of our supplies. Access must always be done with the DNI (username) and the password that you have entered in the registration. In the main menu, we can see all the supplies and the logo of the supply distributor. If we access inside, we can also see all the consumption data with different graphs.

We can see daily, weekly, monthly, annual consumption, both in off-peak, flat and peak hours, as well as everything related to self-consumption and what we have exported to the network. If you have solar panels, from here you will also be able to see in detail everything you have exported in a given month. Other options that we have available are the possibility of seeing the maximum contracted power in our home, and also the maximum power demanded, perfect for knowing if we have the contracted power in our home correctly dimensioned.

Once we can see all the data in Datadis, we are going to go to our Home Assistant to install and configure the e-data integration to obtain all the data through the official Datadis API.

Installing and commissioning e-data in Home Assistant

Before installing e-data, our recommendation is that you install additional software through HACS called apexcharts-card and it is related to lovelace, it will allow us to graphically display all the e-data data, in addition, we can use apexcharts-card to display information other than e-data, it is quite interesting software.

To install both apexcharts-card and e-data, we must go to the “HACS” section, previously we had to install this additional software to install third-party add-ons not approved by the Home Assistant team. In RedesZone you have a complete tutorial on how to install HACS.

To install apexcharts-card, we simply have to search for it using the built-in search engine, click on the software, it will show us everything it is capable of showing with different graphs, and the “Download” button, click on this button and proceed with its facility. Once installed, it will ask us to reload the website to refresh the cache.

The installation of e-data is similar, in this case, we have to click on the three vertical dots and select “Custom Repositories”, here we will add the following URL:

And we say that it is «Category: integration«, and click on «ADD«. Now what we will do is use the search engine and enter “e-data”, we will get the integration that we just registered, we go inside and we can see all the information we have in the official GitHub of the project, we click on the button “Download” and we proceed to install it. Once downloaded and installed, we have to go to “Settings” and proceed to restart Home Assistant with reloading the integrations.

At this time we will have installed both e-data to obtain the data, and apexcharts-card to show all the graphs.

Now we have to go to the «Settings / Devices and services«, here we click on the «Add integration» button, and search for «e-data». We wait a few seconds until the configuration wizard loads.

When you load the integration configuration, we will need to enter the following Datadis data to access the supply data:

  • Username: it is the DNI that we have registered in Datadis.
  • Password: is the password you entered when registering.
  • CUPS: is the supply identifier, you can obtain it directly from the Datadis website. It's all caps with letters and numbers.
  • Authorized NIF: you leave it empty, it is not required because you are registered to see your own supplies.

Once filled out, click on the «Send«.

It will tell us that the integration has been created for XXXX, they are the last four characters of your CUPS.

We wait a couple of minutes, and in the “Integrations” section, edata should appear with the four characters of our home CUPS. If we click on «Set up» we can activate both billing and PVPC

Now we will have the sensor ready that will obtain all the data from Datadis. If we go to the «Entities«, we can search for this sensor that ends in the last four characters of our CUPS. If we deploy the «Attributes» we can see all the information you have obtained from Datadis.

Our recommendation is that you leave the Home Assistant for a couple of hours downloading the data, because the Datadis API has limitations to avoid massive downloads of information, and to have some control over all requests. Meanwhile, you can configure all the cards to view the data.

Configure cards in the main menu

In our Home Assistant we have different cards, which will show us different information. Depending on what we want to see, we can configure some cards or others. In our case, we have the following:

  • Consumption yesterday: it will show us yesterday's consumption (if the data has been updated). It will show us both the total consumption as well as that of the peak, flat and valley periods.
  • C. Last 10 days– We can see the detailed consumption for the last 10 days, but we can move the bottom bar to see the daily detail for the last 30 days.
  • C.Current Month: is the consumption for the current month (as far as it has been updated). It will show us the total and the three periods, in case you have a rate with time discrimination.
  • C.Last Month: is the consumption for the last full month (if it has been updated). It will show us the total and the three periods.
  • Monthly consumption last year: is the history of the monthly consumption that we have had in recent months.
  • Maximum power last year: It is the maximum power demanded in the last year, to know if we have the power correctly dimensioned.

In the following image you can see the current status of our Home Assistant:

In the following gallery you can see the data of the perfectly updated supply, and in the second screenshot our supply that has not been updated since December 17 (we are now on December 29 when the screenshot was taken). As you can see, depending on the supply we will have the data perfectly updated or not, using the same integration of e-data and Datadis.

Now we are going to leave you the source code that we have used to create the different apexcharts-card cards, the only thing you would have to change is the part of “sensor.edata_99nk” for yours, which is exactly the same but changing the last four characters that refer to the CUPS.

To add the different cards, we must go to the main menu and in «Add card» we select «Manual» which is at the bottom. In the text box on the left is where you must copy all the code, and on the right it will show us the graph. The indentation is very important since it is YAML code, in this link you can download a TXT file with all the source code that you must use.

You have to put each section of the file on a different card, just like we have. Once done, you can see in the graphs everything related to your energy supply at home.

Leave a Reply

Your email address will not be published. Required fields are marked *