{"id":20697,"date":"2024-04-25T11:53:30","date_gmt":"2024-04-25T09:53:30","guid":{"rendered":"https:\/\/chochol.io\/smart-home\/home-assistant-installation-and-integration-of-the-eastron-sdm120m-meter\/"},"modified":"2025-08-23T19:56:17","modified_gmt":"2025-08-23T17:56:17","slug":"home-assistant-installation-and-integration-of-the-eastron-sdm120m-meter","status":"publish","type":"post","link":"https:\/\/chochol.io\/en\/smart-home\/home-assistant-installation-and-integration-of-the-eastron-sdm120m-meter\/","title":{"rendered":"Home Assistant: Installation and integration of the Eastron SDM120M meter"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"20697\" class=\"elementor elementor-20697 elementor-1191\" data-elementor-post-type=\"post\">\n\t\t\t\t<div class=\"elementor-element elementor-element-7247ce6 e-flex e-con-boxed e-con e-parent\" data-id=\"7247ce6\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-2fd3df5 elementor-toc--minimized-on-tablet elementor-widget elementor-widget-table-of-contents\" data-id=\"2fd3df5\" data-element_type=\"widget\" data-e-type=\"widget\" data-settings=\"{&quot;exclude_headings_by_selector&quot;:[],&quot;no_headings_message&quot;:&quot;No headings were found on this page.&quot;,&quot;headings_by_tags&quot;:[&quot;h2&quot;,&quot;h3&quot;,&quot;h4&quot;,&quot;h5&quot;,&quot;h6&quot;],&quot;marker_view&quot;:&quot;numbers&quot;,&quot;minimize_box&quot;:&quot;yes&quot;,&quot;minimized_on&quot;:&quot;tablet&quot;,&quot;hierarchical_view&quot;:&quot;yes&quot;,&quot;min_height&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]},&quot;min_height_tablet&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]},&quot;min_height_mobile&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:&quot;&quot;,&quot;sizes&quot;:[]}}\" data-widget_type=\"table-of-contents.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<div class=\"elementor-toc__header\">\r\n\t\t\t\t\t\t<div class=\"elementor-toc__header-title\">\r\n\t\t\t\tTable of Contents\t\t\t<\/div>\r\n\t\t\t\t\t\t\t\t\t\t<div class=\"elementor-toc__toggle-button elementor-toc__toggle-button--expand\" role=\"button\" tabindex=\"0\" aria-controls=\"elementor-toc__2fd3df5\" aria-expanded=\"true\" aria-label=\"Open table of contents\"><svg aria-hidden=\"true\" class=\"e-font-icon-svg e-fas-chevron-down\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z\"><\/path><\/svg><\/div>\r\n\t\t\t\t<div class=\"elementor-toc__toggle-button elementor-toc__toggle-button--collapse\" role=\"button\" tabindex=\"0\" aria-controls=\"elementor-toc__2fd3df5\" aria-expanded=\"true\" aria-label=\"Close table of contents\"><svg aria-hidden=\"true\" class=\"e-font-icon-svg e-fas-chevron-up\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M240.971 130.524l194.343 194.343c9.373 9.373 9.373 24.569 0 33.941l-22.667 22.667c-9.357 9.357-24.522 9.375-33.901.04L224 227.495 69.255 381.516c-9.379 9.335-24.544 9.317-33.901-.04l-22.667-22.667c-9.373-9.373-9.373-24.569 0-33.941L207.03 130.525c9.372-9.373 24.568-9.373 33.941-.001z\"><\/path><\/svg><\/div>\r\n\t\t\t\t\t<\/div>\r\n\t\t\t\t<div id=\"elementor-toc__2fd3df5\" class=\"elementor-toc__body\">\r\n\t\t\t<div class=\"elementor-toc__spinner-container\">\r\n\t\t\t\t<svg class=\"elementor-toc__spinner eicon-animation-spin e-font-icon-svg e-eicon-loading\" aria-hidden=\"true\" viewBox=\"0 0 1000 1000\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M500 975V858C696 858 858 696 858 500S696 142 500 142 142 304 142 500H25C25 237 238 25 500 25S975 237 975 500 763 975 500 975Z\"><\/path><\/svg>\t\t\t<\/div>\r\n\t\t<\/div>\r\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-233be93 elementor-widget elementor-widget-text-editor\" data-id=\"233be93\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h2>Hello!<\/h2><p class=\"whitespace-pre-wrap break-words\">Monitoring electricity consumption in the home is pivotal for controlling costs and optimizing consumption. Transitioning from this understanding to practical implementation, one widely recognized solution for measuring energy usage is the Eastron SDM120M single-phase meter. In the following discourse, I will elucidate the seamless integration of this meter into a Home Assistant home automation system, leveraging an affordable ESP board and the open-source ESPHome software.<\/p><p class=\"whitespace-pre-wrap break-words\">By integrating this meter, you\u2019ll gain real-time energy consumption monitoring, access detailed metering data, and create custom automations based on meter readings. This integration offers an easy and affordable method to manage your energy usage effectively and reduce your bills.<\/p><p class=\"whitespace-pre-wrap break-words\">This comprehensive guide will take you through the entire process, from preparing the hardware to configuring the software and integrating the meter with Home Assistant. It empowers you with complete control over your home\u2019s electricity consumption.<\/p><p><strong>Let\u2019s get started! <\/strong> \ud83d\ude80<\/p><h3>What is ESP32?<\/h3><p><img fetchpriority=\"high\" decoding=\"async\" class=\"alignleft\" src=\"https:\/\/joy-it.net\/files\/files\/Produkte\/SBC-NodeMCU-ESP32\/SBC-NodeMCU-ESP32-01.png\" alt=\"NodeMCU ESP32 | Joy-IT\" width=\"275\" height=\"275\" aria-hidden=\"false\" \/><\/p><p><strong>ESP32 is a very popular microcontroller developed by Espressif Systems.<\/strong> It is the successor to the ESP8266 and offers a number of improvements and additional features. The ESP32 is equipped with a dual-core Xtensa LX6 processor that runs at up to 240 MHz, providing enough processing power to handle a variety of tasks.<\/p><p>One of the main advantages of the ESP32 is its versatility and support for various communication interfaces. For instance, it supports WiFi, Bluetooth Classic, and Bluetooth Low Energy (BLE). Consequently, it becomes ideal for IoT (Internet of Things) applications, wireless projects, and other applications requiring wireless communication. Additionally, the ESP32 has built-in peripherals to support interfaces such as SPI, I2C, and UART. Consequently, it\u2019s easy to integrate with various sensors and devices.<\/p><p>Moreover, the microcontroller is popular due to its low price, availability in the market, and extensive development environment. This includes the ESP-IDF platform and support for the Arduino IDE. As a result, it becomes an excellent choice for both beginners and experienced developers looking to create embedded applications and IoT projects.<\/p><h3>What is ESPHome?<\/h3><p><img decoding=\"async\" class=\"wp-image-1243 alignleft\" src=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/01\/esphome-icon-2048x1579-htac8rfa-300x231.png\" sizes=\"(max-width: 350px) 100vw, 350px\" srcset=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/01\/esphome-icon-2048x1579-htac8rfa-300x231.png 300w, https:\/\/chochol.io\/wp-content\/uploads\/2024\/01\/esphome-icon-2048x1579-htac8rfa-1024x790.png 1024w, https:\/\/chochol.io\/wp-content\/uploads\/2024\/01\/esphome-icon-2048x1579-htac8rfa-768x592.png 768w, https:\/\/chochol.io\/wp-content\/uploads\/2024\/01\/esphome-icon-2048x1579-htac8rfa-1536x1184.png 1536w, https:\/\/chochol.io\/wp-content\/uploads\/2024\/01\/esphome-icon-2048x1579-htac8rfa.png 2048w\" alt=\"ESPHome, icon\" width=\"275\" height=\"212\" \/><\/p><p><strong>ESPHome<\/strong> is a powerful, open source development environment designed specifically for devices based on the popular ESP8266 and ESP32 microcontrollers. Its main goal is to facilitate the creation of smart Internet of Things (IoT) devices, which can then be fully integrated and controlled through the Home Assistant platform.<\/p><p class=\"whitespace-pre-wrap\">Configuration of devices in ESPHome is done through friendly files in YAML format, which allow defining the operation of various components, sensors, displays or actuators. This makes programming intuitive and accessible even to those without in-depth coding knowledge.<\/p><p class=\"whitespace-pre-wrap\">In addition to native integration with Home Assistant, ESPHome also supports a wide range of off-the-shelf modules and libraries, allowing it to support many popular other components.<\/p><h2>Preparation<\/h2><p>Before we dive into adapting system using the ESP32\/ESP8266 and ESPHome, it\u2019s a good idea to prepare properly. Below you will find the key steps to get your project started.<\/p><p>Make sure you have all the necessary materials:<\/p><ul><li><a href=\"https:\/\/amzn.to\/4d6bbkF\" target=\"_blank\" rel=\"noopener\">ESP8266<\/a> NodeMCU board (or <a href=\"https:\/\/amzn.to\/4dfeZQG\" target=\"_blank\" rel=\"noopener\">ESP32<\/a>, if you opt for a newer model),<ul><li>It is worth verifying before purchasing an ESP board that Wi-Fi coverage reaches our installation site. We may need to purchase a board with the ability to connect an external antenna.<\/li><\/ul><\/li><li>Eastron SDM120M \u2013 Modbus RS485 single-phase electricity meter (<a href=\"https:\/\/amzn.to\/44h0yak\" target=\"_blank\" rel=\"noopener\">Shop link<\/a>),<\/li><li>TTL to RS485 Adapter \u2013 Converter Module (<a href=\"https:\/\/amzn.to\/49ZUnck\" target=\"_blank\" rel=\"noopener\">Shop Link<\/a>),<\/li><li>Power source for the ESP8266 board (5V DC),<\/li><li><a href=\"https:\/\/botland.com.pl\/920-kostki-elektryczne\" target=\"_blank\" rel=\"noopener\">Wire connectors<\/a>,<\/li><li>(Optional) DIN box in which to hide the ESP board with the converter module,<\/li><li>Connection wires for all components.<\/li><\/ul><h3>Installing ESPHome in Home Assistant<\/h3><p><strong>Install ESPHome<\/strong> in your Home Assistant environment to easily configure and manage the ESP8266. Use the <a href=\"https:\/\/esphome.io\/guides\/getting_started_hassio#installing-esphome-dashboard\" target=\"_blank\" rel=\"noopener\">ESPHome documentation<\/a> and follow the instructions.<\/p><h3>Preparation of workspace<\/h3><p>Organize a workspace where you will assemble the system. Make sure you have access to tools and are comfortable working on the project.<\/p><h3>Health and safety of working with electric voltage<\/h3><p><strong><img decoding=\"async\" class=\"size-full wp-image-20689 alignright\" src=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/Projekt-bez-nazwy-2.png\" alt=\"Warning pictogram\" width=\"250\" height=\"250\" srcset=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/Projekt-bez-nazwy-2.png 250w, https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/Projekt-bez-nazwy-2-150x150.png 150w, https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/Projekt-bez-nazwy-2-60x60.png 60w\" sizes=\"(max-width: 250px) 100vw, 250px\" \/><\/strong>Electrical safety is key when working with electricity. Here are some important recommendations:<\/p><ul><li><strong>Power Off:<\/strong> Before any work on the circuit, turn off the power supply to avoid electric shock.<\/li><li><strong>Appropriate Tools: <\/strong> Use tools that are insulated and designed for electrical work \u2013 they should meet appropriate safety standards.<\/li><li><strong>Experience:<\/strong> Electrical installation work requires experience. If you are unsure of your skills, it is advisable to enlist the help of an experienced person.<\/li><li><strong>Eye and Hand Protection:<\/strong> Wearing eye and hand protection is recommended, especially when soldering and handling connections.<\/li><li><strong>Check the Power Supply:<\/strong> Make sure you know where the main power supply is and that it is off before taking any action.<\/li><li><strong>Knowledge of the Electrical System:<\/strong> Always verify that you know how an electrical system works. <strong>Do not take action blindly.<\/strong><\/li><\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-6733d74 elementor-alert-danger elementor-widget elementor-widget-alert\" data-id=\"6733d74\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"alert.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-alert\" role=\"alert\">\n\n\t\t\t\t\t\t<span class=\"elementor-alert-title\">Warning<\/span>\n\t\t\t\n\t\t\t\t\t\t<span class=\"elementor-alert-description\">Remember that tampering with electrical installations can be dangerous, and if you are unsure of your skills, it is always a good idea to consult an electrician or an electrical specialist. electrical installations.<\/span>\n\t\t\t\n\t\t\t\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d8733f5 elementor-widget elementor-widget-text-editor\" data-id=\"d8733f5\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h2>Step 1 \u2013 VLAN IoT<\/h2><p>As a security practice, I recommend setting up a separate network for IoT devices, separate from the main home network. For this purpose, it is worth using the <strong>VLAN<\/strong> (<a href=\"https:\/\/pl.wikipedia.org\/wiki\/Wirtualna_sie%C4%87_lokalna\" target=\"_blank\" rel=\"noopener\">Virtual Local Area Network<\/a>) function, which allows physical separation of devices, such as those based on ESPHome, from other devices in the home infrastructure.<\/p><h3>Benefits<\/h3><p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-20687 alignright\" src=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/Projekt-bez-nazwy-1.png\" alt=\"Cloud icon as VLAN\" width=\"250\" height=\"250\" srcset=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/Projekt-bez-nazwy-1.png 250w, https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/Projekt-bez-nazwy-1-150x150.png 150w, https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/Projekt-bez-nazwy-1-60x60.png 60w\" sizes=\"(max-width: 250px) 100vw, 250px\" \/><\/p><p>Creating a dedicated network for IoT devices offers several advantages:<\/p><ul><li><strong>Security:<\/strong> Separating IoT devices from the main network haelps minimize the potential risk of attacks. If an IoT device is possibly compromised, access to the main home network is difficult.<\/li><li><strong>Controlling Communications:<\/strong> Creating a separate network allows for more precise control over who communicates with IoT devices and how. You can define communication rules that only allow specific devices (for example, a server or virtual machine from Home Assistant) to interact with IoT devices.<\/li><li><strong>Network Traffic Optimization:<\/strong> Separating IoT device traffic from main network traffic can help optimize network performance.<\/li><\/ul><h3>Implementation<\/h3><p>To implement such separation, it is worth consulting the documentation and settings of the router. In the case of Home Assistant, using the appropriate firewall rules on the router, you can customize access to IoT devices. This approach introduces a layer of additional security to our smart home infrastructure.<\/p><h2>Step 2 \u2013 Install and configure firmware to work with Home Assistant<\/h2><p>Once the ESPHome add-on is running on the Home Assistant server, it\u2019s time to move on to adding the first ESPHome-based device.<\/p><h3>Connecting to a computer<\/h3><ul><li><strong>Connect the board using a USB cable to your computer.<\/strong> It is important to use a USB cable with data transmission, as many cheap cables only provide power.<ul><li>To be sure of correct operation, I recommend using <strong>Chrome<\/strong> or <strong>Edge<\/strong> browser (there is a transfer of data transmission through the COM port to the browser using WebSerial).<\/li><\/ul><\/li><\/ul><h3>Home Assistant<\/h3><ul><li>After completing these steps, log in to <strong>Home Assistant<\/strong>,<\/li><\/ul><p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1258\" src=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/01\/Screenshot-2024-01-11-at-12.19.37.png\" sizes=\"(max-width: 565px) 100vw, 565px\" srcset=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/01\/Screenshot-2024-01-11-at-12.19.37.png 565w, https:\/\/chochol.io\/wp-content\/uploads\/2024\/01\/Screenshot-2024-01-11-at-12.19.37-273x300.png 273w\" alt=\"Home Assistant, login screen\" width=\"565\" height=\"622\" \/><\/p><ul><li>From the side panel, go to the <strong>ESPHome<\/strong> tab,<\/li><li>Then click <strong>New Device<\/strong>,<\/li><\/ul><p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1262\" src=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/01\/Screenshot-2024-01-11-at-12.30.16.png\" alt=\"ESPHome, Button New device\" width=\"180\" height=\"67\" \/><\/p><ul><li><p>After selecting the option to add a new device, we may encounter a browser incompatibility message, especially for browsers that do not support WebSerial. Alternatively, we may also encounter a message indicating that there is no secure connection (HTTPS) to the dashboard. In this situation, we can click <strong>Continue<\/strong> to continue the process of adding the device.<\/p><\/li><\/ul><p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1260\" src=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/01\/Screenshot-2024-01-11-at-12.28.56.png\" sizes=\"(max-width: 399px) 100vw, 399px\" srcset=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/01\/Screenshot-2024-01-11-at-12.28.56.png 399w, https:\/\/chochol.io\/wp-content\/uploads\/2024\/01\/Screenshot-2024-01-11-at-12.28.56-251x300.png 251w\" alt=\"ESPHome, New device\" width=\"399\" height=\"477\" \/><\/p><ul><li>In the next window, we enter a <strong>name for our device<\/strong> (it can be a name or alias we created) and <strong>the details of our Wi-Fi network<\/strong>.<ul><li>Wi-Fi network entry is only necessary when adding a device for the first time. Subsequent ESPHome-based additions will not require this step.<\/li><\/ul><\/li><li>Then, for ESPHome to install the firmware on the ESP8266 board, click Connect.<\/li><\/ul><p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1264\" src=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/01\/Screenshot-2024-01-11-at-12.35.53.png\" sizes=\"(max-width: 381px) 100vw, 381px\" srcset=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/01\/Screenshot-2024-01-11-at-12.35.53.png 381w, https:\/\/chochol.io\/wp-content\/uploads\/2024\/01\/Screenshot-2024-01-11-at-12.35.53-300x264.png 300w\" alt=\"ESPHome, Installation\" width=\"381\" height=\"335\" \/><\/p><ul><li>After a while, the browser will display a window for selecting a device for serial port communication. Find your device, whose name should include <strong>CP210x UART<\/strong>, and click <strong>Connect<\/strong>.<\/li><li>Then wait until the firmware is installed on the board.<\/li><\/ul><h3>Completion of the process<\/h3><p>After a successful installation, you should receive a message confirming the completion of the process. Your device will also appear on the dashboard with the description <strong>ONLINE<\/strong>. This means that the board has been correctly configured and is ready to proceed.<\/p><h2>Step 3 \u2013 Upload the code in ESPHome<\/h2><div>In this section, we will now upload the relevant entries for configuring the connection to the electricity meter. Copy the necessary code elements into your installation.<\/div>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a9e5d8d elementor-widget elementor-widget-mdp-coder-elementor\" data-id=\"a9e5d8d\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"mdp-coder-elementor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t        <!-- Start Coder for Elementor WordPress Plugin -->\n        <div\n            id=\"mdp-coder-a9e5d8d\"\n            class=\"mdp-coder-elementor-box\"\n            data-theme=\"mdp-theme-material-dark\"\n            data-dark-theme=\"mdp-theme-material-dark\"\n        >\n            \n                <pre class=\"language-php line-numbers copy-to-clipboard\"data-previewers=\"\"><code>esphome:\n  name: esp03-meter\n\nesp32:\n  board: nodemcu-32s\n  framework:\n    type: arduino\n    version: 2.0.6\n\n# Enable logging\nlogger:\n\nweb_server:\n  port: 80\n  local: true\n\n# Enable Home Assistant API\napi:\n  encryption:\n    key: &quot;HERE WILL BE THE CODE GENERATED BY ESPHOME&quot;\n\nota:\n  password: &quot;HERE WILL APPEAR THE PASSWORD GENERATED BY ESPHOME&quot;\n\nwifi:\n  ssid: !secret wifi_ssid\n  password: !secret wifi_password\n\n  # Enable fallback hotspot (captive portal) in case wifi connection fails\n  ap:\n    ssid: &quot;Esp03-Kl043-Meter&quot;\n    password: &quot;1234567890&quot;\n\ncaptive_portal:\n    \nuart:\n  rx_pin: 16\n  tx_pin: 17\n  baud_rate: 9600\n  stop_bits: 1\n\nsensor:\n  - platform: sdm_meter\n    phase_a:\n      current:\n        name: &quot;Current&quot;\n      voltage:\n        name: &quot;Voltage&quot;\n      active_power:\n        name: &quot;Active power&quot;\n      power_factor:\n        name: &quot;Power factor&quot;\n        unit_of_measurement: &quot;%&quot;\n      apparent_power:\n        name: &quot;Apparent power&quot;\n      reactive_power:\n        name: &quot;Reactive power&quot;\n      phase_angle:\n        name: &quot;Phase angle&quot;\n    frequency:\n      name: &quot;Frequency&quot;\n    total_power:\n      name: &quot;Total power&quot;\n    import_active_energy:\n      name: &quot;Import Active Energy&quot;\n    export_active_energy:\n      name: &quot;Export Active Energy&quot;\n    import_reactive_energy:\n      name: &quot;Import Reactive Energy&quot;\n    export_reactive_energy:\n      name: &quot;Export Reactive Energy&quot;\n    update_interval: 5s<\/code><\/pre>\n                    <\/div>\n                <script>\n            \"use strict\";\n\n            \/** Handler when the DOM is fully loaded. *\/\n            let callback_a9e5d8d = function() {\n\n                \/** Set theme for coder widget. *\/\n                function setTheme() {\n\n                    \/** Foreach Code Widget. *\/\n                    let coderBoxes = document.querySelectorAll( '.mdp-coder-elementor-box' );\n\n                    for ( let coderBox of coderBoxes ) {\n\n                        let lightTheme = coderBox.dataset.theme;\n                        let darkTheme = coderBox.dataset.darkTheme;\n\n                        coderBox.className = '';\n                        if ( window.matchMedia && window.matchMedia( '(prefers-color-scheme: dark)' ).matches ) {\n\n                            coderBox.className = 'mdp-coder-elementor-box ' + darkTheme;\n\n                        } else {\n\n                            coderBox.className = 'mdp-coder-elementor-box ' + lightTheme;\n\n                        }\n\n                    }\n\n                }\n                setTheme();\n\n\n                \/** Watch for changes color-scheme. *\/\n                window.matchMedia(\"(prefers-color-scheme: dark)\").addListener( function() {\n                    setTheme();\n                } );\n\n                \n                if ( typeof Prism !== 'undefined' ) {\n\n                    Prism.plugins.autoloader.languages_path = 'https:\/\/chochol.io\/wp-content\/plugins\/coder-elementor\/js\/prism\/components\/';\n                    Prism.highlightAll();\n                    Prism.fileHighlight();\n\n                }\n\n                \n            };\n\n            if (\n                document.readyState === \"complete\" ||\n                ( document.readyState !== \"loading\" && !document.documentElement.doScroll )\n            ) {\n                callback_a9e5d8d();\n            } else {\n                document.addEventListener( \"DOMContentLoaded\", callback_a9e5d8d );\n            }\n\n        <\/script>\n                <!-- End Coder for Elementor WordPress Plugin -->\n\n        \t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-43353c6 elementor-widget elementor-widget-text-editor\" data-id=\"43353c6\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<ul><li>We are waiting for the software to be compiled and uploaded to the board. If the installation process is successful, the log preview will show you a summary of your board\u2019s configuration.<\/li><\/ul><h2>Step 4 \u2013 Connect the energy meter to the electrical system<\/h2><p>Connecting the Eastron SDM120M energy meter to the electrical system requires accuracy and following proper safety procedures. Here is a detailed description of the process<\/p><h3>Wiring diagram from the manufacturer\u2019s instructions<\/h3>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-520cf07 elementor-widget elementor-widget-image\" data-id=\"520cf07\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/Screenshot-2024-04-24-at-20.44.11.png\" data-elementor-open-lightbox=\"yes\" data-elementor-lightbox-title=\"Eastron SDM120M electricity meter, Wiring diagram\" data-e-action-hash=\"#elementor-action%3Aaction%3Dlightbox%26settings%3DeyJpZCI6MjA2NjAsInVybCI6Imh0dHBzOlwvXC9jaG9jaG9sLmlvXC93cC1jb250ZW50XC91cGxvYWRzXC8yMDI0XC8wNFwvU2NyZWVuc2hvdC0yMDI0LTA0LTI0LWF0LTIwLjQ0LjExLnBuZyJ9\">\n\t\t\t\t\t\t\t<img decoding=\"async\" src=\"https:\/\/chochol.io\/wp-content\/uploads\/elementor\/thumbs\/Screenshot-2024-04-24-at-20.44.11-qn70f5b1jc0j9iotce6majk1hfsx7sy146sy42ic5c.png\" title=\"Eastron SDM120M electricity meter, Wiring diagram\" alt=\"Wiring diagram pokazuj\u0105cy schemat po\u0142\u0105cze\u0144 przewod\u00f3w dla urz\u0105dze\u0144 SDM120M\/SDM120MB\/SDM120P z zaciskami N i L\" loading=\"lazy\" \/>\t\t\t\t\t\t\t\t<\/a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-6c4d08e elementor-widget elementor-widget-text-editor\" data-id=\"6c4d08e\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h3>Actions<\/h3><ul><li><strong>Location selection: <\/strong> Choose a suitable location for mounting the energy meter, usually near the main distribution panel or at a convenient height for easy reading. Make sure that the chosen location allows easy access to the meter and complies with local regulations for electrical installations.<\/li><li><strong>Installation preparation: <\/strong> Turn off the main power supply in the electrical system to avoid the risk of electric shock during meter installation. Make sure the installation is dry and free of moisture.<\/li><li><strong>Mounting the meter: <\/strong> Mount the Eastron SDM120M energy meter on a DIN rail using the integrated bracket. Make sure the meter is securely mounted on the DIN rail and has no slack. Make sure the DIN rail is properly fastened and meets the load capacity and insulation requirements.<\/li><li><strong>Wiring connection: <\/strong> Connect the electrical wires to the appropriate terminals on the meter according to the instruction manual.<ul><li>Connect <strong>the phase wire from the electrical system<\/strong> to the terminal <strong>marked with a downward arrow<\/strong>, corresponding to the outgoing phase.<\/li><li>Connect <strong>the phase wire going into our electrical system<\/strong> to the terminal <strong>marked with an upward arrow<\/strong>.<\/li><li>Connect <strong>the neutral wire<\/strong>, used to close the meter\u2019s power circuit, to <strong>the upper terminal<\/strong>. You can connect it separately, using the wire leading from the main fuse.<\/li><\/ul><\/li><\/ul><h3>Final steps on this part<\/h3><ul><li><strong>Checking connections: <\/strong> Connections should be thoroughly protected and insulated to prevent accidental short circuits or damage. Check each connection to make sure it is tight and has no slack.<\/li><li><strong>Power on: <\/strong> After you finish connecting the energy meter to the installation, turn on the main power supply and check that the meter starts up properly. Make sure the indicators on the meter show the correct data, such as voltage and current.<\/li><li><strong>Testing:<\/strong> Run tests on the operation of the energy meter to ensure that all functions are working properly. You can perform load tests to verify that the meter correctly records energy consumption under various conditions.<\/li><\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-6b5d984 elementor-widget elementor-widget-gallery\" data-id=\"6b5d984\" data-element_type=\"widget\" data-e-type=\"widget\" data-settings=\"{&quot;gallery_layout&quot;:&quot;justified&quot;,&quot;ideal_row_height&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:380,&quot;sizes&quot;:[]},&quot;lazyload&quot;:&quot;yes&quot;,&quot;ideal_row_height_tablet&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:150,&quot;sizes&quot;:[]},&quot;ideal_row_height_mobile&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:150,&quot;sizes&quot;:[]},&quot;gap&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:10,&quot;sizes&quot;:[]},&quot;gap_tablet&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:10,&quot;sizes&quot;:[]},&quot;gap_mobile&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:10,&quot;sizes&quot;:[]},&quot;link_to&quot;:&quot;file&quot;,&quot;overlay_background&quot;:&quot;yes&quot;,&quot;content_hover_animation&quot;:&quot;fade-in&quot;}\" data-widget_type=\"gallery.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-gallery__container\">\r\n\t\t\t\t\t\t\t<a class=\"e-gallery-item elementor-gallery-item elementor-animated-content\" href=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/D4F95F7C-0F3E-42DB-8281-B6F949028068_1_105_c.jpeg\" data-elementor-open-lightbox=\"yes\" data-elementor-lightbox-slideshow=\"6b5d984\" data-elementor-lightbox-title=\"Eastron SDM120M electricity meter, Switchgear\" data-e-action-hash=\"#elementor-action%3Aaction%3Dlightbox%26settings%3DeyJpZCI6MjA2NjUsInVybCI6Imh0dHBzOlwvXC9jaG9jaG9sLmlvXC93cC1jb250ZW50XC91cGxvYWRzXC8yMDI0XC8wNFwvRDRGOTVGN0MtMEYzRS00MkRCLTgyODEtQjZGOTQ5MDI4MDY4XzFfMTA1X2MuanBlZyIsInNsaWRlc2hvdyI6IjZiNWQ5ODQifQ%3D%3D\">\r\n\t\t\t\t\t<div class=\"e-gallery-image elementor-gallery-item__image\" data-thumbnail=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/D4F95F7C-0F3E-42DB-8281-B6F949028068_1_105_c-768x576.jpeg\" data-width=\"768\" data-height=\"576\" aria-label=\"Wall-mounted IP65 electrical control box with DIN-rail devices and cables inside, label visible\" role=\"img\" ><\/div>\r\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"elementor-gallery-item__overlay\"><\/div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t\t\t<a class=\"e-gallery-item elementor-gallery-item elementor-animated-content\" href=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/476118F2-B52B-4351-896E-80DF52B9D29F_1_105_c.jpeg\" data-elementor-open-lightbox=\"yes\" data-elementor-lightbox-slideshow=\"6b5d984\" data-elementor-lightbox-title=\"Eastron SDM120M electricity meter, Switchgear\" data-e-action-hash=\"#elementor-action%3Aaction%3Dlightbox%26settings%3DeyJpZCI6MjA2NjcsInVybCI6Imh0dHBzOlwvXC9jaG9jaG9sLmlvXC93cC1jb250ZW50XC91cGxvYWRzXC8yMDI0XC8wNFwvNDc2MTE4RjItQjUyQi00MzUxLTg5NkUtODBERjUyQjlEMjlGXzFfMTA1X2MuanBlZyIsInNsaWRlc2hvdyI6IjZiNWQ5ODQifQ%3D%3D\">\r\n\t\t\t\t\t<div class=\"e-gallery-image elementor-gallery-item__image\" data-thumbnail=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/476118F2-B52B-4351-896E-80DF52B9D29F_1_105_c.jpeg\" data-width=\"768\" data-height=\"1024\" aria-label=\"Eaton SDM120M energy meter with CT inputs on DIN rail, connected to terminal blocks and wiring\" role=\"img\" ><\/div>\r\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"elementor-gallery-item__overlay\"><\/div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t<\/div>\r\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c068c99 elementor-widget elementor-widget-text-editor\" data-id=\"c068c99\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h2>Step 5 \u2013 Connect all components to the board<\/h2><p>The Eastron SDM120M utilizes the widely adopted <a href=\"https:\/\/pl.wikipedia.org\/wiki\/Modbus\" target=\"_blank\" rel=\"noopener\">Modbus <\/a>communication protocol, extensively employed in industry and automation sectors.<\/p><p>The Modbus protocol operates over the <a href=\"https:\/\/pl.wikipedia.org\/wiki\/EIA-485\" target=\"_blank\" rel=\"noopener\">RS485<\/a> serial interface, facilitating communication among various devices. It follows a master-slave architecture, where one device (master) orchestrates the communication, while other devices (slaves) respond to the master\u2019s commands.<\/p><p>To establish communication between the ESP32 board and the Eastron energy meter via the Modbus protocol over the RS485 interface, a TTL-RS485 converter is necessary. This converter serves as a level shifter, translating the serial signal utilized by the ESP32 board into the RS485 signal compatible with the Eastron SDM120M energy meter. Utilizing this converter, direct connection between the ESP32 board and the energy meter through the RS485 interface becomes feasible, enabling seamless communication between them in adherence to the Modbus protocol.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-daa29f9 elementor-widget elementor-widget-image\" data-id=\"daa29f9\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/Chochol.io-ESP8266-Lampka-w-lazience.png\" data-elementor-open-lightbox=\"yes\" data-elementor-lightbox-title=\"Electricity meter wiring diagram with ESP32 board\" data-e-action-hash=\"#elementor-action%3Aaction%3Dlightbox%26settings%3DeyJpZCI6MjA2NjksInVybCI6Imh0dHBzOlwvXC9jaG9jaG9sLmlvXC93cC1jb250ZW50XC91cGxvYWRzXC8yMDI0XC8wNFwvQ2hvY2hvbC5pby1FU1A4MjY2LUxhbXBrYS13LWxhemllbmNlLnBuZyJ9\">\n\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/Chochol.io-ESP8266-Lampka-w-lazience-1024x576.png\" class=\"attachment-large size-large wp-image-20669\" alt=\"ESP32 z okablowaniem: CONV RXD\/TXD\/VCC do pin\u00f3w 16\/17\/3V3 i modu\u0142 SDM120M zasilany i po\u0142\u0105czony przewodami\" srcset=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/Chochol.io-ESP8266-Lampka-w-lazience-1024x576.png 1024w, https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/Chochol.io-ESP8266-Lampka-w-lazience-300x169.png 300w, https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/Chochol.io-ESP8266-Lampka-w-lazience-768x432.png 768w, https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/Chochol.io-ESP8266-Lampka-w-lazience-1536x864.png 1536w, https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/Chochol.io-ESP8266-Lampka-w-lazience.png 1920w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/>\t\t\t\t\t\t\t\t<\/a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-926af16 elementor-widget elementor-widget-text-editor\" data-id=\"926af16\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h3>Actions<\/h3><p>When connecting the TTL-RS485 converter, observe the appropriate wire pairs between the meter and the ESP32 board:<\/p><ul><li>On the left, the wires from the meter:<ul><li><strong>Pin A+ on the converter <\/strong> corresponds to <strong>pin No. 10<\/strong> (according to the instructions), which is the equivalent of <strong>A+ on the meter<\/strong>.<\/li><li><strong>Pin B- on the converter<\/strong> corresponds to <strong>pin No. 9 <\/strong> (according to the manual), which is the equivalent of <strong>B- on the meter<\/strong>.<\/li><li><strong>Pin G<\/strong> <em>(marked with Chinese characters)<\/em> <strong>on the converter<\/strong> corresponds to <strong>pin No. 8 <\/strong> (according to the manual), which is the equivalent of <strong>G on the meter<\/strong>.<\/li><\/ul><\/li><li>On the right, the wires from the ESP32 board:<ul><li><strong>The GND pin on the converter<\/strong> should be connected to the GND pin on the ESP32 board.<\/li><li><strong>The RXD pin on the converter <\/strong> should be connected to <strong>pin 16<\/strong> on the ESP32 board, which corresponds to the <strong>UART RX line<\/strong>.<\/li><li><strong>The TXD pin on the converter<\/strong> should be connected to <strong>pin 17 <\/strong> on the ESP32 board, which corresponds to the <strong>UART TX line<\/strong>.<\/li><li><strong>The VCC pin on the converter <\/strong> should be connected to the <strong>3V3 pin<\/strong> on the ESP32 board to <strong>provide power<\/strong>.<\/li><\/ul><\/li><li>Make sure you secure all connections properly<ul><li>Check that the board contacts do not touch metal (possibly) parts of the case or other wires that could damage your electronics.<\/li><\/ul><\/li><li>Connect the installation to the power supply<ul><li>Wait for the ESP32 board to connect to your Wi-Fi network.<\/li><\/ul><\/li><\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-25b1de2 elementor-widget elementor-widget-gallery\" data-id=\"25b1de2\" data-element_type=\"widget\" data-e-type=\"widget\" data-settings=\"{&quot;columns&quot;:3,&quot;aspect_ratio&quot;:&quot;1:1&quot;,&quot;lazyload&quot;:&quot;yes&quot;,&quot;gallery_layout&quot;:&quot;grid&quot;,&quot;columns_tablet&quot;:2,&quot;columns_mobile&quot;:1,&quot;gap&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:10,&quot;sizes&quot;:[]},&quot;gap_tablet&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:10,&quot;sizes&quot;:[]},&quot;gap_mobile&quot;:{&quot;unit&quot;:&quot;px&quot;,&quot;size&quot;:10,&quot;sizes&quot;:[]},&quot;link_to&quot;:&quot;file&quot;,&quot;overlay_background&quot;:&quot;yes&quot;,&quot;content_hover_animation&quot;:&quot;fade-in&quot;}\" data-widget_type=\"gallery.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-gallery__container\">\r\n\t\t\t\t\t\t\t<a class=\"e-gallery-item elementor-gallery-item elementor-animated-content\" href=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/26A3F132-81CE-4F79-B5DC-47185C844FB5_1_105_c.jpeg\" data-elementor-open-lightbox=\"yes\" data-elementor-lightbox-slideshow=\"25b1de2\" data-elementor-lightbox-title=\"Eastron SDM i ESPHome, pod\u0142\u0105czenie p\u0142ytki ESP\" data-e-action-hash=\"#elementor-action%3Aaction%3Dlightbox%26settings%3DeyJpZCI6MjA2NzEsInVybCI6Imh0dHBzOlwvXC9jaG9jaG9sLmlvXC93cC1jb250ZW50XC91cGxvYWRzXC8yMDI0XC8wNFwvMjZBM0YxMzItODFDRS00Rjc5LUI1REMtNDcxODVDODQ0RkI1XzFfMTA1X2MuanBlZyIsInNsaWRlc2hvdyI6IjI1YjFkZTIifQ%3D%3D\">\r\n\t\t\t\t\t<div class=\"e-gallery-image elementor-gallery-item__image\" data-thumbnail=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/26A3F132-81CE-4F79-B5DC-47185C844FB5_1_105_c-768x576.jpeg\" data-width=\"768\" data-height=\"576\" aria-label=\"Close-up of a control relay module PCB with screw terminals and multicolor wiring connected to a device.\" role=\"img\" ><\/div>\r\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"elementor-gallery-item__overlay\"><\/div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t\t\t<a class=\"e-gallery-item elementor-gallery-item elementor-animated-content\" href=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/D15F2227-7DAD-4CCC-8C7F-BEC83CD51855_1_105_c.jpeg\" data-elementor-open-lightbox=\"yes\" data-elementor-lightbox-slideshow=\"25b1de2\" data-elementor-lightbox-title=\"Eastron SDM i ESPHome, pod\u0142\u0105czenie p\u0142ytki ESP\" data-e-action-hash=\"#elementor-action%3Aaction%3Dlightbox%26settings%3DeyJpZCI6MjA2NzMsInVybCI6Imh0dHBzOlwvXC9jaG9jaG9sLmlvXC93cC1jb250ZW50XC91cGxvYWRzXC8yMDI0XC8wNFwvRDE1RjIyMjctN0RBRC00Q0NDLThDN0YtQkVDODNDRDUxODU1XzFfMTA1X2MuanBlZyIsInNsaWRlc2hvdyI6IjI1YjFkZTIifQ%3D%3D\">\r\n\t\t\t\t\t<div class=\"e-gallery-image elementor-gallery-item__image\" data-thumbnail=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/D15F2227-7DAD-4CCC-8C7F-BEC83CD51855_1_105_c.jpeg\" data-width=\"768\" data-height=\"1024\" aria-label=\"Open microcontroller board in a white cable enclosure, with power LED lit and GPIO connectors visible\" role=\"img\" ><\/div>\r\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"elementor-gallery-item__overlay\"><\/div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t\t\t<a class=\"e-gallery-item elementor-gallery-item elementor-animated-content\" href=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/52177ADF-E068-4072-8346-9830158B72ED_1_105_c.jpeg\" data-elementor-open-lightbox=\"yes\" data-elementor-lightbox-slideshow=\"25b1de2\" data-elementor-lightbox-title=\"Eastron SDM i ESPHome, pod\u0142\u0105czenie p\u0142ytki ESP\" data-e-action-hash=\"#elementor-action%3Aaction%3Dlightbox%26settings%3DeyJpZCI6MjA2NzUsInVybCI6Imh0dHBzOlwvXC9jaG9jaG9sLmlvXC93cC1jb250ZW50XC91cGxvYWRzXC8yMDI0XC8wNFwvNTIxNzdBREYtRTA2OC00MDcyLTgzNDYtOTgzMDE1OEI3MkVEXzFfMTA1X2MuanBlZyIsInNsaWRlc2hvdyI6IjI1YjFkZTIifQ%3D%3D\">\r\n\t\t\t\t\t<div class=\"e-gallery-image elementor-gallery-item__image\" data-thumbnail=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/52177ADF-E068-4072-8346-9830158B72ED_1_105_c-768x576.jpeg\" data-width=\"768\" data-height=\"576\" aria-label=\"Close-up of ribbon cable on a circuit board header with multi-color wires and stacked pins\" role=\"img\" ><\/div>\r\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"elementor-gallery-item__overlay\"><\/div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t<\/div>\r\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-ec0f047 elementor-widget elementor-widget-text-editor\" data-id=\"ec0f047\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h3>Communication problems<\/h3>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-2092e98 elementor-widget elementor-widget-mdp-coder-elementor\" data-id=\"2092e98\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"mdp-coder-elementor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t        <!-- Start Coder for Elementor WordPress Plugin -->\n        <div\n            id=\"mdp-coder-2092e98\"\n            class=\"mdp-coder-elementor-box\"\n            data-theme=\"mdp-theme-material-dark\"\n            data-dark-theme=\"mdp-theme-material-dark\"\n        >\n            \n                <pre class=\"language-yaml line-numbers\"data-previewers=\"\"><code>esp32:\n  board: nodemcu-32s\n  framework:\n    type: arduino\n    version: 2.0.6<\/code><\/pre>\n                    <\/div>\n                <script>\n            \"use strict\";\n\n            \/** Handler when the DOM is fully loaded. *\/\n            let callback_2092e98 = function() {\n\n                \/** Set theme for coder widget. *\/\n                function setTheme() {\n\n                    \/** Foreach Code Widget. *\/\n                    let coderBoxes = document.querySelectorAll( '.mdp-coder-elementor-box' );\n\n                    for ( let coderBox of coderBoxes ) {\n\n                        let lightTheme = coderBox.dataset.theme;\n                        let darkTheme = coderBox.dataset.darkTheme;\n\n                        coderBox.className = '';\n                        if ( window.matchMedia && window.matchMedia( '(prefers-color-scheme: dark)' ).matches ) {\n\n                            coderBox.className = 'mdp-coder-elementor-box ' + darkTheme;\n\n                        } else {\n\n                            coderBox.className = 'mdp-coder-elementor-box ' + lightTheme;\n\n                        }\n\n                    }\n\n                }\n                setTheme();\n\n\n                \/** Watch for changes color-scheme. *\/\n                window.matchMedia(\"(prefers-color-scheme: dark)\").addListener( function() {\n                    setTheme();\n                } );\n\n                \n                if ( typeof Prism !== 'undefined' ) {\n\n                    Prism.plugins.autoloader.languages_path = 'https:\/\/chochol.io\/wp-content\/plugins\/coder-elementor\/js\/prism\/components\/';\n                    Prism.highlightAll();\n                    Prism.fileHighlight();\n\n                }\n\n                \n            };\n\n            if (\n                document.readyState === \"complete\" ||\n                ( document.readyState !== \"loading\" && !document.documentElement.doScroll )\n            ) {\n                callback_2092e98();\n            } else {\n                document.addEventListener( \"DOMContentLoaded\", callback_2092e98 );\n            }\n\n        <\/script>\n                <!-- End Coder for Elementor WordPress Plugin -->\n\n        \t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-dae62cc elementor-widget elementor-widget-text-editor\" data-id=\"dae62cc\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>In the above code, I used an ESP32 board with a specific Arduino framework version 2.0.6. The choice of this configuration is due to the communication problems that occurred on the ESP32 board installed by default. Unfortunately, ESPHome\u2019s development team has not fixed these problems for some time. Nevertheless, using this configuration, it was possible to achieve correct communication with the Eastron SDM120M energy meter.<\/p>\n<p>It is worth noting that although this configuration works, some warnings and error messages appear in the logs. At first, a warning about the selected version of the Arduino framework informs that the selected version is not recommended.<\/p>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-aba604d elementor-widget elementor-widget-mdp-coder-elementor\" data-id=\"aba604d\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"mdp-coder-elementor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t        <!-- Start Coder for Elementor WordPress Plugin -->\n        <div\n            id=\"mdp-coder-aba604d\"\n            class=\"mdp-coder-elementor-box\"\n            data-theme=\"mdp-theme-material-dark\"\n            data-dark-theme=\"mdp-theme-material-dark\"\n        >\n            \n                <pre class=\"language-php line-numbers\"data-previewers=\"\"><code>INFO ESPHome 2024.4.1\nINFO Reading configuration \/config\/esphome\/esp03-meter.yaml...\nWARNING The selected Arduino framework version is not the recommended one. If there are connectivity or build issues please remove the manual version.\nWARNING The selected Arduino framework version is not the recommended one. If there are connectivity or build issues please remove the manual version.\nINFO Starting log output from 192.168.XXX.XX using esphome API\nINFO Successfully connected to esp03-meter @ 192.168.XXX.XX in 0.239s\nINFO Successful handshake with esp03-meter @ 192.168.XXX.XX in 0.084s<\/code><\/pre>\n                    <\/div>\n                <script>\n            \"use strict\";\n\n            \/** Handler when the DOM is fully loaded. *\/\n            let callback_aba604d = function() {\n\n                \/** Set theme for coder widget. *\/\n                function setTheme() {\n\n                    \/** Foreach Code Widget. *\/\n                    let coderBoxes = document.querySelectorAll( '.mdp-coder-elementor-box' );\n\n                    for ( let coderBox of coderBoxes ) {\n\n                        let lightTheme = coderBox.dataset.theme;\n                        let darkTheme = coderBox.dataset.darkTheme;\n\n                        coderBox.className = '';\n                        if ( window.matchMedia && window.matchMedia( '(prefers-color-scheme: dark)' ).matches ) {\n\n                            coderBox.className = 'mdp-coder-elementor-box ' + darkTheme;\n\n                        } else {\n\n                            coderBox.className = 'mdp-coder-elementor-box ' + lightTheme;\n\n                        }\n\n                    }\n\n                }\n                setTheme();\n\n\n                \/** Watch for changes color-scheme. *\/\n                window.matchMedia(\"(prefers-color-scheme: dark)\").addListener( function() {\n                    setTheme();\n                } );\n\n                \n                if ( typeof Prism !== 'undefined' ) {\n\n                    Prism.plugins.autoloader.languages_path = 'https:\/\/chochol.io\/wp-content\/plugins\/coder-elementor\/js\/prism\/components\/';\n                    Prism.highlightAll();\n                    Prism.fileHighlight();\n\n                }\n\n                \n            };\n\n            if (\n                document.readyState === \"complete\" ||\n                ( document.readyState !== \"loading\" && !document.documentElement.doScroll )\n            ) {\n                callback_aba604d();\n            } else {\n                document.addEventListener( \"DOMContentLoaded\", callback_aba604d );\n            }\n\n        <\/script>\n                <!-- End Coder for Elementor WordPress Plugin -->\n\n        \t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f7af3f0 elementor-widget elementor-widget-text-editor\" data-id=\"f7af3f0\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Then, there are errors related to the Modbus component. You can see warnings about the long duration of the operation and information that the Modbus component should block the operation for a maximum of 30 ms. Although these errors are not critical and should not prevent the system from operating, it is worth being aware of their existence and monitoring their impact on the operation of the entire system.<\/p>\n<p>If you want to read the details of the problem, <a href=\"https:\/\/github.com\/esphome\/issues\/issues\/4717\" target=\"_blank\" rel=\"noopener\">I invite you to this link on GitHub<\/a>.<\/p>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-5352f00 elementor-widget elementor-widget-mdp-coder-elementor\" data-id=\"5352f00\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"mdp-coder-elementor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t        <!-- Start Coder for Elementor WordPress Plugin -->\n        <div\n            id=\"mdp-coder-5352f00\"\n            class=\"mdp-coder-elementor-box\"\n            data-theme=\"mdp-theme-material-dark\"\n            data-dark-theme=\"mdp-theme-material-dark\"\n        >\n            \n                <pre class=\"language-php line-numbers\"data-previewers=\"\"><code>[22:58:43][D][sdm_meter:043]: SDMMeter Phase A: V=230.800 V, I=0.149 A, Active P=13.700 W, Apparent P=17.513 VA, Reactive P=-10.200 VAR, PF=0.799, PA=0.000 \u00b0\n[22:58:43][D][sensor:094]: &#039;Voltage&#039;: Sending state 230.80000 V with 2 decimals of accuracy\n[22:58:43][D][sensor:094]: &#039;Current&#039;: Sending state 0.14900 A with 3 decimals of accuracy\n[22:58:43][D][sensor:094]: &#039;Active power&#039;: Sending state 13.70000 W with 2 decimals of accuracy\n[22:58:43][D][sensor:094]: &#039;Apparent power&#039;: Sending state 17.51257 VA with 2 decimals of accuracy\n[22:58:43][D][sensor:094]: &#039;Reactive power&#039;: Sending state -10.20000 VAR with 2 decimals of accuracy\n[22:58:43][D][sensor:094]: &#039;Power factor&#039;: Sending state 0.79933 % with 3 decimals of accuracy\n[22:58:43][D][sensor:094]: &#039;Phase angle&#039;: Sending state 0.00000 \u00b0 with 3 decimals of accuracy\n[22:58:43][D][sdm_meter:069]: SDMMeter: F=50.040 Hz, Im.A.E=144.311 Wh, Ex.A.E=0.000 Wh, Im.R.E=0.072 VARh, Ex.R.E=107.578 VARh, T.P=0.000 W\n[22:58:43][D][sensor:094]: &#039;Total power&#039;: Sending state 0.00000 W with 2 decimals of accuracy\n[22:58:43][D][sensor:094]: &#039;Frequency&#039;: Sending state 50.04000 Hz with 3 decimals of accuracy\n[22:58:43][D][sensor:094]: &#039;Import Active Energy&#039;: Sending state 144.31100 kWh with 2 decimals of accuracy\n[22:58:43][D][sensor:094]: &#039;Export Active Energy&#039;: Sending state 0.00000 kWh with 2 decimals of accuracy\n[22:58:43][D][sensor:094]: &#039;Import Reactive Energy&#039;: Sending state 0.07200 kVArh with 2 decimals of accuracy\n[22:58:43][D][sensor:094]: &#039;Export Reactive Energy&#039;: Sending state 107.57800 kVArh with 2 decimals of accuracy\n[22:58:43][W][component:237]: Component modbus took a long time for an operation (159 ms).\n[22:58:43][W][component:238]: Components should block for at most 30 ms.<\/code><\/pre>\n                    <\/div>\n                <script>\n            \"use strict\";\n\n            \/** Handler when the DOM is fully loaded. *\/\n            let callback_5352f00 = function() {\n\n                \/** Set theme for coder widget. *\/\n                function setTheme() {\n\n                    \/** Foreach Code Widget. *\/\n                    let coderBoxes = document.querySelectorAll( '.mdp-coder-elementor-box' );\n\n                    for ( let coderBox of coderBoxes ) {\n\n                        let lightTheme = coderBox.dataset.theme;\n                        let darkTheme = coderBox.dataset.darkTheme;\n\n                        coderBox.className = '';\n                        if ( window.matchMedia && window.matchMedia( '(prefers-color-scheme: dark)' ).matches ) {\n\n                            coderBox.className = 'mdp-coder-elementor-box ' + darkTheme;\n\n                        } else {\n\n                            coderBox.className = 'mdp-coder-elementor-box ' + lightTheme;\n\n                        }\n\n                    }\n\n                }\n                setTheme();\n\n\n                \/** Watch for changes color-scheme. *\/\n                window.matchMedia(\"(prefers-color-scheme: dark)\").addListener( function() {\n                    setTheme();\n                } );\n\n                \n                if ( typeof Prism !== 'undefined' ) {\n\n                    Prism.plugins.autoloader.languages_path = 'https:\/\/chochol.io\/wp-content\/plugins\/coder-elementor\/js\/prism\/components\/';\n                    Prism.highlightAll();\n                    Prism.fileHighlight();\n\n                }\n\n                \n            };\n\n            if (\n                document.readyState === \"complete\" ||\n                ( document.readyState !== \"loading\" && !document.documentElement.doScroll )\n            ) {\n                callback_5352f00();\n            } else {\n                document.addEventListener( \"DOMContentLoaded\", callback_5352f00 );\n            }\n\n        <\/script>\n                <!-- End Coder for Elementor WordPress Plugin -->\n\n        \t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-5981f4b elementor-widget elementor-widget-text-editor\" data-id=\"5981f4b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h2>Step 6 \u2013 Reverse proxy on Synology using Nginx Proxy Manager<\/h2><p>Do you use Synology and want to improve access to your Home Assistant server? Here\u2019s a quick step-by-step guide on how to set up a login using a domain name and subdomain, such as ha.xyz.com, instead of entering an IP address. You can achieve all this with Docker Compose in the Portainer.<\/p><p>\ud83d\udc49 <a href=\"https:\/\/chochol.io\/en\/hardware\/synology-free-ports-80-443-for-nginx-proxy-manager\/\" target=\"_new\">Check it out now<\/a> and get your environment ready for more improvements!<\/p><p>Thus, by using a domain name instead of an IP address, you simplify the process of logging into your Home Assistant server on Synology.<\/p><h2>Step 7 \u2013 Adding a device to Home Assistant<\/h2><ul><li>In the Home Assistant notification section, you\u2019ll notice that our home automation server has detected a new device,<\/li><li>Next, navigate to <strong>Settings<\/strong>, then to <strong>Integrations and Devices<\/strong>,<\/li><li>You\u2019ll see the new device highlighted with a blue border. <strong>Approve the new device for integration.<\/strong><\/li><li>Afterward, <strong>set the area<\/strong> where the device will be located. In our case, it will be in Storage.<\/li><li><strong>Congratulations!<\/strong> You\u2019ve reached this stage, indicating a successful configuration process. To verify the performance of your new device, you can directly access it from Home Assistant and check the parameters measured by the electricity meter. \ud83d\ude80<\/li><\/ul><p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-20682\" src=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/Screenshot-2024-04-25-at-11.31.19.png\" alt=\"ESPHome basement electricity metering, Sensors\" width=\"343\" height=\"680\" srcset=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/Screenshot-2024-04-25-at-11.31.19.png 343w, https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/Screenshot-2024-04-25-at-11.31.19-151x300.png 151w\" sizes=\"(max-width: 343px) 100vw, 343px\" \/><\/p><p>If you have additional questions about the setup, <strong>go ahead and leave a comment under this article<\/strong> or <strong>contact me directly<\/strong>. I will be happy to answer any concerns and help solve any problems. Your questions can help improve this guide for other users.<\/p><h2>Additional materials and information<\/h2><p>For further exploration and more information, I recommend checking out the links below. They are valuable sources that were used in the development of this guide.<\/p><ul><li>Getting Started with ESPHome and Home Assistant. <a href=\"https:\/\/esphome.io\/guides\/getting_started_hassio#installing-esphome-dashboard\" target=\"_blank\" rel=\"noopener\">https:\/\/esphome.io\/guides\/getting_started_hassio#installing-esphome-dashboard<\/a><\/li><li>Eastron SDM Energy Monitor. <a href=\"https:\/\/esphome.io\/components\/sensor\/sdm_meter\" target=\"_blank\" rel=\"noopener\">https:\/\/esphome.io\/components\/sensor\/sdm_meter<\/a><\/li><li>SDM120 Series Manual. <a href=\"https:\/\/www.eastroneurope.com\/images\/uploads\/products\/manuals\/SDM120_Series_Manual_.pdf\" target=\"_blank\" rel=\"noopener\">https:\/\/www.eastroneurope.com\/images\/uploads\/products\/manuals\/SDM120_Series_Manual_.pdf<\/a><\/li><\/ul><h2>Read also<\/h2><p>Here are some articles related to your interests:<\/p><ul><li><a href=\"https:\/\/chochol.io\/en\/smart-home\/home-assistant-bme280-sensor-installation-via-esphome\/\">Home Assistant: BME280 sensor installation via ESPHome.<\/a> Learn how to create a simple weather station for your balcony using ESPHome and Home Assistant with the BME280 sensor.<\/li><li><a href=\"https:\/\/chochol.io\/en\/computer-networking\/nginx-proxy-cloudflare-how-to-restore-a-real-ip-address\/\">Nginx Proxy & Cloudflare: How to restore a real IP address<\/a>. Discover how to restore users\u2019 real IP addresses in server logs using Nginx Proxy Manager and Cloudflare as a reverse proxy.<\/li><li><a href=\"https:\/\/chochol.io\/en\/hardware\/tvheadend-satip-decoder-installation-and-configuration\/\">TVHeadend: SAT>IP decoder installation and configuration<\/a>. Follow a step-by-step guide to configuring a SAT>IP decoder with TVHeadend in Docker Compose using the Telestar Digibit Twin.<\/li><li><a href=\"https:\/\/chochol.io\/en\/computer-networking\/how-to-configure-a-leox-gpon-ont-module-on-a-mikrotik-router\/\">How to configure a Leox GPON ONT module on a Mikrotik router<\/a>. Learn how to configure the Leox LXT-010S-H GPON ONT module on a Mikrotik RB5009 router instead of the ONT module from Orange.<\/li><li><a href=\"https:\/\/chochol.io\/en\/computer-networking\/unifi-network-application-remote-adoption-of-an-access-point\/\">UniFi Network Application: Connecting an Access Point from another network<\/a>. Discover how to connect a Ubiquiti UniFi device from another network to the Network Application, using Mikrotik\u2019s IPSec tunnel as an example.<\/li><li><a href=\"https:\/\/chochol.io\/en\/computer-networking\/unifi-controller-in-docker-migrating-to-unifi-network-application\/\">UniFi Controller in Docker: Migrating to UniFi Network Application<\/a>. Follow a step-by-step guide to successfully migrating to the Network Application using Docker Compose.<\/li><li><a href=\"https:\/\/chochol.io\/en\/hardware\/ads-b-receiver-installation-and-configuration-on-raspberry-pi\/\">ADS-B: Installing and configuring the receiver on a Raspberry Pi<\/a>. Learn how to install and configure your own ADS-B antenna on a Raspberry Pi to track aircraft in real-time.<\/li><li><a href=\"https:\/\/chochol.io\/en\/software\/traccar-docker-installation-guide-on-synology\/\">Traccar: A guide to installing on Synology in Docker<\/a>. Follow a step-by-step guide to installing Traccar on Synology using Docker for effective vehicle tracking on your own server.<\/li><\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Installation and integration of the Eastron SDM120M energy meter with Home Assistant using ESPHome. A detailed step-by-step guide.<\/p>\n","protected":false},"author":1,"featured_media":20653,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[86],"tags":[136,138,139,135,141],"class_list":["post-20697","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-smart-home","tag-diy","tag-esphome","tag-home-assistant","tag-home-automation","tag-iot"],"_links":{"self":[{"href":"https:\/\/chochol.io\/en\/wp-json\/wp\/v2\/posts\/20697","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chochol.io\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chochol.io\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chochol.io\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/chochol.io\/en\/wp-json\/wp\/v2\/comments?post=20697"}],"version-history":[{"count":0,"href":"https:\/\/chochol.io\/en\/wp-json\/wp\/v2\/posts\/20697\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/chochol.io\/en\/wp-json\/wp\/v2\/media\/20653"}],"wp:attachment":[{"href":"https:\/\/chochol.io\/en\/wp-json\/wp\/v2\/media?parent=20697"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chochol.io\/en\/wp-json\/wp\/v2\/categories?post=20697"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chochol.io\/en\/wp-json\/wp\/v2\/tags?post=20697"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}