IoT Worlds
2smart esphome
Smart DeviceSmart HomeSmart Hospitality

Meet reality: ESPHome without Wi-Fi parameters in the firmware

A well-known disadvantage of ESPHome is that the Wi-Fi parameters (SSID and password) need to be embedded directly into the firmware code. This is convenient if the device is designed for personal use, it will automatically connect to the internet the first time you turn it on. 

However, difficulties occur when attempting to mass-produce devices and make them available to the public. There is a workaround for this issue: the 2Smart Cloud IoT platform enables the creation of ESPHome firmware without requiring end-user Wi-Fi parameters. When the device is turned on for the first time, the data is transmitted from the mobile application; it may also be altered without flashing if the Wi-Fi settings have changed. See how it is carried out.

How 2Smart Cloud works with ESPHome

The 2Smart Cloud platform enables you to retain the primary benefit of ESPHome — the simplicity of creating firmware. You can describe the device’s logic following the ESPHome documentation or using pre-made examples. This is possible even if you have no prior knowledge of programming.

There is no need to install firmware builders on your computer; the code is entered directly into a special window in the developer’s office.  The finished firmware is assembled on platform servers, and the developer receives an archive with instructions for installing the firmware on the device.

Due to this solution, everything required to integrate the device into the platform is automatically incorporated into the code.

When it comes to Wi-Fi parameters, they are only indicated in the firmware of the test device the prototype with which the developer is dealing. This is a well-thought-out decision: the prototype should be connected to the Internet immediately once the firmware is installed so that the work on the device can continue as soon as feasible.

After evaluating the prototype, a production firmware without Wi-Fi parameters is created. It is installed on the entire batch of final devices. The end-user transmits Wi-Fi parameters while connecting a device with a mobile application.

Pairing a device with ESPHome-based firmware with a mobile application

The pairing procedure in 2Smart Cloud is standard for smart devices in any ecosystem:

  • the user specifies the parameters of the Wi-Fi network in the mobile application;
Pairing the device with a mobile application
  • the mobile device connects to a Wi-Fi access point, which the device opens when first launched;
Pairing the device with a mobile application
  • the device and the mobile application exchange data, which includes the transmission of Wi-Fi parameters;
Pairing the device with a mobile application

The same procedure applies if the IoT device’s firmware is created with other tools, such as SDK 2Smart Cloud. As a result, ESPHome can be compared to professional developer tools and used to create commercial products, among other things.

Resetting settings without flashing

The customized ESPHome software, which is built on the 2Smart Cloud platform, enables the device to be reset to its factory settings without flashing. Resetting the settings restarts the Wi-Fi hotspot and prepares it to be paired with the mobile application.

This option is available in the following cases:

  • the device has been transferred to the new owner;
  • the owner is the same, but the Wi-Fi settings have changed (for example, a new router was bought);
  • the owner mistakenly passed the parameters of a Wi-Fi network with a frequency band of 5 GHz, which is not supported by the ESP32; instead, the network with a 2.4 GHz band should be specified.

Resetting the parameters is technically accomplished by enhancing the capabilities of the regular GPIO platform component. To reset the smartphone to its factory settings, the user should press and hold the physical Reset button on the device for three seconds.

Resetting blinker, the simplest device on the ESP32 

Here’s an example of ESPHome code for a basic device (blinker) with a Reset button:


      – platform: reset_sensor


          number: GPIO0

          mode: INPUT_PULLUP

          inverted: true

        name: Reset button


          – delayed_on: 1s


      – platform: gpio

        id: l2

        name: GPIO2


          number: GPIO2


      – platform: wifi_signal

        name: WiFi1 Signal

        update_interval: 30s

        id: wifi_config

Details on how to use ESPHome with 2Smart Cloud can be found in the ESPHome documentation on GitHub.

Related Articles

WP Radio
WP Radio