Hubaction sending same command multiple times?

So I’m sending data to a local device on my network from a device handler. I’m using the code below. My device is seeing the same commands sometimes repeated. I made sure they were the same commands by appending a unique id to the command text, as seen in the code.

90% of the time - the command is sent only once
10% of the time - the same command is repeated again, usually within 300ms, sometimes as long as a second or two later

The code that is receiving the command of course could be the culprit (it’s C# using a socket listener), but I really doubt it, since I’ve used the code in other places for other things with no issues.

Does anyone here think it’s possible that ST could be sending duplicate hubaction requests for some reason?


def rnd = UUID.randomUUID().toString()

def hubAction = new physicalgraph.device.HubAction("${command}/${rnd}", physicalgraph.device.Protocol.LAN, getHostAddress())
    
	sendEvent(name: "hubactionMode", value: "local");

	try {
        log.debug "hubAction $hubAction"
        return hubAction
    }
    catch (Exception e) {
        log.debug "Hit Exception $e on $hubAction"
    }

I had the same thing, i was sending commands to Domoticz and I saw it intermittently coming in twice. I found it happening after a hub firmware update in the may timeframe. As a circumvention i put in a wait of about 3 secs (anything less still gave me doubles) in my smartapp and it was OK after that. So not in the devicehandler like you, but in a smartapp. But maybe it works for you as well if you can wait for 3 secs ;-).

@dudz40, that’s good info. Anyone else seeing this? @slagle, do you know anything about this?

Usually a reboot solves it for a good period of time. I do have a ticket out to have this looked into though. But, among other priorities this is a little lower on the list.

You can add a delay like @dudz40 mentioned and that will definitely help as well! :slight_smile:

I have worked around it through hackish code, but really, this should imo be a top priority. If the hubaction is controlling something like a light or garage door or coffee pot or whatever, then having a signal sent twice could cause safety issues. Can you get the priority bumped up a bit?

Also, if you’re not in control of the endpoint with which you’re communicating, it isn’t possible to mitigate this. This is a really significant bug - I’m surprised there aren’t more complaints around it. No one else has ever dealt with this?