After creating a new IoT device in 2Smart Cloud (in our example, a smart Wi-Fi relay), testing the prototype, and assembling the device on the Printed circuit board, you have a complete product! The relay is controlled via the mobile app, voice commands in Google and Apple ecosystems, a Telegram bot, and phone calls. The first series of the device has been installed by several users who are fully satisfied with the functionality and user-friendliness.
However, the ESPHome-based device firmware has some limitations, with the main one being unable to update the firmware over the air. To install a new firmware version, each device must be connected to the computer via a USB cable, which can sometimes be inconvenient.
The perfect solution was using the 2Smart Cloud platform SDK development kit. With its help, you can write custom firmware. With the ability to update the entire series of devices over the air, SDK provides extra features like a built-in web interface with device settings, sending notifications about the device’s status, and many more. Thanks to the SDK, all of this is available “out of the box” immediately after installing the device’s firmware.
A notable advantage of the SDK is that it already contains the essential functions of a standard device. The developer needs to get a suitable, ready-made example code and use it for their device based on the tutorial. This will help describe the business logic of the device’s operation. When doing this, there is no need to understand the 2Smart Cloud IoT platform’s mechanics.
The Custom firmware is already written for the Wi-Fi relay, and you can find the code on GitHub. Changes needed are minimal; one needs to add product-specific parameters to the code.
Because the firmware base is completely changing (we worked with ESPHome before), we can’t edit the existing product on the platform. We have to prepare a new product based on Custom firmware.
After filling in all the fields, click Save.
To configure notifications, consider creating a Notifications tab and add the following widgets to it:
And that’s it. You installed the Custom firmware on the same device where ESPHome was installed. After ensuring that the Wi-Fi relay works smoothly and is controlled from the mobile app, you can reflash the whole batch of devices. This will be the last firmware update via USB cable. Thanks to the use of SDK-based Custom firmware, the following updates will happen over the air.
The article that follows explains how firmware updates are prepared and how the update is done over the air.