Add a module to retrieve electricity use from Linky

Hi Oncleben31,

Thanks for information. The linky custom_components is working on my side now, but I have this error :
invalid config for [sensor.linky_custom]: [monitored_variables] is an invalid option for [sensor.linky_custom]. Check: sensor.linky_custom->monitored_variables.

when I’m trying to have day -1 cost, consumption with the following template :

  • platform: template
    sensors:
    conso_hp:
    friendly_name: “Consommation de la veille en heures pleines”
    unit_of_measurement: ‘kWh’
    value_template: “{{(float(states.sensor.linky_halfhourly_00_00_consumption.state)+float(states.sensor.linky_halfhourly_01_00_consumption.state)+float(states.sensor.linky_halfhourly_07_00_consumption.state)+float(states.sensor.linky_halfhourly_08_00_consumption.state)+float(states.sensor.linky_halfhourly_09_00_consumption.state)+float(states.sensor.linky_halfhourly_10_00_consumption.state)+float(states.sensor.linky_halfhourly_11_00_consumption.state)+float(states.sensor.linky_halfhourly_12_00_consumption.state)+float(states.sensor.linky_halfhourly_13_00_consumption.state)+float(states.sensor.linky_halfhourly_17_00_consumption.state)+float(states.sensor.linky_halfhourly_18_00_consumption.state)+float(states.sensor.linky_halfhourly_19_00_consumption.state)+float(states.sensor.linky_halfhourly_20_00_consumption.state)+float(states.sensor.linky_halfhourly_21_00_consumption.state)+float(states.sensor.linky_halfhourly_22_00_consumption.state)+float(states.sensor.linky_halfhourly_23_00_consumption.state)+float(states.sensor.linky_halfhourly_00_30_consumption.state)+float(states.sensor.linky_halfhourly_01_30_consumption.state)+float(states.sensor.linky_halfhourly_07_30_consumption.state)+float(states.sensor.linky_halfhourly_08_30_consumption.state)+float(states.sensor.linky_halfhourly_09_30_consumption.state)+float(states.sensor.linky_halfhourly_10_30_consumption.state)+float(states.sensor.linky_halfhourly_11_30_consumption.state)+float(states.sensor.linky_halfhourly_12_30_consumption.state)+float(states.sensor.linky_halfhourly_13_30_consumption.state)+float(states.sensor.linky_halfhourly_17_30_consumption.state)+float(states.sensor.linky_halfhourly_18_30_consumption.state)+float(states.sensor.linky_halfhourly_19_30_consumption.state)+float(states.sensor.linky_halfhourly_20_30_consumption.state)+float(states.sensor.linky_halfhourly_21_30_consumption.state)+float(states.sensor.linky_halfhourly_22_30_consumption.state)+float(states.sensor.linky_halfhourly_23_30_consumption.state)) / 2}}”
    conso_hc:
    friendly_name: “Consommation de la veille en heures creuses”
    unit_of_measurement: ‘kWh’
    value_template: ‘{{(float(states.sensor.linky_halfhourly_02_00_consumption.state)+float(states.sensor.linky_halfhourly_04_00_consumption.state)+float(states.sensor.linky_halfhourly_05_00_consumption.state)+float(states.sensor.linky_halfhourly_06_00_consumption.state)+float(states.sensor.linky_halfhourly_14_00_consumption.state)+float(states.sensor.linky_halfhourly_15_00_consumption.state)+float(states.sensor.linky_halfhourly_16_00_consumption.state)+float(states.sensor.linky_halfhourly_02_30_consumption.state)+float(states.sensor.linky_halfhourly_04_30_consumption.state)+float(states.sensor.linky_halfhourly_05_30_consumption.state)+float(states.sensor.linky_halfhourly_06_30_consumption.state)+float(states.sensor.linky_halfhourly_14_30_consumption.state)+float(states.sensor.linky_halfhourly_15_30_consumption.state)+float(states.sensor.linky_halfhourly_16_30_consumption.state))/2}}’
    conso_mensuelle_glissante:
    friendly_name: “Consommation sur 1 mois glissant”
    unit_of_measurement: “kWh”
    value_template: “{{(float(states.sensor.linky_daily_1d_consumption.state) + float(states.sensor.linky_daily_2d_consumption.state) + float(states.sensor.linky_daily_3d_consumption.state) + float(states.sensor.linky_daily_4d_consumption.state) + float(states.sensor.linky_daily_5d_consumption.state) + float(states.sensor.linky_daily_6d_consumption.state) + float(states.sensor.linky_daily_7d_consumption.state) + float(states.sensor.linky_daily_8d_consumption.state) + float(states.sensor.linky_daily_9d_consumption.state) + float(states.sensor.linky_daily_10d_consumption.state) + float(states.sensor.linky_daily_11d_consumption.state) + float(states.sensor.linky_daily_12d_consumption.state) + float(states.sensor.linky_daily_13d_consumption.state) + float(states.sensor.linky_daily_14d_consumption.state) + float(states.sensor.linky_daily_15d_consumption.state) + float(states.sensor.linky_daily_16d_consumption.state) + float(states.sensor.linky_daily_17d_consumption.state) + float(states.sensor.linky_daily_18d_consumption.state) + float(states.sensor.linky_daily_19d_consumption.state) + float(states.sensor.linky_daily_20d_consumption.state) + float(states.sensor.linky_daily_21d_consumption.state) + float(states.sensor.linky_daily_22d_consumption.state) + float(states.sensor.linky_daily_23d_consumption.state) + float(states.sensor.linky_daily_24d_consumption.state) + float(states.sensor.linky_daily_25d_consumption.state) + float(states.sensor.linky_daily_26d_consumption.state) + float(states.sensor.linky_daily_27d_consumption.state) + float(states.sensor.linky_daily_28d_consumption.state) + float(states.sensor.linky_daily_29d_consumption.state))}}”
    cout:
    friendly_name: “Coût de la veille”
    unit_of_measurement: ‘€’
    value_template: “{{((float(states.sensor.conso_hc.state) * float(0.1244)) + (float(states.sensor.conso_hp.state) * float(0.1593)))}}”
    rapport_hc_hp:
    friendly_name: “Taux de consommation en heures creuses”
    unit_of_measurement: ‘%’
    value_template: “{%- set conso_totale = float(states.sensor.conso_hc.state) + float(states.sensor.conso_hp.state) -%}{% if conso_totale > 0 %}{{(float(states.sensor.conso_hc.state) / conso_totale * 100)}}{% else %}N/A{% endif %}”
    evolution_conso_mensuelle:
    friendly_name: “Évolution de la consommation mensuelle”
    unit_of_measurement: ‘%’
    value_template: “{{((float(states.sensor.conso_mensuelle_glissante.state) - float(states.sensor.linky_monthly_1m_consumption.state)) / float(states.sensor.linky_monthly_1m_consumption.state) * 100)}}”

