emqx / neuron

Open source industrial IoT connectivity server
https://neugates.io
GNU Lesser General Public License v3.0
1k stars 216 forks source link

Mqtt plugin message payload error 3017 for multiple tags publish #2192

Closed nick0tine closed 1 week ago

nick0tine commented 2 weeks ago

I have created a northbound app and it has a group having 9 tags in it.

All the subscription to southbound apps is there. Issue: When trying to publish message to mqtt broker address of north app, it throws mqtt payload error 3017.

The above case is only when I publish message where multiple tags are passed inside an array to tags attribute of message dict.

Although if i try to publish a message with single tag without any array, it works perfectly fine.

PS: I am using neuronEX. Code snippet example:


def on_message(client, userdata, message):

    payload = json.loads(message.payload.decode())

    if not 'error' in payload.keys() or payload['error'] != 0:

        print(f"Received message on {message.topic}: {payload}")

client = mqtt.Client(client_id=client_id)

client.on_message = on_message

client.connect(broker_ip, broker_port, 60)

client.loop_start()

client.subscribe("northappwriteresphost", qos=1)

msg = {

        "group": "example-grp",

        "node": "server-DC",

        "tags": [

            {

                "tag": "gate",

                "value": 11.0

            },

            {

                "tag": "brush",

                "value": 101.0

            },

            {

                "tag": "solids",

                "value": 16.0

            },

            {

                "tag": "width",

                "value": 25.0

            },

            {

                "tag": "length",

                "value": 150.0

            },

            {

                "tag": "line",

                "value": 500.0

            },

            {

                "tag": "weight",

                "value": 0.3732195710002935

            },

            {

                "tag": "load",

                "value": 29.32012949778306

            },

            {

                "tag": "coeff",

                "value": 8.728136979594593e-06

            }

        ],

        "uuid": "cd32be1b-c8b1-3257-94af-77f847b1ed3e"

    }

topic = 'xxxxx'

client.publish(topic, json.dumps(msg), qos=1)

client.loop_stop()

client.disconnect()
fengzeroz commented 2 weeks ago

3017 meas that the driver used for writing multiple tags does not yet support writing multiple tags in a single message

nick0tine commented 2 weeks ago

3017 meas that the driver used for writing multiple tags does not yet support writing multiple tags in a single message

By driver you mean the plugin we're using in southbound devices ? Or is the protocol version?

I'm using Allen-Bradley-ControlLogix 5500 plugin.

I'm new to this, so pardon for my silly doubts.

fengzeroz commented 2 weeks ago

3017 meas that the driver used for writing multiple tags does not yet support writing multiple tags in a single message

By driver you mean the plugin we're using in southbound devices ? Or is the protocol version?

I'm using Allen-Bradley-ControlLogix 5500 plugin.

I'm new to this, so pardon for my silly doubts.

Yes, Allen-Bradley 5500 plugin does not currently support writing multiple tags in a single message, future version will support.

nick0tine commented 1 week ago

Thanks for the comments and help