How to split json object message on node red MQTT broker

Поделиться
HTML-код
  • Опубликовано: 20 дек 2024
  • How to split MQTT json object message into individual payloads. code used in function node is
    var test = msg.payload;
    tag1 = {payload:test.values[0].v};
    tag2 = {payload:test.values[1].v};
    tag3 = {payload:test.values[2].v};
    tag4 = {payload:test.values[3].v};
    tag5 = {payload:test.values[4].v};
    tag6 = {payload:test.values[5].v};
    tag7 = {payload:test.values[6].v};
    tag8 = {payload:test.values[7].v};
    return [tag1, tag2, tag3, tag4, tag5, tag6, tag7, tag8] ;

Комментарии •