Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. How to receive data on openhab using UDP ? (solved)

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

Scheduled Pinned Locked Moved Troubleshooting
2 Posts 2 Posters 5.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    shasha
    wrote on last edited by shasha
    #1

    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="<[192.168.0.9:500:'REGEX((.*))']"}
    String toUDPnode "toUDPnode" {udp=">[192.168.0.9:500:'REGEX((.*))']"}
    
    

    config :

    udp:itemsharedconnections=true
    udp:bindingsharedconnections=true
    udp:directionssharedconnections=false
    udp:addressmask=true
    udp:postamble=
    udp:blocking=false
    udp:refreshinterval=250
    udp:port=600
    

    and here are the warnings I get :

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

    seems openhab receives the data but discard them ...

    any clue on how to solve this issue ?

    Thanks

    1 Reply Last reply
    1
    • Jasper van ZuijlenJ Offline
      Jasper van ZuijlenJ Offline
      Jasper van Zuijlen
      wrote on last edited by Jasper van Zuijlen
      #2

      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:

      [openhab.cfg]

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

      udp:port=5005
      

      [default.items]

      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="<[127.0.0.1:\*:'REGEX((.\*))']"}
      

      [python]

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

      import socket
      UDP_IP = "127.0.0.1"
      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))
      
      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      9

      Online

      11.7k

      Users

      11.2k

      Topics

      113.1k

      Posts


      Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • MySensors
      • OpenHardware.io
      • Categories
      • Recent
      • Tags
      • Popular