{"id":20588,"date":"2024-04-23T19:17:30","date_gmt":"2024-04-23T17:17:30","guid":{"rendered":"https:\/\/chochol.io\/smart-home\/home-assistant-bme280-sensor-installation-via-esphome\/"},"modified":"2025-08-23T19:56:18","modified_gmt":"2025-08-23T17:56:18","slug":"home-assistant-bme280-sensor-installation-via-esphome","status":"publish","type":"post","link":"https:\/\/chochol.io\/en\/smart-home\/home-assistant-bme280-sensor-installation-via-esphome\/","title":{"rendered":"Home Assistant: BME280 sensor installation via ESPHome"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"20588\" class=\"elementor elementor-20588 elementor-1194\" data-elementor-post-type=\"post\">\n\t\t\t\t<div class=\"elementor-element elementor-element-5fa40af e-flex e-con-boxed e-con e-parent\" data-id=\"5fa40af\" 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-9bca30b elementor-toc--minimized-on-tablet elementor-widget elementor-widget-table-of-contents\" data-id=\"9bca30b\" 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\">\n\t\t\t\t\t\t<div class=\"elementor-toc__header-title\">\n\t\t\t\tTable of Contents\t\t\t<\/div>\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__9bca30b\" 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>\n\t\t\t\t<div class=\"elementor-toc__toggle-button elementor-toc__toggle-button--collapse\" role=\"button\" tabindex=\"0\" aria-controls=\"elementor-toc__9bca30b\" 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>\n\t\t\t\t\t<\/div>\n\t\t\t\t<div id=\"elementor-toc__9bca30b\" class=\"elementor-toc__body\">\n\t\t\t<div class=\"elementor-toc__spinner-container\">\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>\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-45f926b elementor-widget elementor-widget-text-editor\" data-id=\"45f926b\" 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\">Smart home solutions are becoming more and more popular, offering convenience, energy savings and better control over our environment. One tool that facilitates the creation of such systems is ESPHome, a powerful platform based on ESP chips. It allows you to program various sensors and devices to gain full control of your smart home.<\/p><p class=\"whitespace-pre-wrap break-words\">In today&#8217;s tutorial, we will use ESPHome to create a simple but extremely useful weather station for the balcony. We will use the BME280 sensor to measure temperature, humidity and atmospheric pressure. This will allow you to monitor weather conditions in the immediate area in real time.<\/p><p class=\"whitespace-pre-wrap break-words\">Creating a weather station using ESPHome is not only practical, but also a great opportunity to learn the basics of programming home automation systems. We will take you step by step through the entire process &#8211; from setting up the environment, to connecting the sensor, to visualizing the data on a sample interface.<\/p><p class=\"whitespace-pre-wrap break-words\"><strong>Ready? Fasten your seat belts<\/strong>, because it&#8217;s time to bring some intelligence into your home! Let&#8217;s start the adventure with ESPHome and the weather station on the balcony. \ud83d\ude80<\/p><h3>What is the ESP8266 NodeMCU?<\/h3><p><img fetchpriority=\"high\" decoding=\"async\" class=\"alignleft wp-image-1241\" src=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/01\/assets2F-LpXqB3J1BMD5s4OpYSg2F-LpXslUdklMPEtHLTfE22F-LpXt-jt9761qMH3KcKY2Fnodemcu-300x162.webp\" sizes=\"(max-width: 351px) 100vw, 351px\" srcset=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/01\/assets2F-LpXqB3J1BMD5s4OpYSg2F-LpXslUdklMPEtHLTfE22F-LpXt-jt9761qMH3KcKY2Fnodemcu-300x162.webp 300w, https:\/\/chochol.io\/wp-content\/uploads\/2024\/01\/assets2F-LpXqB3J1BMD5s4OpYSg2F-LpXslUdklMPEtHLTfE22F-LpXt-jt9761qMH3KcKY2Fnodemcu.webp 629w\" alt=\"ESP8266, board\" width=\"346\" height=\"186\" \/>The <strong>ESP8266 NodeMCU<\/strong> is a small but extremely powerful development board based on the popular ESP8266 chip from <strong>Espressif<\/strong>. Equipped with an integrated Wi-Fi module operating at 802.11 b\/g\/n, it allows easy connection to existing wireless networks and communication with other devices over the Internet.<\/p><p class=\"whitespace-pre-wrap\">At the heart of the board is a 32-bit Tensilica L106 processor at 80-160 MHz and 64 KiB of instruction memory and 96 KiB of data memory. The NodeMCU has a built-in USB-UART converter (CP2102), so it can be easily connected to a computer and programmed using the Arduino IDE or other environment.<\/p><p class=\"whitespace-pre-wrap\">A key advantage is the existence of as many as 17 GPIO (General-Purpose Input\/Output) pins, which can be freely used as digital I\/O or assigned other functions, such as I2C, SPI, UART, etc. This allows communication and control of all kinds of sensors, displays and executive devices.<\/p><p class=\"whitespace-pre-wrap\">Despite its compact size and low price, the ESP8266 NodeMCU has great potential in DIY and Internet of Things projects thanks to its strong capabilities, low cost and excellent community support.<\/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=\"342\" height=\"263\" \/><\/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 the remote control to our system using the ESP8266 and ESPHome, it&#8217;s 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:\/\/botland.com.pl\/moduly-wifi-esp8266\/8241-modul-wifi-esp8266-nodemcu-v3-5904422300630.html\" target=\"_blank\" rel=\"noopener\">ESP8266<\/a> NodeMCU board (or <a href=\"https:\/\/botland.com.pl\/moduly-wifi-i-bt-esp32\/8893-esp32-wifi-bt-42-platforma-z-modulem-esp-wroom-32-zgodny-z-esp32-devkit-5904422337438.html\" 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>Waveshare BME280 temperature, pressure and humidity sensor (<a href=\"https:\/\/amzn.to\/4d28tMO\" 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>A box in which to hide the plate (weatherproof),<\/li><li>Meteorological Cage,<\/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><h2>Step 1 &#8211; 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>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 &#8211; Install and configure firmware to work with Home Assistant<\/h2><p>Once the ESPHome add-on is running on the Home Assistant server, it&#8217;s 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 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 &#8211; Upload the code in ESPHome<\/h2><div>In this section, we will now upload the appropriate entries for the sensor implementation. 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-45bfa0e elementor-widget elementor-widget-mdp-coder-elementor\" data-id=\"45bfa0e\" 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-45bfa0e\"\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 copy-to-clipboard\"data-previewers=\"\"><code>esphome:\n  name: esp01-loggia\n\nesp8266:\n  board: esp01_1m\n\n# Enable logging\nlogger:\n\nweb_server:\n  port: 80\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;Esp01-Loggia Fallback Hotspot&quot;\n    password: &quot;1234567890&quot;\n\ncaptive_portal:\n\ni2c:\n  - id: bus_a\n    sda: 5\n    scl: 4\n    scan: true\n\nbinary_sensor:\n  - platform: status\n    name: &quot;Status&quot;\n    id: status_sensor\n\nsensor:\n  - platform: bme280_i2c\n    temperature:\n      name: &quot;Ambient temperature&quot;\n      oversampling: 16x\n    pressure:\n      name: &quot;Atmospheric pressure&quot;\n    humidity:\n      name: &quot;Air humidity&quot;\n    address: 0x77\n    update_interval: 300s\n    i2c_id: bus_a\n  - platform: wifi_signal\n    name: &quot;Wi-Fi Signal&quot;\n    update_interval: 60s\n    icon: mdi:wifi  <\/code><\/pre>\n                    <\/div>\n                <script>\n            \"use strict\";\n\n            \/** Handler when the DOM is fully loaded. *\/\n            let callback_45bfa0e = 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_45bfa0e();\n            } else {\n                document.addEventListener( \"DOMContentLoaded\", callback_45bfa0e );\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-25064f3 elementor-widget elementor-widget-text-editor\" data-id=\"25064f3\" 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&#8217;s configuration.<\/li><\/ul><h2>Step 4 &#8211; Connect all components to the board<\/h2>\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-dc3eeca elementor-widget elementor-widget-image\" data-id=\"dc3eeca\" 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\/Okladka-artykulow-Chochol.io-4.png\" data-elementor-open-lightbox=\"yes\" data-elementor-lightbox-title=\"ESP wiring diagram - BME280\" data-e-action-hash=\"#elementor-action%3Aaction%3Dlightbox%26settings%3DeyJpZCI6MjA1NzYsInVybCI6Imh0dHBzOlwvXC9jaG9jaG9sLmlvXC93cC1jb250ZW50XC91cGxvYWRzXC8yMDI0XC8wNFwvT2tsYWRrYS1hcnR5a3Vsb3ctQ2hvY2hvbC5pby00LnBuZyJ9\">\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\/Okladka-artykulow-Chochol.io-4-1024x576.png\" class=\"attachment-large size-large wp-image-20576\" alt=\"ESP8266 WiFi module wiring to BME280: VCC=3V3, GND, I2C SCL=D1 GPIO5, SDA=D2 GPIO4.\" srcset=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/Okladka-artykulow-Chochol.io-4-1024x576.png 1024w, https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/Okladka-artykulow-Chochol.io-4-300x169.png 300w, https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/Okladka-artykulow-Chochol.io-4-768x432.png 768w, https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/Okladka-artykulow-Chochol.io-4-1536x864.png 1536w, https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/Okladka-artykulow-Chochol.io-4.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-df6b4d9 elementor-widget elementor-widget-text-editor\" data-id=\"df6b4d9\" 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>Remember to perform these activities with the highest standards of electrical safety. Make sure all connections are properly secured.<\/p><h3>Installation<\/h3><p>Let&#8217;s start by connecting the BME280 sensor to the ESP8266 board. The BME280 communicates via the I2C interface, so we need to connect the appropriate pins:<\/p><ul class=\"list-disc pl-8 space-y-2 -mt-1\"><li class=\"whitespace-normal break-words\">Pin D1 (GPIO5) on ESP8266 to SCL line (serial clock)<\/li><li class=\"whitespace-normal break-words\">Pin D2 (GPIO4) on the ESP8266 is the SDA (Serial Data) line.<\/li><\/ul><p class=\"whitespace-pre-wrap break-words\">Connect as follows:<\/p><ul class=\"list-disc pl-8 space-y-2 -mt-1\"><li class=\"whitespace-normal break-words\">SCL pin of BME280 sensor with D1 (GPIO5) pin on ESP8266<\/li><li class=\"whitespace-normal break-words\">SDA pin of BME280 sensor with D2 (GPIO4) pin on ESP8266<\/li><li class=\"whitespace-normal break-words\">Connect the ground (GND) of the sensor and ESP8266<\/li><li class=\"whitespace-normal break-words\">Connect the power supply (VCC) of the sensor to 3.3V on the ESP8266<\/li><\/ul><h3>Final verification<\/h3><p class=\"whitespace-pre-wrap break-words\">After setting up ESPHome and connecting the BME280 sensor, it&#8217;s time to verify the operation of our weather station. Connect the ESP8266 board to the power supply and wait for startup. ESPHome logs should show messages indicating that the BME280 sensor has been detected and readings of temperature, humidity and atmospheric pressure.<\/p><p class=\"whitespace-pre-wrap break-words\">You can now test the station&#8217;s performance by observing changes in weather parameters or displaying them on an interface of your choice, such as through a web browser or a mobile app that works with Home Assistant.<\/p><h3>Many more possibilities<\/h3><p class=\"whitespace-pre-wrap break-words\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft wp-image-20577\" src=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/Projekt-bez-nazwy.png\" alt=\"Icon announcing an article for the ESP board - Barrier\" width=\"250\" height=\"250\" srcset=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/Projekt-bez-nazwy.png 1080w, https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/Projekt-bez-nazwy-150x150.png 150w, https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/Projekt-bez-nazwy-300x300.png 300w, https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/Projekt-bez-nazwy-768x768.png 768w, https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/Projekt-bez-nazwy-1024x1024.png 1024w, https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/Projekt-bez-nazwy-60x60.png 60w, https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/Projekt-bez-nazwy-360x360.png 360w\" sizes=\"(max-width: 250px) 100vw, 250px\" \/>It is worth mentioning that the same ESP8266 board we used to create the weather station can also be used for other smart home applications. One of them is the control of the estate barrier.<\/p><p class=\"whitespace-pre-wrap break-words\">Imagine being able to open and close the barrier using a smartphone or voice assistant &#8211; not only a convenience, but also additional security. Using ESPHome and the relay module, you can easily integrate the barrier into your home automation system.<\/p><p class=\"whitespace-pre-wrap break-words\">If you are interested in this topic, I recommend you to read my tutorial on installing and configuring remote control of an estate barrier using ESP8266 and ESPHome. <a href=\"https:\/\/chochol.io\/en\/smart-home\/home-assistant-esphome-to-control-a-housing-estate-gate\/\">There you will find all the necessary step-by-step information. <\/a><\/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-e677992 elementor-widget elementor-widget-gallery\" data-id=\"e677992\" data-element_type=\"widget\" data-e-type=\"widget\" data-settings=\"{&quot;columns&quot;:2,&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;aspect_ratio&quot;:&quot;3:2&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\">\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\/03\/IMG_6406-scaled.jpeg\" data-elementor-open-lightbox=\"yes\" data-elementor-lightbox-slideshow=\"e677992\" data-elementor-lightbox-title=\"Barrier control, Hermetic box with ESP board\" data-e-action-hash=\"#elementor-action%3Aaction%3Dlightbox%26settings%3DeyJpZCI6MjEwMSwidXJsIjoiaHR0cHM6XC9cL2Nob2Nob2wuaW9cL3dwLWNvbnRlbnRcL3VwbG9hZHNcLzIwMjRcLzAzXC9JTUdfNjQwNi1zY2FsZWQuanBlZyIsInNsaWRlc2hvdyI6ImU2Nzc5OTIifQ%3D%3D\">\n\t\t\t\t\t<div class=\"e-gallery-image elementor-gallery-item__image\" data-thumbnail=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/03\/IMG_6406-300x225.jpeg\" data-width=\"300\" data-height=\"225\" aria-label=\"Open telecom enclosure with PCB modules, connectors and multiple wiring cables mounted on a wall.\" role=\"img\" ><\/div>\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"elementor-gallery-item__overlay\"><\/div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/a>\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\/03\/IMG_6405-scaled.jpeg\" data-elementor-open-lightbox=\"yes\" data-elementor-lightbox-slideshow=\"e677992\" data-elementor-lightbox-title=\"Barrier control, Hermetic box\" data-e-action-hash=\"#elementor-action%3Aaction%3Dlightbox%26settings%3DeyJpZCI6MjA5OSwidXJsIjoiaHR0cHM6XC9cL2Nob2Nob2wuaW9cL3dwLWNvbnRlbnRcL3VwbG9hZHNcLzIwMjRcLzAzXC9JTUdfNjQwNS1zY2FsZWQuanBlZyIsInNsaWRlc2hvdyI6ImU2Nzc5OTIifQ%3D%3D\">\n\t\t\t\t\t<div class=\"e-gallery-image elementor-gallery-item__image\" data-thumbnail=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/03\/IMG_6405-300x225.jpeg\" data-width=\"300\" data-height=\"225\" aria-label=\"Wall-mounted enclosure with conduit cables and a small network device plugged into a socket\" role=\"img\" ><\/div>\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"elementor-gallery-item__overlay\"><\/div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/a>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-6d90c3b elementor-widget elementor-widget-text-editor\" data-id=\"6d90c3b\" 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 &#8211; 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&#8217;s 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 6 &#8211; Adding a device to Home Assistant<\/h2><ul><li>In the Home Assistant notification section, you should see that our home automation server has detected a new device,<\/li><li>Go to <strong>Settings<\/strong>, then to <strong>Integrations and Devices<\/strong>.<\/li><li>The new device will bear a blue border. <strong>We approve the new device for integration<\/strong>.<\/li><li><strong>Set the area<\/strong> where the device will be located. In our case, it will be the <strong>Loggia<\/strong>.<\/li><li><strong>Congratulations! <\/strong> You have reached this stage, which means that you have successfully gone through the configuration process. To check the operation of your new device, you can directly go to it and control the sensor parameters from the Home Assistant. \ud83d\ude80<\/li><\/ul><p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-20582\" src=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/Screenshot-2024-04-23-at-19.15.14.png\" alt=\"Home Assistant - BME280 sensor via ESPHome\" width=\"330\" height=\"269\" srcset=\"https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/Screenshot-2024-04-23-at-19.15.14.png 330w, https:\/\/chochol.io\/wp-content\/uploads\/2024\/04\/Screenshot-2024-04-23-at-19.15.14-300x245.png 300w\" sizes=\"(max-width: 330px) 100vw, 330px\" \/><\/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><\/ul><h2>Read also<\/h2><ul><li><a href=\"https:\/\/chochol.io\/en\/computer-networking\/nginx-proxy-cloudflare-how-to-restore-a-real-ip-address\/\">Nginx Proxy &amp; Cloudflare: How to restore a real IP address<\/a>. Discover how to restore users&#8217; real IP addresses in server logs using Nginx Proxy Manager and Cloudflare as reverse proxy.<\/li><li><a href=\"https:\/\/chochol.io\/en\/hardware\/tvheadend-satip-decoder-installation-and-configuration\/\">TVHeadend: SAT&gt;IP decoder installation and configuration<\/a>. Telestar Digibit Twin: Discover the step-by-step configuration of a SAT&gt;IP decoder with TVHeadend in Docker Compose in blog post.<\/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>. Step-by-step guide on how to configure Leox LXT-010S-H GPON ONT module on Mikrotik RB5009 router, instead of 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 device from Ubiquiti UniFi from another network to Network Application &#8211; using Mikrotik&#8217;s 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>. UniFi Controller: Discover step-by-step how to successfully migrate to 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>. Discover the secrets of installing and configuring your own ADS-B antenna on a Raspberry Pi. Develop skills and 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>. Step-by-step guide: Installing Traccar on Synology using Docker. 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>Create a simple weather station with ESPHome and Home Assistant. With this tutorial, you will build a system with the BME280 sensor.<\/p>\n","protected":false},"author":1,"featured_media":20567,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[86],"tags":[136,138,139,135,141],"class_list":["post-20588","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\/20588","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=20588"}],"version-history":[{"count":0,"href":"https:\/\/chochol.io\/en\/wp-json\/wp\/v2\/posts\/20588\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/chochol.io\/en\/wp-json\/wp\/v2\/media\/20567"}],"wp:attachment":[{"href":"https:\/\/chochol.io\/en\/wp-json\/wp\/v2\/media?parent=20588"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chochol.io\/en\/wp-json\/wp\/v2\/categories?post=20588"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chochol.io\/en\/wp-json\/wp\/v2\/tags?post=20588"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}