ESPHome - working from the command line
Install the python3-pip package (if not installed):
sudo apt install python3-pip
It is recommended to install ESPHome in the user’s home directory. To install ESPHome just execute the command:
pip3 install --user esphome
The ESPHome project will be installed in the directory
You must add the path to the executable files ESPHome to the environment variable
To avoid setting the environment variable
$PATH every time you reboot your computer, run
echo 'export PATH=$PATH:$HOME/.local/bin' >> $HOME/.bashrc
Creating configuration files
To build ESPHome projects, create a separate directory in which to build the firmware, for example:
mkdir ~/esphome cd ~/esphome
You can use a step-by-step command to create a new configuration file, for example:
esphome e1-test.yaml wizard
nodemcu-32s as the platform name for the controllers JetHub E1 . After executing this command the configuration file
e1-test.yaml will be created which will be used to compile the firmware for the ESP32 microcontroller.
You can also create a configuration file in a text editor.
An example of a minimum ESPHome configuration file for an E1-CPU processor module:
Enter the correct
password to connect the controller to the Wi-Fi network.
esphome: name: e1-test platform: ESP32 board: nodemcu-32s wifi: ssid: "***" password: "***" # Enable fallback hotspot (captive portal) in case wifi connection fails ap: ssid: "E1-Test Fallback Hotspot" password: "wDZE2YhcmW89" captive_portal: # Enable logging logger: # Enable Home Assistant API api: ota:
This example will configure the connection of the controller via Wi-Fi (section
wifi), integration with Home Assistant (section
api) and configured the firmware update over the network (section
name field in the
esphome section. It specifies the name of the controller, is displayed on the network, and must be unique.
In this example, the controller name is
Connect the controller with a MicroUSB cable to the computer before flashing.
Assembly and firmware can be done with a single command:
esphome e1-test.yaml run
When flashing, the controller will automatically be put into software download mode, you do not need to press the button on the housing. When selecting the software flashing method, select the serial port that corresponds to the connected controller, e.g: Serial port
It is necessary to rebuild and write the firmware after changes have been made to the configuration file.
Possible problems during flashing
No access to the serial port
The user under which the work is done (controller firmware) must be a member of the group
To add the current user to the
dialout group run the command:
sudo usermod -a -G dialout $USER
After that, you need to log in again.
Problem on Ubuntu 22.04
On Ubuntu 22.04 there may be a problem accessing the port because of a conflict with BRLTTY (support for Braille displays).
Problem description: Unable to use USB dongle based on USB-serial converter chip.
One solution is to remove this package from the system:
sudo apt remove brltty
After that it is necessary to reboot the system.