UDP Not Possible They Said? Wait, what's this?

Haven’t looked. Let me know if you find anything but I suspect its hard coded.

Thanks for this great find.

I am a little newbie here. I created a Device Type and got the UDP thing to work however the messages seem to be queued up. So either two messages (on and off) are sent right after each other or the one prior to the last UDP message is sent. Here is my code:

// parse events into attributes
def parse(String description) {
	log.debug "Parsing '${description}'"
	// TODO: handle 'switch' attribute
	// TODO: handle 'level' attribute

}

// handle commands
def on() {
	def cmd = "0x35 0x00 0x55"
    def ip = "192.168.1.126:8899"
    log.debug "Executing 'on':\r\n${cmd}\r\nHOST: $ip\r\n\r\n"
    def hubCmd = new physicalgraph.device.HubAction("${cmd}\r\nHOST: $ip\r\n\r\n", physicalgraph.device.Protocol.LAN)
    hubCmd.options = [type:"LAN_TYPE_UDPCLIENT"]
    return hubCmd
}

def off() {
	def cmd = "0x39 0x00 0x55"
    def ip = "192.168.1.126:8899"
    log.debug "Executing 'off':\r\n${cmd}\r\nHOST: $ip\r\n\r\n"
    def hubCmd = new physicalgraph.device.HubAction("${cmd}\r\nHOST: $ip\r\n\r\n", physicalgraph.device.Protocol.LAN)
    hubCmd.options = [type:"LAN_TYPE_UDPCLIENT"]
    return hubCmd
}

I’m not sure what’s happening but is there a way to flush the to be sent queue (if there’s such a thing)?

Not sure what the issue is, but in my testing, there is about a 20 second timeout with the port open. Which means that if another hubaction fires on that port within that timeout, then it will fail.

Not sure about queuing, there is something of a queue, but no idea how to access it.

I’ve noticed the connection may close on a variable rate per device (my Sharp is about 9 seconds, my Yamaha is indefinite). Some devices let you stack commands on top of each other, and some don’t, like my Sharp TV.

I wrote some very primitive non-blocking here:

Ideally, we’d just send a flag to reduce the timeout and thus flushing the buffer. I didn’t find anything like that yet, but I’m highly confident it exists.

1 Like

Hey Patrick, could you confirm this works in a SmartApp? For the life of me I cannot get it to work.

I open listening UDP socket with netcat:

nc -luv 4001

and can talk to it from another host on the same LAN, but not from the hub. I see outgoing hubAction in the logs, but nothing arrives at the UDP socket.

did anyone find a v1 hub timeout flag for this? or find a better udp local function in v2 hub?

1 Like

I’m starting to look at this again now that I have a v2. We’ll see!

2 Likes

Total rookie question, but i love to learn and know what is what wherever i can to tey better by own knowledge on ST hahaha

This all sounds super interesting and even more so as you mentioned V2, what kind of integrations could this open up that were not possible before, what use cases / devices / integrations do you see been able to utalize this ?

TCP seems to work… kinda

Hi Patrick , Sorry if I’m late to the party here but this is great stuff. I’m interested hearing you are controlling the Control4 Amp as this is something I’ve been wanting to do. I was wondering if you know the list of commands that the Amp responds to as I can’t find any information on that anywhere. Any pointers would be greatly appreciated.
Thanks

With it connecting to the MiLight does it just do the main hub to dim all lights at the same time? Does it let us change the light color? If I have 4 light strips working will I be able to connect to all four and change them independently?

So is this possible?

Send a UDP multicast/broadcast message to IP 269.255.255.250 on port 1900 to scan for LG TV's?

No, not using today’s implementation of the hub action.

Seems that this option has been removed from the Smart Things hub library. I am hoping they bring it back in the next update.

Aww, such a shame they removed local UDP, was looking to make an ONKYO receiver discovery/handler without using any intermediate service but this kills it :frowning:

1 Like

Onkyo eISCP uses TCP. Maybe you can’t do discovery anymore, but if you give your receiver a static IP its not an issue. I built an awful handler that can at least send commands but doesn’t parse/query anything.

2 Likes

Thanks, Alan, I know it uses TCP and UDP is only used for discovery. Still, without ability to receive raw TCP payload in response querying anything is impossible.
And thanks for your handler. It would be possible to tie a poor man’s discovery to it using SSDP (as all of them are also DLNA renderers, and one can just match manufacturer == ONKYO).

Is there any updated on Smarthings and UDP? I saw one post where they said that the command was disabled. Is this true? I have been trying to control a device in my house that only accepts UDP packets and I just cannot get it to work. Wireshark also shows no UDP packets being sent

Also curious whether this still works, and/or whether there are better ways to talk UDP

I see @Jared is asking the same question here Haven't stopped by in a while -- is there UDP support yet?