Home Smart DeviceMeet reality: ESPHome without Wi-Fi parameters in the firmware

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

by
2smart esphome

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;
tYKMcWCT6 d0t43hOFwC tbqoNgFDCRDrO TkGCE89dNivLd2LfCPtakV8TdvZkfuYt9QVXq9m BA mUGBOrr
9ZqyBJnVjxujG7PEz2AcnduEPXCDeCAiCwsZPLrnNUIcbp9bMIzvfR08DD1RXQrvqv94EW7kbgvSCjIbv0h9ogFn3RiJq148qRoB JkbDbN3xWIr5chY9t4d7GXHbfP3QtfcekBfB1n7Q8a j3XDaQ
Pairing the device with a mobile application
  • the mobile device connects to a Wi-Fi access point, which the device opens when first launched;
ClUWsDTQJlbV4aa7KclJsqGsrEGDTRSqNoAEym3Q2U8lI7ZR88jK2 KmFiyXcx8Tn13Xl4Ot3RmcdzjqQMdrB IuVeFWENti0RFETYQZ89RHYLcRn9 F8J8UQAhWlimplAgCaM1QrGhAmpDmneYEmg
AEE2DO8FXUstbyarEqKFvpmQ7GZaD 57ZhM7UYqN5CLOs vG wUn8maMlNXOuHCtiXaGLGjNAt2PJCX4m CCbFTUzaJTwwLulD9OzJuiNlQJc2Jqy1X6C1bYHYB2ilbCLuA4vyHwFWg0kMNDImILpw
Pairing the device with a mobile application
  • the device and the mobile application exchange data, which includes the transmission of Wi-Fi parameters;
AkTGcZbhJx0ZXXYdJc0XhXR oIpP0ne2FK9KWyjkmzUKiT7qCMn6jN8y9AnhAlAl 7lySfZzi7aIntsgaDjE0jnx4iLLlxZMVXurpjnKcq4Fejx17dBEibe Cv0c qLbMbOjrmtMLTaAYI3R Z3btA
Pal 4RjLUKXo4c4ImnFPVvVLjrHvP0V9HPWqdEBGdRLymQUldSGbKPpzy
Pairing the device with a mobile application
F3Z6TwsO9ATHY9 mB0ODOsBsdmo6 baAwuwE2ez7hDzeJQYnzxm2G0FMaPNU0FWVnZ4Uh0byAMN pPRQJisHWin2ixPlYxt

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:

  binary_sensor:

      – platform: reset_sensor

        pin:

          number: GPIO0

          mode: INPUT_PULLUP

          inverted: true

        name: Reset button

        filters:

          – delayed_on: 1s

    switch:

      – platform: gpio

        id: l2

        name: GPIO2

        pin:

          number: GPIO2

    sensor:

      – 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.


You may also like