mirror of
https://github.com/letscontrolit/ESPEasy.git
synced 2026-07-28 04:07:47 +00:00
Merge pull request #3846 from TD-er/bugfix/check_controller_linked_to_task
[Domoticz] Only incoming MQTT on tasks with controller linked (#3829)
This commit is contained in:
+1
-1
@@ -18,7 +18,7 @@ MarkupSafe==2.0.1
|
||||
marshmallow==3.14.0
|
||||
packaging==21.0
|
||||
pathtools==0.1.2
|
||||
platformio>=5.2.2
|
||||
platformio>=5.2.3
|
||||
port-for==0.6.1
|
||||
pycparser==2.20
|
||||
pyelftools==0.27
|
||||
|
||||
+3
-1
@@ -82,7 +82,9 @@ bool CPlugin_002(CPlugin::Function function, struct EventStruct *event, String&
|
||||
if (deserializeDomoticzJson(event->String2, idx, nvalue, nvaluealt, svalue1, switchtype)) {
|
||||
for (taskIndex_t 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
|
||||
if (Settings.TaskDeviceEnabled[x] &&
|
||||
Settings.TaskDeviceSendData[ControllerID][x] &&
|
||||
(Settings.TaskDeviceID[ControllerID][x] == idx)) // get idx for our controller index
|
||||
{
|
||||
String action;
|
||||
bool mustSendEvent = false;
|
||||
|
||||
+4
-4
@@ -81,7 +81,7 @@ bool CPlugin_005(CPlugin::Function function, struct EventStruct *event, String&
|
||||
const int lastindex = event->String1.lastIndexOf('/');
|
||||
const String lastPartTopic = event->String1.substring(lastindex + 1);
|
||||
|
||||
if (lastPartTopic == F("cmd")) {
|
||||
if (lastPartTopic.equals(F("cmd"))) {
|
||||
// Example:
|
||||
// topic: ESP_Easy/Bathroom_pir_env/cmd
|
||||
// data: gpio,14,0
|
||||
@@ -116,14 +116,14 @@ bool CPlugin_005(CPlugin::Function function, struct EventStruct *event, String&
|
||||
|
||||
if (validTopic) {
|
||||
// in case of event, store to buffer and return...
|
||||
String command = parseString(cmd, 1);
|
||||
const String command = parseString(cmd, 1);
|
||||
|
||||
if ((command == F("event")) || (command == F("asyncevent"))) {
|
||||
if ((command.equals(F("event"))) || (command.equals(F("asyncevent")))) {
|
||||
if (Settings.UseRules) {
|
||||
eventQueue.addMove(parseStringToEnd(cmd, 2));
|
||||
}
|
||||
} else {
|
||||
ExecuteCommand(event->TaskIndex, EventValueSource::Enum::VALUE_SOURCE_MQTT, cmd.c_str(), true, true, true);
|
||||
ExecuteCommand_all(EventValueSource::Enum::VALUE_SOURCE_MQTT, cmd.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -92,9 +92,10 @@ bool CPlugin_006(CPlugin::Function function, struct EventStruct *event, String&
|
||||
cmd += topicSplit[6].toInt(); // Par1
|
||||
cmd += ',';
|
||||
|
||||
if ((event->String2 == F("false")) || (event->String2 == F("true")))
|
||||
if ((event->String2.equalsIgnoreCase(F("false"))) ||
|
||||
(event->String2.equalsIgnoreCase(F("true"))))
|
||||
{
|
||||
cmd += (event->String2 == F("true")) ? '1' : '0'; // Par2
|
||||
cmd += (event->String2.equalsIgnoreCase(F("true"))) ? '1' : '0'; // Par2
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user