Using the "BLINK" mode (flashing) with the firmware Sonoff-Tasmota

4 minutes of reading
AIMS OF THE GUIDE
  • Learn how to use the "BLINK" (flashing) firmware mode Sonoff-Tasmota
  • Difficulty level: basso
Concepts dealt with:
  • software configuration
Software components used:
Physical devices used:
  • a home automation actuator ITEAD Sonoff Smart Home riproprogrammed Sonoff-Tasmota (here a MASTERGUIDE on proreimbursement orderproprogramming)
GUIDE best suited for:

All environments

Notes and disclaimer
  • qualsiasi eventuale modifica agli impianti domestici dev'essere progettata ed realizzata SOLO 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.
ESP8266
The ESP8266, proprocessor at the base of the devices Sonoff supported by the firmware Sonoff-Tasmota

The adoption of the firmware Sonoff-Tasmota on devices ITEAD Sonoff Smart Home enables a whole range of features that, by default, they would not be provided.

First of all, this approccio free these domotic devices from the "cage" indirectly imposed by the proditore in the exclusive use of proman app "EWeLink" to configure and control them; Furthermore, open to unexpected features (think, trivially, of the implementation of proMQTT tocollo) as well as very wide configuration possibilities, well beyond the factory ones.

The firmware Sonoff-Tasmota provides, in fact, a long list of commands which can be used to customize very punctually the behavior of the profirst device Sonoff (or in any case of compatible ESP8266 boards, eg. NodeMCU), with different specificities from model to model (eg. it will not be possible to use the controls related to temperature and humidity management on models that do not offer these features).

ITEAD Sonoff BasicOn this occasion we will concentrate on a series of commands that enable use in "BLINK“, Or the flashing mode. These commands yes applicano to all devices with firmware on board Sonoff-Tasmota and at least one relay (physical and / or logical - talk about it later), for example the puppy of the family, the Sonoff Basic.

"BLINK"Is an available modality obviously also used in abbinameto devices equipped with Tasmota and that they act as clean contact.

The switches Sonoff they are basically able, through manual intervention or timing (offered under "Configuration" / "Timer" of the firmware web interface) to open / close the output of the input current to the device (which can vary from 90v to 220v). In case of use as clean contact, are limited to open / close between them the two output contacts, without appno tension.

The functionality is therefore that of simple intelligent switch, at the most timed.

But if we needed to make the output "flash", or rhythmically open / close the output of the output voltage, or in any case the closure of the contacts (in case of clean contact)?

This could be an interesting way to encode visual signals (eg flashing of external lights the house during the alarm of a burglar alarm, or a led to report a specific state present in home automation, etc.), or to control some element that works with pulses (control units, electromechanical controls, etc.).

To achieve this scenario, they come to our aid a series of commands included in the firmware Sonoff-Tasmota.

BLINKTIME

The first command we analyze is "BLINKTIME“, Or the command that sets the firmware in a way to set the duration of the flashing.

cmnd/Sonoff/blinktime

The result expresses the duration in tenths of a second ("10" is therefore equivalent to one second).
To set the duration, the command is:

cmnd/Sonoff/blinktime X

where "X" is the duration in tenths of a second (from 2 tenths of a second to 3600 tenths of a second - or 6 minutes).

BLINKCOUNT

The "BLINKCOUNT" command expresses the (integer) number of flashing iterations.

To verify the setting, the command is:

cmnd/Sonoff/blinkcount

The result expresses the number of iterations when the flashing is activated.

To set the parameter, the command is:

cmnd/Sonoff/blinkcount X

where "X" is the number of iterations to set.

Activate the "BLINK"

Before explaining the (trivial) command, it is necessary to explain an important detail.

When we talk about relays, we talk about an electronic component, physical, able to open / close two contacts.

By operating a Sonoff, let's say a Basic, in fact, a physical relay is activated. In reality, what one does is command one's own proprocessor (ESP8266) to send - based on the firmware configuration - a pulse (to 3 volts) on a given PIN (called GPIO, o General Purpose Input / Output) which, in turn, connected with a specific PIN for the relay, it "commands" the functionnamento.

Therefore, the PIN (GPIO) of the Sonoff from which the impulse is configured on the firmware as a "relay", but it is not the relay itself. This is why we first referred to relays logical e physicalI Sonoff, as based on processor ESP8266, all have a certain number of GPIO configurable and usable by firmware for the most disparate uses, among which appunto "relay", which we can consider logical. The moment a given GPIO is configured as a "relay", any command Tasmota (related to relay management) addressed to him is executed.

The fact that then there is a relay physical connected to it it is a secondary fact.

It could indeed be connected to another: in fact, let's say that you want to make a led blink connected to the GPIO13 of a NodeMCU with on board firmware Sonoff-Tasmota: I will have to configure the firmware first Tasmota as "Generic" and then configure the GPIO13 as "Relay1", to then finally connect the LED to this GPIO PIN. At this point the ignition command (which we will now analyze) can be executed so as to turn on / off the led.

Sonoff-Tasmota Generic setting
A board NodeMCU with Sonoff-Tasmota configured as "Generic" and with two LEDs connected to GPIO4 and 5

If you use a board also equipped with a physical relay (the Sonoff Basic of the example), the logic is the same, only instead of turning on a LED you go to control your physical relay.

POWER command

To activate the flashing (configured as from previous commands) the command usually used for turning on / off, or "POWER" is used. To ensure that the flashing is activated, the command must be used with an MQTT payload equal to "3":

cmnd/Sonoff/power 3

At this point the device will activate the flashing based on the previously set settings.

If more relays are present on more than one GPIO, reference will be made to the specific relay by introducing the same value:

cmnd/Sonoff/powerX 3

where "X" is the relay number, for example:

cmnd/Sonoff/power1 3


ITEAD Sonoff BasicATTENZIONE: remember that there is on our FORUM community an ad hoc section dedicated to Sonoff (and more generally to devices ESP8266), for any doubt, question, information on the specific merit of these components.

inDomus telegram channel