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 are delivered with it, ready for use. They do not require additional installation or updating from us - they are updated together with the system. A list of all currently available official integrations can be found at:

https://www.home-assistant.io/integrations/

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.

Photo: Banggood

2020-01-26 13_30_24-sonoff t4eu1c

Test configuration:

  • Home Assistant 0.103.6,
  • Hass.io system (Raspberry Pi 2 B),
  • Samba share 9.0 or Configurator 4.2

Required equipment:

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

Sonoff integration

The integration page we will be using can be found here:

https://github.com/peterbuga/HASS-sonoff-ewelink

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:

https://github.com/peterbuga/HASS-sonoff-ewelink

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 one more inside - sonoff.

To this folder:

HASSIO \\ \ config \ custom_components \ sonoff \

copy the files from the previously unpacked archive "HASS-sonoff-ewelink-master.zip".

3. Optional - Check the device's local IP address

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:

192.168.0.1

You can often see the device line by name.

Comments:

  • In UPC "Connect Box" routers, first ask the hotline to upload 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:

Enter:

Development tools -> STATES

Devices added in this Home Assistant integration will have “sonoff_” in the beginning by default (unless otherwise specified in configuration.yaml). Therefore, 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 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'

Picture: inDomus.it


A fascinator of new technologies whose ideas simply never end! He is constantly discovering new equipment to test, designs smart solutions and builds them himself. An orchestra man who also dances great! Ps. he discovered how to communicate with the Chinese alarm clock, so respect;)

Polish group Smart Home by SmartMe

Polish group Xiaomi by SmartMe

SmartMe promotions

Related posts