in ,

LoveLove

Integrate your electricity meter (teleinfo) in Home Assistant

faire remonter les infos électriques pas cher dans homeassistant

For my first post on the blog, I suggest you see together how to integrate the information from your electricity meter (teleinfo) into Home Assistant for around € 14. This tutorial is valid for old electronic meters as well as for new "Linky" communicating meters. To retrieve the information we will use a feature used by energy suppliers: Tele-information.

Prerequisites:

  • Home assistant installed with up-to-date ESPHome
  • An ESP8266 module of the Wemos D1 mini type and its power supply
  • A PitInfo module

ESPHome programming

An article is dedicated to the programming of an ESP8266 or 32.Do not hesitate to consult it by clicking on the link

As the electricity meter is generally remote from your home automation system, I advise you to program and flash your ESP8266 first.

Summary of integration steps with ESPhome:

  • To start, go to ESPHome you must create a new configuration by clicking on the green '+' button located at the bottom right of the screen.
  • Then fill in the various fields with the name of the device, the name of your wifi network (2.4 Ghz imperatively) as well as the associated password.
  • The platform is of course ESP8266, for a wemos d1 mini the board is d1_mini
  • Click on the 'Next' button and connect your Wemos D1 mini by USB to your PC, then click on 'Connect' and choose the COM port corresponding to your Wemos.

The flash may last a few minutes, leave the page open while waiting for the operation to complete.

After this operation, your new configuration will appear on the ESPHome Dashboard. Click on 'EDIT', we will complete the configuration file with the elements necessary for reporting information from the meter.

Below 'logger' add the following lines:

Finally, below the 'captive_portal' line add the rest of the code:

  • For Peak Hours / Off-Hours subscriptions:

  • For subscriptions at the Basic rate:

 You can now upload the file by clicking on 'INSTALL'.

 So much for the programming part, now let's go to the connection of the assembly.

 Connection to the meter

logo risque électrique

You will have to work in the vicinity of a voltage of 220V which is dangerous if you come into contact with an electrical conductor. Be careful with your handling, if in doubt cut off the power supply.

 We will in this part see how to connect our assembly, here is the wiring diagram:

Schéma de branchement
  • Rx of Wemos on TXD of PiTInfo
  • G of Wemos onGND of PiTInfo
  • 3v3 of Wemos on VCC ofPiTInfo
  •  The two input terminals of the PiTInfo must be connected to I1 and I2 under the meter (These terminals are protected by a cover), there is no polarity on this side of the assembly

 Linky counter: For information to go back to Home Assistant. The counter must be in 'History' mode, you can check this information by pressing the '+' or '-' keys.

Lovelace

 Back in Home Assistant go to 'Integrations'. Normally your new Wemos should be recognized by HA and offered to you for configuration. If this is not the case, you will have to add it manually by clicking on 'Add integration' at the bottom right. Then look for ESPHome in the list and finally enter the IP address of the module.

Carte des entités du compteur électrique

 So you get this map which you can add directly to Lovelace or create a personalized map.

 Here it is now finished, you have all the information from your meter which arrives on your HA, you are now free to manage this data, create graphs, automations ...!

Report

Participant

Written by Math67

Years Of Membership

Comments

Leave a Reply

GIPHY App Key not set. Please check settings