did you use a template to have more information about linky ?

Best.

Hi,

I would like to add this custom Linky Card, but I have the same problem as above, [monitored_variables] is an invalid option for [linky].

Is it still working for you ? Do you have an idea why I have this error ?

Thanks

Hi,

I am trying to use the custom linky sensor by @prionfr, but it is not working. On the Chrome debug tool I can see that “TypeError: Cannot read property ‘attributes’ of undefined”. It seems that hass.states[entityId] return null. I have started using home assistant yesterday so i it possible that i am missing something. In my case i have don’t have HC/HP enedis, I use a standard electricity subscription.

ps: I have tried the OncleBen version (prionfr version seems to no be updated for recent version of HA) biut still not working i have site enedis not available, it seems to be the hass.state which are not defined.

Thanks

Hello,
I’m sorry, but I’m afraid that the title of this feature request is a little bit confusing. In fact you don’t retrieve the data from the Linky, but from Enedis which collect the data every half-hour. The request title should be ‘Add a module to retrieve electricity use from Enedis’

I don’t want to create a polemic, but I really want to retrieve the data from the Linky device itself, with the TIC (TéléInformation Client) interface. I made my own TIC to serial over USB converter… which is able to retrieve all data every second. My Linky is a tri-phased model and its TIC interface is set to ‘Standard’ which is the new protocol/speed instead of ‘Historique’ which is compatible with the old energy-meter from Enedis/EDF.

