Integrate ITEAD Sonoff with original firmware a Home Assistant

3 minutes of reading
PURPOSES OF THE GUIDE:
CONCEPTS FACED:
  • Software configuration
SOFTWARE COMPONENTS USED:
Prerequisites:
PHYSICAL DEVICES USED:
  • Il Raspberry Pi on which it resides Home Assistant
  • an Android or smartphone / tablet Appthe iOS
  • The ITEAD element to be integrated
GUIDE more indicated for:

All environments

Notes and disclaimer
  • qualsiasi modifica all'impianto elettrico dev'essere progettata ed effettuata da personale qualificato;
  • any changes implemented in probefore is a propersonal responsibility as well as a profirst risk and danger (the contents of the present page are purely educational);
  • any changes implemented in proprior to a device it voids the guarantee, quality approvals and certifications.
Driving review: 1.3

Abstract

As is known, the most consolidated practice is to equip the components based on SOC ESP8266 (how, for theappgreasy, most ITEADs) di alternative firmware useful to provide the user with greater freedom of configuration and a certain integration (usually via MQTT) with any personale HUB and similar. If you don't want to deal with it la proreimbursement orderprofirmware weight, you can use this component, always keeping in mind that:

  • integration is guaranteed based to the compatibility matrix (model / version binomial of the original firmware);
  • the integration, when functioning, does not always guarantee the use of all the features of the integrated device (eg. the Sonoff POW R2 with 3.3.x firmware);
  • the integration uses the ITEAD cloud as a means, therefore in the absence of internet connection, integration stop working.

The integration, as mentioned, uses the ITEAD cloud: in practice the component Sonoff connects to it through the previous configuration of the usual app mobile eWeLink (used to configure and manage family members Sonoff) is Home Assistant, through "HASS-sonoff-ewelink " whatever, authenticating to the cloud with the same credentials as theapp eWeLink: this "bridge" connection will therefore allow theHUB to "see" the Sonoff and then to integrate it.

It starts

Verifications propedeutiche

Before venturing into integration via original firmware is necessary appurare:

  • to have the accessory to be integrated already configured at theapp eWeLink;
  • to verify that the accessory / original firmware version (verifiable through app eWeLink) is included among those that can be integrated by consulting the compatibility matrix.

Failure to comply with these points will make integration in these modes impossible.

Component installation

La procedura plans to download from GoHub the .zip file containing the component, unzip it and copy the folder “sonoff"Contained within it"custom_components"In turn contained within what it usually preserves the configuration files of Home Assistant (if it does not exist, create it).

This folder usually corresponds to:

  • if installed as applicense on Raspbian, to the folder “/home/homeassistant/.homeassistant";
  • su HASSIO, to the folder "/ Config /"

To copy the folder "sonoff"We recommend using sFTP (perhaps using the client Filezilla), which is operational in the presence of the SSH service. To install SSH on HASSIO, refer to to this guide.

From 0.101.x onwards

From the 0.101.x version of Home Assistant then it became necessary:

  • remove the line "REQUIREMENTS"Present in the file __init__.py
  • add a file called sonoff.json containing the following code:
{
  "domain": "sonoff",
  "name": "Sonoff / eWeLink",
  "documentation": "https://github.com/peterbuga/HASS-sonoff-ewelink",
  "dependencies": [],
  "codeowners": ["@peterbuga"],
  "requirements": ["uuid", "websocket-client==0.54.0"]
}

Finally: in case of of Home Assistant installed as applicativo on Raspbian, take care to run the following command to fix the permissions on the file system:

sudo chmod -R 0777  /home/home/.homeassistant

Configuration Home Assistant

First, make sure you have it WebSocket installed on the server.
In case you use Home Assistant installed as applicense on Raspbian, the commands are as follows:

sudo systemctl stop home-assistant@homeassistant.service
sudo -u homeassistant -H -s
source /srv/homeassistant/bin/activate
pip3 install websocket-client
exit
sudo systemctl start home-assistant@homeassistant.servic

At this point it is possible to vary the configuration of Home Assistant in order to add you the following block:

sonoff:
  username: [email o numero telefonico]
  password: [password]
  scan_interval: 60
  grace_period: 600
  api_region: 'eu'
  entity_prefix: True
  debug: False

Explanation of the fields:

FieldValue
sonoff:(Required) Identifies the configuration block related to the component "HASS-sonoff-ewelink"
username(String, mandatory) Proyour username at the ITEAD cloud.
password(String, mandatory) Proyour password at the ITEAD cloud.
scan_interval(Integer, optional) Number of seconds between an updatenamento and the other. 60 minimum.
grace_period(Integer, optional) Since it is not possible to connect with proyour account from more than one client at a time, in case you log on app Home Assistant it is automatically disconnected: this value indicates how many seconds Home Assistant he must not try to log in again.
api_region(String, optional) Indicates the continent from which to connect. The default is "eu"; other possible values ​​are "us","as" and "cn"
entity_prefix(Boolean, optional) If set to "true"Delete the prefix"sonoff_”From the name of entity generated on Home Assistant through integration.
debug(Boolean, optional) If set to "true"Enable debug mode. More info on debug mode are available here.

After successful configuration, restart Home Assistant.

Use

At this point, nothing else is needed that start using entities that will have been generated by the component, typically of type "Switch" and "Sensor"

Home Assistant Switch
an example of a switch.

A possible, subsequent addition of actuators and sensors to theapp eWeLink (always compatible with the compatibility matrix) will automatically generate, at Home Assistant, the corresponding entities.

FIRMWARE UPDATE

un'accortezza important: in case of need for updatesnameof the original firmware of one or more ITEAD components (obviously, remember to check the compatibility matrix in order not to risk losing the possibility of integrating it with Home Assistant), first remember to stop Home Assistant, he is alone after the updatednamento firmware provvedere to restart it.


Home Assistant Official LogoATTENZIONE: remember that there is on our FORUM community an ad hoc section dedicated to Home Assistant, for any doubt, question, information on the specific merit of these components.


telegram

Stay up to date through ours Telegram channel!