Problem in coding a driver -- Sorry duplicate message

Any idea why I'm always getting this error:
com.hubitat.app.exception.LimitExceededException: App 47 generates excessive hub load on line 745 (method processStateData)

My code is
logger("debug", "Cmd4 sendEvent, operator = ${operator} / stringValue = ${stringValue}")
sendEvent(name: operator, value: stringValue) //, displayed: false)
logger("debug", "Cmd5")

It always crahed on the sendEvent and I have no idea why. In the log I only have
Cmd4 sendEvent, operator = HSwing / stringValue = Off.

Any idea ? Please help !

The log suggests your app is trying to set your Hub on fire (e.g., you've got too many events happening).

From my log, the sendEvent is called only once. I suspect the parameter have wrong format. I don't think I send too many commands.

What does the rest of the code look lik?

def prepareCmd(operator, pdata, acState, modeStr) {
    def String key = parent.getStateKey(device, acState)
	if (parent.checkValue(pdata, key)) {		
		def slurper = new groovy.json.JsonSlurper()
		def opModeJson = slurper.parseText(modeStr)
        def int resValue = pdata[key]
		def stringValue = getKeyDefinition (resValue, opModeJson)	
        if (stringValue) {
logger("debug", "Cmd4 sendEvent, operator = ${operator} / stringValue = ${stringValue}")        
            sendEvent(name: operator, value: stringValue)  //, displayed: false)
logger("debug", "Cmd5")        
        }
	}
}

The error you posted indicates the problem is in App 47 method processStateData; this doesn't appear to match the code you posted.
Are you sure you are looking in the right place?
How is this method being called/triggered?

As we don't know what the code you haven't shared looks like, more details and context would be helpful.

I based my assumption the log. As I said I got the log Cmd4. I don't get Cmd5 and get the error after Cmd4.

The app calls processStateData (in the driver) and processStateData calls prepareCmd which crashes.

The line 745 in the driver MATCHED this sendEvent.
The line 745 in the app is in a middle of an assignation.

sendEvent() call is one of the spots where hub checks for excessive load.
It is very unlikely to be the spot that produces said load.

2 Likes

Haaaa that makes sense !!!

I was running a procedure for a a couple of seconds every minute like this
schedule("0 */1 * * * ? *", refreshV1Devices)
and got the error every run.

I decided to use
runEvery1Minute(refreshV1Devices)
and no more error since then, but I don't understand why.