Anyone knows a such existing integration module?
Thank you

1 Like

@olivierov could you give more detail on “TIC to serial over USB converter”
And I agree with your remark about the title

1 Like

Hello,
Any one is working on gazpar integration ?
thnaks.

you can retrieve your value with the python script available here.


Now we need someone to convert this to hass.
1 Like

HI Oliverov

I think with this link you can find what you search
https://www.framboisier.com/blog/2019/08/24/relever-sa-consommation-delectricite-sur-home-assistant/

have a nice day

1 Like

Thank you @Galen,

I think with this link you can find what you search
Mieux que Linky avec Home Assistant – 2023 – Mon Jardin

I’ve seen this article when I posted my first comment. It is a simple and intelligent way to retrieve the measurements in real time from the Linky. But it is by using ricochets and therefore it is not optimal:

  • Script
  • MQTT publish a message for each interesting value
  • MQTT broker
  • MQTT subscription for each interesting value
  • Home Automation

The main advantage is you can use any MQTT ready software to get data every second without developing any plugin.

Have a nice day

Hi @slaamp,

@olivierov could you give more detail on “TIC to serial over USB converter”

It’s a device which converts TIC modulated signal into either a TTL UART signal, either a standard RS-232 or a serial over USB device. The choice is exclusive and made by populating components or not.
You can take a look at my design at README.md · master · Olivier.OV / RS_TIC · GitLab
Hopefully, it exists other solutions like µtéléinfo.
Have a nice day.

1 Like

Thank you for the compliment. :grinning:
This choice do not seems optimal. But I have an other script that collect these data and store them in a database.
I am working on a same architecture for collecting a few temperatures (outside, inside, water in heating system).

Someone has tried with latest HAversion (0.105.5) ?
I deactivated official integration but i ve got error :

Platform error sensor.linky_custom - Integration linky_custom not found.

Something seems to be wrong in my config but :

  • linky_custom is in custom_component
  • config for plateform custom_linky is directly in my configuration.yaml

I created the skeleton. But need developers ! :slight_smile:

bonsoir Imbuzi,
peut tu m’aider a faire fonctionner Linky car impossible de le configurer.
peux tu me contacter par mail stp ?
[email protected]
je te remercie d’avance.
cordialement.

Does one of you successfully configured Linky just by adding the “linky:” tag on their configuration.yaml these days ?

In the integrations part, HA ask me to put my credentials, I inserted my enedis credentials but I get an error like "try again later, but not between 23h and 2h)

Someone could help me please ?

Enedis services/servers are very unstable so linky integration is often unreliable.
I don’t use it anymore because of that.

Do you have an alternative on your side ? Teleinfo maybe ?

No, i gave up for the moment. Teleinfo seems interesting but i would need to make it wireless for beeing able to use it.

For customers of Total Direct Energie (former Total Spring) there is another option to get your real time consumption into HA: You can order the Atome adapter free of cost from Total through their App. The adapter plugs into the Linky counter and transmits data through WiFi. You can then use the Atome integration for HA to get the data. Works quite reliably for me.

Hi @olijouve,

Maybe you can plug a raspberry pi zero w close to your electrical meter (serial USB) and send teleinfo data via mqtt (that’s what I do)
Then it’s piece of cake to read and process the data from home-assistant.

I already provide a Docker image to do that if you’re interested.