добавляем возможность использования node mysensors в сценариях

This commit is contained in:
Dmitry Borisenko
2022-12-06 13:16:49 +01:00
parent 33a9861a8f
commit afb7ce9951
2 changed files with 5 additions and 7 deletions

View File

@@ -78,7 +78,7 @@ class MySensorsGate : public IoTItem {
static bool presentBeenStarted = false;
String key = nodeId + "-" + childSensorId;
String ID = "n" + nodeId + "s" + childSensorId;
static String infoJson = "{}";
if (childSensorId == "255") {
@@ -99,7 +99,7 @@ class MySensorsGate : public IoTItem {
sensorType(type.toInt(), num, widget, descr);
descr.replace("#", " ");
SerialPrint("i", "MySensors", "Presentation: " + key + ": " + descr);
SerialPrint("i", "MySensors", "Presentation: " + ID + ": " + descr);
}
if (command == "1") { //это данные
if (value != "") {
@@ -108,12 +108,10 @@ class MySensorsGate : public IoTItem {
SerialPrint("i", "MySensors", "===================== " + nodeId + " =====================");
}
String incommingID = nodeId + "-" + childSensorId;
bool found = false;
for (std::list<IoTItem*>::iterator it = IoTItems.begin(); it != IoTItems.end(); ++it) {
if ((*it)->getID() == incommingID) {
if ((*it)->getID() == ID) {
found = true;
(*it)->setValue(value, true);
}