My recollections - been a while since I dabbled in this area... The HubAction is asynchronous, so you don't need to store the sendHubCommand output in a variable. Instead, when the hub receives a response, it will be passed to a parse method that you define in your driver, or you can specify a callback arg in the options map for the HubAction for a custom method to be called with the response.
But not getting a response......... I've tested the device with WireShark from a PC, so I know my command, port, etc are all correct and that the device does respond.
Since you've already fired up Wireshark, I'd recommend just troubleshooting using that.
Capture the command packet being sent by the PC, then with Hubitat. Is a packet being sent by Hubitat? If so, how does it differ from the one being sent by the PC (which works)?
What application are you using on the PC to send the command?
I used Node-Red on a Windoze PC to send command and used Wireshark view both the command and the response.
I've not been able to get Wireshark to view the communications from Hubitat - I think my Unifi network is filtering the traffic - however if I send a command to 255.255.255.255 I do then see it, but can't see the response. i had a quick look to see how I can get Unifi to stop filtering - but that's not obvious.
I don't see any difference in the packet sent by Hubitat (using the broadcast address for testing) and by the PC - so I assume the device is responding correctly to Hubitat... but my code never receives in anything.
Regarding your suspicion of your network not routing the command and/or response, what leads you to believe that? Are there any network rules that apply to routes between your PC and the device that don't apply between Hubitat and the device? Are they in different VLANs or networks?
Just to be clear, when you send the command from the PC is it directly to the device IP (and not broadcasting to 255.255.255.255)? Is the reply you see in Wireshark directly to the PC IP?
Just throwing out random ideas now, are there any commands that you can send that would have a noticeable effect on the end device without needing to see a network response back on the Hubitat side? Or are there logs on the device that you could use to confirm that the command is reaching it in the first place?
When I do the same command from Hubitat I get nothing in Wireshark and I'm thinking this is because my Unifi network knows where IP addresses are and it routes accordingly. I've looked to see if there is a promiscuous mode setting on the network and I don't see one.
There is a phone app for the device and it works fine. In Wireshark on the PC I see frequent broadcasts from the phone to 255.255.255.255 on the port the device uses - this further supports my theory that my network is filtering traffic. If I mimic this broadcast from Hubitat I see the same thing in Wireshark.
From Hubitat I can send the UDP command to turn the device off and that works fine, device goes off..... proves that UDP communication from Hubitat to the device works - I just dont get a response.
I don't need to do anything to open the port for Hubitat to read the response ?????
Nope. On my PC, using node-red - I can send out the read command to read the temperature and I get the response back into node-red. In Wireshark all looks perfect.