AIMS OF THE GUIDE
SOFTWARE COMPONENTS USED:
PHYSICAL DEVICES USED:
GUIDE best suited for:
Notes and disclaimer
|Driving review: 1.1|
As it is known, the adoption of the firmware Sonoff-Tasmota on devices based on ESP8266 SOC (such as those, for example, of the family) 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, 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).
On this occasion we will focus on the command "GROUPTOPIC",
Every device equipped with firmware Tasmota (and relative fork) and that I have configured il proMQTT tocollo owns of a profirst "name" which is proietta consequently i topical MQTTs accepted by it as commands or sent by it as replies (telemetry).
A command topic is usually defined by a prefix "cmnd", From a suffix that rappresents the name of the device, from the command itself and finally from a possible payload (o useful load, parameters useful for executing the command). The response topics (temeletrici), instead, usually present the prefix “stat"
An example of a command topic is as follows:
It goes without saying that, subject to the same type of topic and command, by changing the name of the "target" device the recipient of the command itself will vary accordingly.
What many people don't know is that, in the firmware Tasmota, there is a variable "GROUPTOPIC"(With default value"sonoffs") Which allows the definition of device groups MQTT.
Let's take the example of five actuators Sonoff Basic equipped with firmware Tasmota, configured with MQTT, which have the following names and their ignition commands:
|Name MQTT||Ignition control|
|Kitchen||cmnd / Kitchen / POWER 1|
|Camera||cmnd / Camera / POWER 1|
|Bathroom||cmnd / Bathroom / POWER 1|
|Garden||cmnd / Garden / POWER 1|
|Terrace||cmnd / Terrazzo / POWER 1|
The only way to execute the five commands is to publish via an MQTT client the five command topics at the MQTT Broker.
If not previously customized in terms of GROUPTOPIC, however, the five actuators share a second name, common to all: "sonoffs”(The final“ s ”recalls for theappanglosassone plural).
This means that by simply sending a command, the following:
cmnd /sonoffs/ POWER 1
all five the actuators will turn on in unison.
In practice all the firmware Tasmota have this second name in order to logically "group" devices with the same "GROUPTOPIC"Which is appunto a variable but also a command that allows:
- consult the valorization;
- varying its value.
In fact, by executing a command such as:
cmnd /Kitchen/ GROUPTOPIC
the set value is obtained in response (by default, as said, “sonoffs ").
A command like
cmnd /Kitchen/ GROUPTOPIC NuovoGroupTopic
instead sets the "GROUPTOPIC"To the new string (in this case"NuovoGroupTopic"
This functionality is particularly welcome in order to define multiple groups which can then be integrated into the personal HUBlike they were individual switches (which, however, affect several components):
At this point, sending the command:
cmnd /Internal/ POWER 1
the "Kitchen", "Room" and "Bathroom" devices will light up; while with:
cmnd /Building/ POWER 1
"Garden" and "Terrace" will light up.
Obviously the use of a group MQTT name yes applic to any command accepted by the device, which makes this function particularly useful. For example, consider having more than 10 devices connected to the Wi-Fi and want to change everyoneTelePeriod"To set it to 300 seconds.
It will be enough (assuming that everyone shares "sonoffs "as an enhancement of"GROUPTOPIC") Use a command like:
cmnd /sonoffs/ TelePeriod 300
to ensure that everyone at the same time implement this command.
Nb This last concept should make us think: "GROUPTOPIC"Yes it is a comfortable and powerful function, but profor this reason it is necessary to pay particular attention to when using it, given the "massive" effect of what it performs.
|ATTENZIONE: 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.|