Skip to content

Network plugin item value not send as payload #186

@rthill

Description

@rthill

The network plugin documentation claims that you can send the actual item value as:

    [test]
        [[item1]]
            type = str
            nw_udp_send = 11.11.11.11:7777  # sends an UDP packet with the item value as payload

But this does actually not work, this simply sends nothing.

One way of correcting this error is to update the documentation as follows which currently works for me:

    [test]
        [[item1]]
            type = str
            nw_udp_send = 11.11.11.11:7777=itemvalue  # sends an UDP packet with the item value as payload

or by modifying the code which I didn't choose for me. I tested only the following modification in the code which was working too:

diff --git a/plugins/network/__init__.py b/plugins/network/__init__.py
index 4aa2f66..3b8618a 100755
--- a/plugins/network/__init__.py
+++ b/plugins/network/__init__.py
@@ -290,7 +290,10 @@ class Network():
             else:
                 message = message.replace('itemvalue', str(item()))
             host, __, port = addr.partition(':')
-            self.udp(host, port, message)
+            if message:
+                self.udp(host, port, message)
+            else:
+                self.udp(host, port, str(item()))

     def parse_obj(self, obj, obj_type):
         # nw_acl, nw_udp, nw_tcp

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions