In the article I will present the process of adding unofficial integration (Custom Component) to Home Assistant on the example of integration using eWeLink cloud services, and as a result allowing us to control Sonoff devices without changing their firmware.
We have recently shown how to use the built-in IKEA Tradfri Integration. Today we will show you how to install unofficial Integrations.
Home Assistant has a lot of official Integrations that come with it, ready to use. They do not require additional installation and updating from us - they are updated along with the system. The list of all currently available official integrations can be found at:
Despite such a large collection (currently 1540 extensions), due to the pace of development of the IoT world, there is a need to create further integrations within Home Assistant, not only to support subsequent devices, but also related to the use of various internet services, algorithms, automation, etc. new, unofficial integrations, written by the Home Assistant community. They are called Custom Components. Most often their repositories and instructions are on the GitHub portal.
Unofficial integrations are placed in the directory:
\\ local \ config \ custom_components
where local, is the home directory of Home Assistant. We must take care of our Custom Component updates.
Below I will present the process of adding unofficial integration to Home Assistant on the example of integration using eWeLink cloud services, and as a result allowing us to control Sonoff devices without changing their firmware. I have added Sonoff T4EU1C switch (without Neutral cable) to eWeLink application.
- Home Assistant 0.103.6,
- Hass.io system (Raspberry Pi 2 B),
- Samba share 9.0 or Configurator 4.2
- Depending on the specific Custom Component, in our case it will be one of the Sonoff switches (TX T4EU1C model) added to the original eWeLink application.
Level of advancement:
- Basic knowledge of Home Assistant is required.
The integration page we will be using can be found here:
We will download the necessary files from it and find installation instructions, as well as a list of supported Sonoff devices.
Because it is an integration with the eWeLink service, for it to make sense, you must first create an account in the eWeLink application and add a device to it.
1. Download custom component "HASS-sonoff-ewelink"
We go to the website:
and download the .zip archive with the necessary files. Then unpack the archive to disk.
2. Copying files
We make sure that we have installed and configured the add-on Samba share.
We enter the file explorer to the following address:
HASSIO \\ \ config \
HASSIO is the name of the Home Assistant network location that we set up in the configuration Samba share (default is HASSIO). We are creating a new folder named there custom_componentsand inside it one more - sonoff.
To this folder:
HASSIO \\ \ config \ custom_components \ sonoff \
copy files from the previously unpacked archive "HASS-sonoff-ewelink-master.zip".
3. Optional - Checking the local IP address of the device
Sonoff's Custom Component works on the principle of using internet services provided by the cloud. In this case this point is unnecessary.
It happens, however, that the integration (official or not) connects directly via WiFi to the device in our local network. It is then required to know the IP address of this device and it is recommended to assign this address permanently in our router. In this case, read this point.
We check the local IP address of the selected device supported by Home Assistant in the router. The router's website is usually located at:
You can often see the device line by name.
- In UPC's "Connect Box" routers, first ask the hotline to download the IPv4 protocol remotely instead of the default IPv6. Without it, you will not find the appropriate item in the router's menu.
4. Modification configuration.yaml
Most often on the GitHub website with selected integration there is a manual in which the author describes in detail the section that should be added to the configuration file. This section should be added to activate previously loaded integration.
Plik configuration.yaml can be modified, among others using an add-on Samba share and Configurator. W Samba share we have directly available file, while in Configurator, files are edited indirectly through the Home Assistant user interface. I usually use for this purpose Configurator.
Option 1 - Samba share
After installing the plugin, the file "configuration.yaml" should be in the folder:
HASSIO \\ \ config \
Option 2 - Configurator
After installing the add-on, in its settings it is enough to select "Show in sidebar" to have easy access to it from the menu Home Assistant. In addition, we select the configuration file, modify it in accordance with the rest of the instructions, and save.
To activate Sonoff integration, add the following section to the configuration file:
sonoff: username: [Username from eWeLink application] password: [Password from eWeLink application] scan_interval: 60 grace_period: 600 api_region: 'eu' entity_prefix: True debug: False
Not all lines of the section are required, a detailed description can be found on the integration page. Now save the file and restart your Home Assistant.
5. Preview of added Sonoff devices
After restarting Home Assistant, compatible Sonoff devices should now be available in Entities:
Developer tools -> STATES
Devices added in this Home Assistant integration will have “sonoff_” in the beginning by default (unless otherwise specified in configuration.yaml). Therefore, in order to preview them, it is enough in the field entity start typing "sonoff".
6. Adding card in Home Assistant
In the main menu "Overview", using the built-in wizard or by manually editing the file, we can add the Sonoff switch card.
To get the card as shown in the picture, in the file under the "views:" section, add the section:
views: - title: Salon panel: true path: salon_view cards: - type: entities title: Switches show_header_toggle: false entities: - entity: switch.sonoff_1000a68535 icon: mdi: light-switch name: 'Switch'