{"id":158745,"date":"2025-03-06T10:19:26","date_gmt":"2025-03-06T04:49:26","guid":{"rendered":"https:\/\/www.electronicsforu.com\/?p=158745"},"modified":"2025-05-02T15:47:18","modified_gmt":"2025-05-02T10:17:18","slug":"esphome-automation-transform-esp32-and-esp8266-into-smart-home-devices","status":"publish","type":"post","link":"https:\/\/www.electronicsforu.com\/electronics-projects\/esphome-automation-transform-esp32-and-esp8266-into-smart-home-devices","title":{"rendered":"ESPHome Automation &#8211; Transform ESP32 and ESP8266 into Smart Home Devices"},"content":{"rendered":"<div class=\"wp-block-image\">\n<figure class=\"alignright size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"178\" height=\"163\" src=\"https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2024\/07\/efy-tested-1.jpg\" alt=\"\" class=\"wp-image-143513\"\/><\/figure><\/div>\n\n\n<p>ESPHome is an open source system for macOS, Linux, and Windows, comprising two primary components: Bluetooth proxy for Bluetooth low energy (BLE) sensor integration and ESPHome Automation for Wi-Fi-based smart home devices.<\/p>\n\n\n\n<p>It supports microcontrollers like ESP32, ESP32-S2\/S3\/C3, ESP8266, and the Raspberry Pi Pico W, though the Bluetooth Proxy feature is exclusive to <a href=\"https:\/\/www.electronicsforu.com\/technology-trends\/esp32\">ESP32<\/a>. The Pi Pico W currently faces limitations, as it is not displayed on the ESPHome dashboard or the browser.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">POC Video Tutorial<\/h2>\n\n\n\n<figure class=\"wp-block-embed aligncenter is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<span class=\"ELJqMCwnPzoXepxWb4ZcYaRmQt5FVvdgT7rl2I3usKy9DASk10HhiO6GfB8j\"><iframe loading=\"lazy\" title=\"ESPHome Automation \u2013 Transform ESP32 and ESP8266 into Smart Home Devices | Electronics For You\" width=\"696\" height=\"392\" src=\"https:\/\/www.youtube.com\/embed\/plhWZjbXHOg?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/span>\n<\/div><\/figure>\n\n\n\n<p>This system turns microcontrollers into efficient home automation tools, enabling simple sensor and actuator connections with minimal programming. Through an intranet browser, users can control LED brightness, toggle switches, manage buzzers, monitor gas sensors like MQ135, and share data globally via MQTT.<\/p>\n\n\n\n<p>This is automation at its core\u2014streamlining control and monitoring for a more intelligent home. The best part is that setting up the ESP32 or ESP8266 is straightforward.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td colspan=\"2\"><strong>Bill of Materials<\/strong><\/td><\/tr><tr><td><strong>Components<\/strong><\/td><td><strong>Quantity<\/strong><\/td><\/tr><tr><td>ESP32 development board (MOD1)<\/td><td>1<\/td><\/tr><tr><td>DHT22 sensor (S2)<\/td><td>1<\/td><\/tr><tr><td>ATH10 sensor (S1)<\/td><td>1<\/td><\/tr><tr><td>Power supply: 5V regulated DC<\/td><td>1<\/td><\/tr><tr><td>Resistor: 220\u03a9 (R1, R2)<\/td><td>2<\/td><\/tr><tr><td>Resistor: 4.7k\u03a9 (R3)<\/td><td>1<\/td><\/tr><tr><td>LED1, LED2<\/td><td>2<\/td><\/tr><tr><td>MQ135 sensor (optional)<\/td><td>1<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Bluetooth Proxy<\/strong><\/h2>\n\n\n\n<p>Bluetooth devices have been part of daily life for years, yet integrating them into home automation has always been challenging. This is one reason Zigbee has remained a preferred choice. However, ESPHome Automation introduces an effective alternative.<\/p>\n\n\n\n<p>Nearby BLE devices automatically connect by setting up an ESP32 as a Bluetooth proxy. The data from these devices becomes visible on the ESPHome dashboard under the \u2018ESPHome Bluetooth Proxy\u2019 device.<\/p>\n\n\n\n<p>It is important to note that the ESPHome Bluetooth Proxy is not designed to connect directly to mobile phones or appear in a phone\u2019s Bluetooth settings like a standard Bluetooth device. Instead, it bridges Home Assistant and nearby BLE devices, such as temperature sensors, smart bulbs, fitness bands, or other smart home peripherals.<\/p>\n\n\n\n<p>In Bluetooth proxy mode, the ESP32 does not advertise itself as a connectable device (e.g., a speaker or keyboard). Instead, it listens to nearby BLE devices and silently forwards the data to the Home Assistant. There are no notifications or pairing prompts. <\/p>\n\n\n\n<p>You need to check the logs to confirm that it is working\u2014it will notify you when it \u2018finds a new device.\u2019 The simplicity and power of this silent integration make Bluetooth proxy a revolutionary feature in home automation.<\/p>\n\n\n\n<p>The components required for the automation system are listed in Table 1. The author\u2019s prototype, built on a breadboard, is shown in Fig. 1, where the ESP32 controls LEDs through PWM.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"450\" src=\"https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2025\/03\/Authors-prototype-2.jpg\" alt=\"\" class=\"wp-image-158750\" srcset=\"https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2025\/03\/Authors-prototype-2.jpg 800w, https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2025\/03\/Authors-prototype-2-500x281.jpg 500w, https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2025\/03\/Authors-prototype-2-747x420.jpg 747w, https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2025\/03\/Authors-prototype-2-696x392.jpg 696w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><figcaption class=\"wp-element-caption\">Fig. 1: Author\u2019s prototype of ESPHome Automation<\/figcaption><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\"><strong>Installation Guide<\/strong><\/h2>\n\n\n\n<p>Follow this installation guide to run the automation system using ESPHome on Windows, macOS, or Linux. ESPHome Automation is primarily a Python package installed via pip.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Prerequisites<\/strong><\/h3>\n\n\n\n<p><em><strong> <\/strong><\/em>Ensure Python (version 3.7 or higher) is installed on the system. Verify it using:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ python --version<\/code><\/pre>\n\n\n\n<p>To install ESPHome via pip, open a terminal and run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ pip install esphome<\/code><\/pre>\n\n\n\n<p>Verify the installation:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ esphome version<\/code><\/pre>\n\n\n\n<p>Version: 2024.10.3 (confirms ESPHome is installed.)<\/p>\n\n\n\n<p>Optional: Install the ESPHome dashboard<\/p>\n\n\n\n<p>(Note: As of the latest version, the ESPhome dashboard is included with ESPHome and does not require separate installation.)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ pip install esphome-dashboard<\/code><\/pre>\n\n\n\n<p># Only if needed for older versions<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Prepare a working directory<\/strong><\/h3>\n\n\n\n<p>Create a directory where all ESPHome YAML files will reside:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ mkdir \/Users\/somnathbera\/esphome\n$ cd \/Users\/somnathbera\/esphome<\/code><\/pre>\n\n\n\n<p>The message appears on the screen: \u2018Navigate to the directory.\u2019<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Create and compile the YAML configuration.<\/strong><\/h3>\n\n\n\n<p>\u2022 To create a blank YAML file for your device:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ esphome wizard my_device.yaml<\/code><\/pre>\n\n\n\n<p>\u2022 To compile and upload the YAML file to your device:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ esphome run my_device.yaml<\/code><\/pre>\n\n\n\n<p>The message appears on the screen: \u2018Keep your device connected to the serial port\u2019<\/p>\n\n\n\n<p>Tip: The ESPHome dashboard can be used instead of the terminal for those who prefer a graphical interface.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Using ESPHome dashboard (GUI)<\/strong><\/h3>\n\n\n\n<p>To start the ESPHome Dashboard, run:<\/p>\n\n\n\n<div class=\"mepr_error\"><div class=\"locked-content\">\n<b>EFY++ CONTENT: ACCESS TO THIS CONTENT IS FREE! BUT YOU NEED TO BE A REGISTERED USER.<\/b><\/p>\n<p>Oops! This is an EFY++ article, which means it's our Premium Content. You need to be a Registered User of our website to read its complete content.<\/p>\n<p><b>Good News: <\/b>You can register to our website for FREE! <a href=\"https:\/\/www.electronicsforu.com\/plans\/subscription-plans\" target=\"_blank\" rel=\"noopener\">CLICK HERE<\/a> to register now.<\/p>\n<p><b>Already a registered member? <\/b>If YES, then simply login to you account below. (TIP: Use 'forgot password' feature and reset and save your new password in your browser, if you forgot the last one!)\n<\/div>\n<\/div><div>\n<div class=\"mp_wrapper mp_login_form\">\n                  <!-- mp-login-form-start -->     <form name=\"mepr_loginform\" id=\"mepr_loginform\" class=\"mepr-form\" action=\"https:\/\/www.electronicsforu.com\/login\" method=\"post\">\n            <div class=\"mp-form-row mepr_username\">\n        <div class=\"mp-form-label\">\n                              <label for=\"user_login\">Username<\/label>\n        <\/div>\n        <input type=\"text\" name=\"log\" id=\"user_login\" value=\"\" \/>\n      <\/div>\n      <div class=\"mp-form-row mepr_password\">\n        <div class=\"mp-form-label\">\n          <label for=\"user_pass\">Password<\/label>\n          <div class=\"mp-hide-pw\">\n            <input type=\"password\" name=\"pwd\" id=\"user_pass\" value=\"\" \/>\n            <button type=\"button\" class=\"button mp-hide-pw hide-if-no-js\" data-toggle=\"0\" aria-label=\"Show password\">\n              <span class=\"dashicons dashicons-visibility\" aria-hidden=\"true\"><\/span>\n            <\/button>\n          <\/div>\n        <\/div>\n      <\/div>\n            <div>\n        <label><input name=\"rememberme\" type=\"checkbox\" id=\"rememberme\" value=\"forever\" \/> Remember Me<\/label>\n      <\/div>\n      <div class=\"mp-spacer\">&nbsp;<\/div>\n      <div class=\"submit\">\n        <input type=\"submit\" name=\"wp-submit\" id=\"wp-submit\" class=\"button-primary mepr-share-button \" value=\"Log In\" \/>\n        <input type=\"hidden\" name=\"redirect_to\" value=\"\/wp-json\/wp\/v2\/posts\/158745\" \/>\n        <input type=\"hidden\" name=\"mepr_process_login_form\" value=\"true\" \/>\n        <input type=\"hidden\" name=\"mepr_is_login_page\" value=\"false\" \/>\n      <\/div>\n    <\/form>\n    <div class=\"mp-spacer\">&nbsp;<\/div>\n    <div class=\"mepr-login-actions\">\n      <a href=\"https:\/\/www.electronicsforu.com\/login?action=forgot_password\">Forgot Password<\/a>\n    <\/div>\n\n      \n    <!-- mp-login-form-end --> \n  <\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>ESPHome is an open source system for macOS, Linux, and Windows, comprising two primary components: Bluetooth proxy for Bluetooth low energy (BLE) sensor integration and ESPHome Automation for Wi-Fi-based smart home devices. It supports microcontrollers like ESP32, ESP32-S2\/S3\/C3, ESP8266, and the Raspberry Pi Pico W, though the Bluetooth Proxy feature is exclusive to ESP32. The [&hellip;]<\/p>\n","protected":false},"author":116810,"featured_media":158750,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22,23,3713,6189],"tags":[1985,1911,110,12656],"class_list":{"0":"post-158745","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-electronics-projects","8":"category-hardware-diy","9":"category-premium","10":"category-esp32-projects","11":"tag-diy-projects","12":"tag-do-it-yourself","13":"tag-electronics-projects","14":"tag-march-2025"},"_links":{"self":[{"href":"https:\/\/www.electronicsforu.com\/wp-json\/wp\/v2\/posts\/158745","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.electronicsforu.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.electronicsforu.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.electronicsforu.com\/wp-json\/wp\/v2\/users\/116810"}],"replies":[{"embeddable":true,"href":"https:\/\/www.electronicsforu.com\/wp-json\/wp\/v2\/comments?post=158745"}],"version-history":[{"count":3,"href":"https:\/\/www.electronicsforu.com\/wp-json\/wp\/v2\/posts\/158745\/revisions"}],"predecessor-version":[{"id":162553,"href":"https:\/\/www.electronicsforu.com\/wp-json\/wp\/v2\/posts\/158745\/revisions\/162553"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.electronicsforu.com\/wp-json\/wp\/v2\/media\/158750"}],"wp:attachment":[{"href":"https:\/\/www.electronicsforu.com\/wp-json\/wp\/v2\/media?parent=158745"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.electronicsforu.com\/wp-json\/wp\/v2\/categories?post=158745"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.electronicsforu.com\/wp-json\/wp\/v2\/tags?post=158745"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}