How to receive data on openhab using UDP ? (solved)

  • Hello !

    Here is the problem I am facing :

    I have an arduino node communicating using UDP. It sends on port 600 receives on port 500.
    I would like to be able to send and receive data to this node from the openhab.

    Sending data has been straight forward. It works nicely. On the other hand I did not manage to get
    any data from this node. I tried various changes in the config file and in the way to do the incoming
    binding but I still got warnings. Here are some information on my setup :

    items setup :

    String fromUDPnode "fromUDPnode" {udp="<['REGEX((.*))']"}
    String toUDPnode "toUDPnode" {udp=">['REGEX((.*))']"}

    config :


    and here are the warnings I get :

     [WARN ] [AbstractDatagramChannelBinding] - Received data 10;59;1;0;23;0
             from an undefined remote end / We will not process it
     [WARN ] [AbstractDatagramChannelBinding] - No channel is active or defined for the data we received from / It will be discarded.

    seems openhab receives the data but discard them ...

    any clue on how to solve this issue ?


  • I had the same issue and found this post quite fast but although it says "(solved)" I found no solution. I am leaving my reply here for future reference.

    What I did to fix the "It will be discarded" message:


    This sets up the receiving end of the binding i.e. the server that binds the 5005 port.



    This sets up the openhab binding to the string. Notice the asterisk after the IP address; because the client will connect to the server it will get assigned a random free port. The asterisk will catch all ports a client will get solving the "No channel is active or defined issue".

    String 	String_FF_Bath_Test 	"Test String[%s]" 	 {udp="<[\*:'REGEX((.\*))']"}


    Just some test code to easily send a UDP message to openhab.

    import socket
    UDP_IP = ""
    UDP_PORT = 5005
    MESSAGE = "Hello world!"
    print "UDP target IP:", UDP_IP
    print "UDP target port:", UDP_PORT
    print "message:", MESSAGE
    sock = socket.socket(socket.AF_INET, # Internet
                     socket.SOCK_DGRAM) # UDP
    sock.sendto(MESSAGE, (UDP_IP, UDP_PORT))

Log in to reply

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.