[BUG or DESIGN] runInMillis data from componentOn fails in App

Hi,

This might be a bug, or perhaps as designed (in which case docs could be updated to warn of this behaviour).

I'm seeing a case whereby if you use a runInMillis within the child's context of an Apps componentMethods (ie componentOn) then the optional data: "value" passed to the runInMillis method is set to null... the same example works fine in a Driver parent/child context.

An example code snippet...

def componentOn(cd) {
        def value = 1000
       runInMillis(500, 'delayedMethod',[data: value])
    
}

def delayedMethod(value) {
    _debug(value) // << this is null
}

EDIT: My original guess was probably wrong.

Here's a driver that seems to implement the required structure: Hubitat/LazyRolls.groovy at master · yix/Hubitat · GitHub

Correct. Works for me in a DRIVER too.

Doesn’t work within an App with children drivers.

Ah, my mistake. That is indeed weird.

@mike.maxwell or @bravenel any chance you can confirm/deny this bug?

I will look into it.

All of this code works from an app using a child component switch:

void componentOn(cd){
  log.trace "on called..."
  //also works
  def value = 1000
  runInMillis(500, 'someMethod',[data: value])
  //works
  //runInMillis(500, 'someMethod',[data: "on"])
}

void componentOff(cd){
  log.trace "off called..."
  //also works
  def value = 500
  runInMillis(500, 'someMethod',[data: value])
  //works
  //runInMillis(500, 'someMethod',[data: "off"])
}
//works
void someMethod(value) {
  log.debug "someMethod(${value})"
}
//also works
//void someMethod(data) {
//    log.debug "someMethod(${data})"
//}
//also works
//void someMethod(yada) {
//    log.debug "someMethod(${yada})"
//}

maybe something to do with your _debug(value) method?

Thank you Mike - I'm now unable to reproduce the bug myself either :confounded:

Very annoying as I played around with this for hours and hours, but didn't go as far as writing a test app... so I've lost the scenario that wasn't working. Your effort here has me going back to the approach I used before that required the use of runInMillis, and now it works :scream: ... so not sure what caused the loss of data being sent to the method... must of been something I missed.

Apologies but thanks again for persisting and looking into it... :+1:

I'll try not and cry wolf in future and have test cases for quirky bugs like this.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.