Domoticz MQTT received message

Moderators: Voyager, BertB, rtenklooster, Stuntteam, grovkillen, TD-er

Post Reply
Message
Author
OlivierM
Normal user
Posts: 1
Joined: 10 Feb 2019, 17:51

Domoticz MQTT received message

#1 Post by OlivierM » 10 Feb 2019, 19:42

Hi,

I use for 15 days ESPEASY with the controllers "Domoticz HTTP" and now "Domoticz MQTT", to maintain the state after a power failure, with the switches/relays Sonoff basic R2 and 4ch pro R2.
The firmware used is 02/02/2019 for ESP8285

In the "Switch input - Switch" model, when we want to publish a value, we set the checkbox "send to controller" and enter "IDX" associated.
If it's not checked, the IDX value is ignored and no message is posted for this task.

On the other hand, when ESPEasy receives a message all task that is indicated on the same value IDX are affected, whether the checkbox "send to the controller" is active or not.
As the "send to controller" case is not active, the IDX is not visible in the devices task list.

It might be interesting to create a new checkbox like: "received from controller" and/or print all IDX value in the devices task list page to facilitate verification.


I have not tested but it would seem that if I publish a message {"Command": "switchlight", "idx": 0, "switchcmd": "Off"} I will be able to change all the values ​​of all the switch receivers on the network (which are by default at 0).
In my case, to manage the switches, I publish on the buttons and I change the state of the relays/GPIO in a rule, whose IDX is defaults to 0.
For now I change the IDX of unpublished tasks to 99.

code snippet

Code: Select all

_C002.ino
 for (byte x = 0; x < TASKS_MAX; x++) {
              // We need the index of the controller we are: 0...CONTROLLER_MAX
              if (Settings.TaskDeviceEnabled[x] && Settings.TaskDeviceID[ControllerID][x] == idx) // get idx for our controller index
              {
                String action = "";
                switch (Settings.TaskDeviceNumber[x]) {
                  case 1: // temp solution, if input switch, update state
                  {
                    action = F("inputSwitchState,");
                    action += x;
                    action += ",";
                    action += nvalue;
                    break;
}

Cheers

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest