UDP broadcast support

Here are some examples of sending UDP messages

For sending regular strings:

String message = "Hello"
def myHubAction = new hubitat.device.HubAction(message, 
								hubitat.device.Protocol.LAN, 
								[type: hubitat.device.HubAction.Type.LAN_TYPE_UDPCLIENT, 
		                            destinationAddress: "192.168.1.100:6628"])
sendHubCommand(myHubAction)

for sending binary messages (message back to parse will also be hex string encoded):

byte[] rawBytes = [0x71, 0x23,  0x0F, 0xA3]
String stringBytes = hubitat.helper.HexUtils.byteArrayToHexString(rawBytes)
def myHubAction = new hubitat.device.HubAction(stringBytes, 
                           hubitat.device.Protocol.LAN, 
                           [type: hubitat.device.HubAction.Type.LAN_TYPE_UDPCLIENT, 
                            destinationAddress: "192.168.1.101:7815",
                            encoding: hubitat.device.HubAction.Encoding.HEX_STRING])
sendHubCommand(myHubAction)

HexUtils is documented here:
HexUtils

4 Likes