12 Comments

  1. super boulot 😉
    je rencontre un soucis, le flas de weemos d1 mini se passe bien (avec la derniere version d’esphome et n’etant pas en ssl) je download le .bin pour ensuite l’uploader sur le weemos avec esphomeflasher : aucune erreur, le weemos remonte bien dans mes integrations et dans esphome.

    Quand je rajoute la partie après ‘logger’ le ‘validate’ est OK et la compilation aussi.

    En revanche lorsque je rajoute la partie pour l’abonnement tarif de base, le ‘Validate’ est OK mais j’ai des erreurs à gogo lors de la compilation :
    Compiling /data/linky/.pioenvs/linky/src/main.cpp.o
    src/main.cpp:30:27: error: ‘esphome::teleinfo::TeleInfoSensor* index’ redeclared as different kind of symbol
    teleinfo::TeleInfoSensor *index;
    ^
    In file included from /data/cache/platformio/packages/framework-arduinoespressif8266/tools/sdk/libc/xtensa-lx106-elf/include/wchar.h:4:0,
    from /data/cache/platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/4.8.2/cwchar:44,
    from /data/cache/platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/4.8.2/bits/postypes.h:40,
    from /data/cache/platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/4.8.2/bits/char_traits.h:40,
    from /data/cache/platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/4.8.2/string:40,
    from src/esphome/core/component.h:3,
    from src/esphome/components/api/api_connection.h:3,
    from src/esphome.h:2,
    from src/main.cpp:3:
    /data/cache/platformio/packages/framework-arduinoespressif8266/tools/sdk/libc/xtensa-lx106-elf/include/string.h:54:8: error: previous declaration of ‘char* index(const char*, int)’
    char *_EXFUN(index,(const char *, int));
    ^
    src/main.cpp: In function ‘void setup()’:
    src/main.cpp:364:9: error: assignment of function ‘char* index(const char*, int)’
    index = new teleinfo::TeleInfoSensor(“BASE”);
    ^
    src/main.cpp:364:9: error: cannot convert ‘esphome::teleinfo::TeleInfoSensor*’ to ‘char*(const char*, int)’ in assignment
    src/main.cpp:365:10: error: request for member ‘set_component_source’ in ‘index’, which is of non-class type ‘char*(const char*, int)’
    index->set_component_source(“teleinfo.sensor”);
    ^
    src/main.cpp:367:28: error: no matching function for call to ‘esphome::Application::register_sensor(char* (&)(const char*, int))’
    App.register_sensor(index);
    ^
    src/main.cpp:367:28: note: candidate is:
    In file included from src/esphome/components/api/api_connection.h:4:0,
    from src/esphome.h:2,
    from src/main.cpp:3:
    src/esphome/core/application.h:68:8: note: void esphome::Application::register_sensor(esphome::sensor::Sensor*)
    void register_sensor(sensor::Sensor *sensor) { this->sensors_.push_back(sensor); }
    ^
    src/esphome/core/application.h:68:8: note: no known conversion for argument 1 from ‘char*(const char*, int)’ to ‘esphome::sensor::Sensor*’
    src/main.cpp:368:10: error: request for member ‘set_name’ in ‘index’, which is of non-class type ‘char*(const char*, int)’
    index->set_name(“Index”);
    ^
    src/main.cpp:369:10: error: request for member ‘set_disabled_by_default’ in ‘index’, which is of non-class type ‘char*(const char*, int)’
    index->set_disabled_by_default(false);
    ^
    src/main.cpp:370:10: error: request for member ‘set_icon’ in ‘index’, which is of non-class type ‘char*(const char*, int)’
    index->set_icon(“mdi:gauge”);
    ^
    src/main.cpp:371:10: error: request for member ‘set_unit_of_measurement’ in ‘index’, which is of non-class type ‘char*(const char*, int)’
    index->set_unit_of_measurement(“Wh”);
    ^
    src/main.cpp:372:10: error: request for member ‘set_accuracy_decimals’ in ‘index’, which is of non-class type ‘char*(const char*, int)’
    index->set_accuracy_decimals(0);
    ^
    src/main.cpp:373:10: error: request for member ‘set_force_update’ in ‘index’, which is of non-class type ‘char*(const char*, int)’
    index->set_force_update(false);
    ^
    src/main.cpp:374:54: error: no matching function for call to ‘esphome::teleinfo::TeleInfo::register_teleinfo_listener(char* (&)(const char*, int))’
    teleinfo_teleinfo->register_teleinfo_listener(index);
    ^
    src/main.cpp:374:54: note: candidate is:
    In file included from src/esphome/components/teleinfo/sensor/teleinfo_sensor.h:2:0,
    from src/esphome.h:39,
    from src/main.cpp:3:
    src/esphome/components/teleinfo/teleinfo.h:25:8: note: void esphome::teleinfo::TeleInfo::register_teleinfo_listener(esphome::teleinfo::TeleInfoListener*)
    void register_teleinfo_listener(TeleInfoListener *listener);
    ^
    src/esphome/components/teleinfo/teleinfo.h:25:8: note: no known conversion for argument 1 from ‘char*(const char*, int)’ to ‘esphome::teleinfo::TeleInfoListener*’
    In file included from src/esphome/components/api/api_connection.h:4:0,
    from src/esphome.h:2,
    from src/main.cpp:3:
    src/esphome/core/application.h: In instantiation of ‘C* esphome::Application::register_component(C*) [with C = char*(const char*, int)]’:
    src/main.cpp:366:31: required from here
    src/esphome/core/application.h:109:5: error: static assertion failed: Only Component subclasses can be registered
    static_assert(std::is_base_of::value, “Only Component subclasses can be registered”);
    ^
    *** [/data/linky/.pioenvs/linky/src/main.cpp.o] Error 1
    ========================= [FAILED] Took 49.82 seconds =========================

    si vous avez une idee, un coup de main, une solution, je suis preneur 🙂

    • Salut, j’ai fait le test chez moi, effectivement ca pose problème. La solution est de remplacer id: index par id: “index_base” et ca fonctionne, du moins plus d’erreurs au moment de compiler le firmware. je vais modifier l’article en ce sens.
      Merci pour la remontée, ayant un abonnement au tarif HC/HP je n’ai pu tester cette configuration au moment d’écrire l’article 😉

      • oui effectivement j’avais mis en remarque # la ligne id. et c’est passé, j’ai renommé l’id comme tu le conseils et ca passe 🙂
        mon montage est prêt !
        je te tiens au courant.
        je vais pouvoir explorer votre blog un peu plus en profondeur, je fais partie de l’équipe du forum HACF, j’aimerai bien parler de votre travail, si vous êtes inscrit sur le forum, je pourrais vous @tagger 😉

  2. Retour plutot positif, j’ai la remonté des infos depuis 2 jours et cela me semble correct. 🙂
    Je vais essayer de stocker les elements en base de données (dans influxdb par exemple)
    En revanche j’ai les entités linky_intensite et linky_intensite_max qui reste en inconnu, du coup je ne sais pas si cela vient du code ou du compteur??? si tu as une idée je suis preneur 😉
    et bonne année !

    • Salut et bonne année !
      A partir du moment ou ton fichier ESPHome est bien renseigné, Il est possible que le mode du compteur y soit pour quelque chose(historique / Standard). Dans la doc officielle d’Enedis on peut lire “Certaines données du mode historique ne sont pas disponibles dans les compteurs Linky. C’est, entre autres, le cas de l’intensité souscrite, des intensités maximales ou de la zone de tarification (A, C, D, E, Y)”. Chez moi je n’ai pas de compteur Linky, il faudrait voir si d’autres personnes avec des Linky rencontrent ce souci.

  3. Bonjour,
    Merci pour cet article. J’ai réalisé le montage avec un SP32, et aucun problème en suivant tout le tutoriel.
    Hélas, au final, je n’ai pas de remontée d’informations en provenance de teleinfo.
    Je n’ai d’info que sur :
    – Teleinfo status – Connecté
    – Uptime sensor – xxxx s
    – Wifi Signal sensor – -42db
    – Uptime – xx mn
    Etat indisponible pour tous les autres paramètres.
    Mon compteur est un Linky. Su mon compte Enedis, tout les historiques sont bien activés et j’ai des données sur de nombreux mois.

    Est il possible de tracer ce qui se passe dans le ESP32 ? En posant des log ?

    Cdl.

Loading…

0
grow capteur empreinte digitale plaque et protection

[TEST] et [INSTALL] Grow R503 Capteur d’empreintes digital avec esphome et homeassistant

Moes Bht 002 modèle électrique

[TEST] and [INSTALL] Zigbee Thermostat Moes BHT-002