Add a module to retrieve electricity use from Linky

In France, lots of people start having the new Linky smart electricity meter (that should replace all electricity meters in France). That meter reports use to ENEDIS, that allow you to create a user account to look at it and export it. That enables doing statistics and tracking that use.

So modules already exist to retrieve this, in order to use it in some apps, like jeedom: https://github.com/Asdepique777/jeedom_linky

I think that would be great to be able to make use of it in home assistant.

Thanks for your help doing this and voting for it!

I start to develop a custom components for linky
Feel free to contribute

3 Likes

Hello, Some time ago I was able to retrieve my Linky conso and add it trough text file sensors to HA based on the Jeedom module.
I could help if needed!

it seem to work, maybe not optimal.

I use your code, and it works great
Bravo!


I did not see the Halfhourly sensor in order to get real time comsumption and calculate the Off-Peak and Peak Consumptions and Prices. so I made some Template sensors to get them.

Halfhourly sensor is useless because it’s a -1d not the current day :frowning:

Yes, but the -1d gives you a cumulative of the day consumption while half-hourly gives you exactly that, a half-hourly description of the day’s consumption so you could calculate the off-peak and peak hours by the exact valor of your consumption.
Ex. in my region the Off peak hours are from 3:30 am to 8:00 am and from 13:30 to 16:00 so you could do a sum of those hours (KWh) and get your real off-Peak consumption then you substract that from your -1d and you get your real peak hours.

Maybe I am overcomplicating this thing :slight_smile:

make sense. I update my repos with Halfhourly sensor

Hi, could you share your configuration because. I don’t see how you obtain split between Heures Pleines and Heures Creuses. Thanks by advance

It all depends on your contract. The Heures pleines and creuses changes by region so in mine the creuses are from 3:30 am to 8am and 1:30 pm to 4:00 pm

So this is my linky.yaml:
Thanks to Pirionfr!

https://pastebin.com/mW56SZmQ

then after creating the sensors, I just did all the operations with some template sensors:

https://pastebin.com/5wkN6BeZ

And here is my groups conso section:

https://pastebin.com/VRvB8uQv

If you need more info, just ask!
:wink:

Thank you, i will adapt your script with my own hours (from 11:00 pm to 7:00am fo Heures creuses) and test it. i use home assistant since a few time and i haven’t test templating yet. It seems to be very useful. In your files you indicate some sensors for grafana. You use grafana inside home assistant to display global graph of your consumption ?

No I use Grafana as a stand-alone solution to graph the HA sensors.

I forgot to put the HA view.
This is my HA conso view :

Using the custom sensor for linky by Pirionfr, I am able to retrieve my linky conso in HA.
I have however some questions (for ursus69)

  • How do you change the name of linky variables (using the name of the day or the month)
  • To graph the daily consumption using grafana, I store the variable linky_daily_1d_consumption in influxdb. However when I display the variable with grafana, the timeline is shifted by 1day. How do you correct the timeline (it required a negative time shift, which is not allowed with grafana)

Hello,

I do not change the names for the sensors, HA is the one that put the right names.
I only change the names of my Template sensors.

And this is what I have on Grafana with no problems at all
graf

Sorry I cannot help you more.

@ursus69
Thanks for your reply

  • in your HA conso view , you display template sensor and note directly the linky variables
  • for grafana, i can draw my daily consumption curve using linky_daily_1d_consumption but the the day is not correct: i.e. the consumption display for today correspond to the consumption of yesterday (which is logical because linky_daily_1d_consumption is the yesterday consumption).

Hi @Pirionfr, I have started to use your custom component recently, and it works great, but retrieving the data fails very often, displaying Unknown on the front end (a few hours every day)

Am I the only one having this issue?

Here are some screenshots with the details

Front-end

front front

States

Log

Thanks a lot :+1:

I only have problem when site are down

I’ve just tried to setup this custom component, but in my ENEDIS account there is no data. Do you know the standard duration before having cunsumption data ? My linky was installed in April this year.

Bonjour,
You should activate the Charge Courve, to do this,

Tu dois cocher :
J’autorise expressément Enedis à enregistrer ma courbe de charge afin de pouvoir la consulter pendant 12 mois.

dans Consomation > Gérer ma courbe de charge

Cordially

Jose

Thank you for the tip but I don’t have yet this option. I think my linky is not yet fully integrated in the Enedis service.
ENDEDIS

I’ve opened a ticket yesterday to have some explaination from the website support.