Custom handler parse methods not executing after changing handler on device

As I further diagnose odd ST behavior … starting with this thread… Possible physicalgraph.device.HubAction bug

I found another one today. I don’t fully know yet all the conditions that cause this but…

  1. Create a new custom handler. insert logging in parse and refresh methods to denote today’s date.
  2. change an existing device that has an existing custom handler to the new custom handler.
  3. Watch live logging. Notice these two things:
    a. refresh method log prints today’s date.
    b. parse method log doesn’t, and reflects logging of previous custom handler.

It’s as if the parse method logic is disconnected from the device. given other troubleshooting I have done in the above referenced thread, I expect it will rectify itself in 24 hours.

I will report back.

If you have any issues with custom handler’s not taking your parsing code, test whether the parse code is actually being processed, or whether it’s phantomed for 24 hours.

Do you get the same behavior/bug with the original SmartApp/DTH ?

The ‘cannot communicate with device error’ on the new app is likely the DTH hasn’t updated for the new app, so it’s expected not to work.

I’m using the MAC address as the DNI for my apps, and I don’t experience the problem you mentioned.

So two issues I’m tracking - on this thread, custom handler parse methods not executing upon device update to new handler. The device in question is the prod device and hasn’t been touched in a few days.

On the referenced thread, deleting and recreating devices with same network ID causes parse methods to stay connected to the deleted object. For this one, I did try MAC addresses in my testing scenarios and for me, it didn’t resolve anything, and actually
just meant I was forced to wait the 24 hours since the MAC of a device doesn’t change.

For this current thread, the new custom handler has been created for the purpose of making it work correctly with the new app. I’ve tested it successfully in a non prod device before updating the prod device with the new handler. I ended up taking a copy
of an official template and inserted my code and removed unnecessary code. The original error message about cannot connect is gone, and almost have a working custom handler. Everything works right now, except the parse commands have been updated with adjusted
sendEvents to correspond to the new handler, and because it won’t process the new parse method code, it won’t update. Expect it’ll work tomorrow. Again, this new handler works just fine with a non prod device that I was testing.

If you delete and re-create device with the non-modified, do you get the same problem where it couldn’t receive/parse events?

My guess is - there is probably a bug in your modified version.

Update - exactly 24 hours after I performed the change (moving from older device handler to newer), the newer handler logic in the parse method started to process. No adjustments were made in that 24 hours.

It could be a bug in the handler, I suppose, but given the fact it’s working, it saves, and passes syntax checks in the IDE, it would have to be something very obscure.