{"id":1970,"date":"2022-06-27T17:49:00","date_gmt":"2022-06-27T22:49:00","guid":{"rendered":"https:\/\/lab.rapternet.us\/?p=1970"},"modified":"2022-04-16T17:52:13","modified_gmt":"2022-04-16T22:52:13","slug":"renaming-esp-devices-in-esphome","status":"publish","type":"post","link":"https:\/\/lab.rapternet.us\/?p=1970","title":{"rendered":"Renaming ESP Devices in ESPHome"},"content":{"rendered":"\n<p>I recently started trying out the ESPHome Add-On in home assistant. With this, I was able to add and upgrade some ESP devices, however I soon realized after adding one of them, that the auto-generated name may not be wanted (or if you&#8217;re moving a device around and want a new name). So I did some research and worked out the process for renaming the device in ESPHome.<\/p>\n\n\n\n<!--more-->\n\n\n\n<h2 class=\"wp-block-heading\">Configs<\/h2>\n\n\n\n<p>We want to start out by modifying the configuration for the ESP device. This is done through the ESPHome addon (since that allows editing and installing the new configs). We&#8217;ll start by changing the name in the config, and adding the current IP address as the &#8220;use_address&#8221; option in the config. The use address option will be removed later to allow DHCP to work correctly.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">esphome:\n  name: new_name\n  ...\n\nwifi:\n  use_address: old_name.local\n  ...<\/pre>\n\n\n\n<p>Install the new config to add the name to the device. Once its installed, remove the use_address, and install again. I also renamed the device access point name during this process.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">wifi:\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: \"new_name\"\n    password: \"long good password\"\n<\/pre>\n\n\n\n<p>Once the device is renamed and the configs are done, you then go in and change the filenames on the system for the device. This can be done using VS Code and selecting the file, hitting F2 (shortcut for editing filenames) and changing the name (making sure to follow the naming convention).<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"287\" height=\"322\" src=\"https:\/\/lab.rapternet.us\/wp-content\/uploads\/2022\/03\/image-1.png\" alt=\"\" class=\"wp-image-1910\" srcset=\"https:\/\/lab.rapternet.us\/wp-content\/uploads\/2022\/03\/image-1.png 287w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2022\/03\/image-1-267x300.png 267w\" sizes=\"auto, (max-width: 287px) 100vw, 287px\" \/><figcaption>F2 will get you the file name edit<\/figcaption><\/figure>\n\n\n\n<p>This worked, though the old name did stay showing up in ESPHome as a device that could be added. I believe this was due to using a separate PC and ESPHome web to add the device. This phantom device disappeared after a while (and a possibly a reboot). The newly renamed device stayed available in home assistant and could be integrated into automations and remotely updated using ESPHome.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Resources<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/community.home-assistant.io\/t\/esphome-change-device-name\/145936\/4\">Forums Post on the Subject<\/a><\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>I recently started trying out the ESPHome Add-On in home assistant. With this, I was able to add and upgrade some ESP devices, however I soon realized after adding one of them, that the auto-generated name may not be wanted (or if you&#8217;re moving a device around and want a new name). So I did &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/lab.rapternet.us\/?p=1970\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Renaming ESP Devices in ESPHome&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[74,39,14,49],"class_list":["post-1970","post","type-post","status-publish","format-standard","hentry","category-how-to","tag-esphome","tag-home-assistant","tag-quick-bites","tag-smart-home"],"_links":{"self":[{"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/posts\/1970","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1970"}],"version-history":[{"count":5,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/posts\/1970\/revisions"}],"predecessor-version":[{"id":1976,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/posts\/1970\/revisions\/1976"}],"wp:attachment":[{"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1970"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1970"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1970"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}