How long for an Electron function to register? [Solved]

I have a function that I’ve Particle.function(“bat”, funcName), but calling

particle call [device_id] batt “1”

indicates it cannot find the function. However, it seems after a while, the function becomes callable & works on every call until I reset it. I’ve even had it “fail” & sit for 5 minutes, then fire the function afterall.

How do I get the call consistent?

Maybe bat vs. batt?

Usually any function is registered during bootup (execution of setup()) - but you need to be aware that there is a time window for registration after the cloud connect.
If you don’t register the functions/variables within that time, the cloud might not register them.
The common place to register cloud thingies is the top of setup().

1 Like

Sheez, I think that was it. Just relocating the registration code. It was located at the bottom where there’s a potentially long call ahead of it (potential meaning based on conditions being met or not).

I was assuming that when the RGB indicated cell connectivity, that setup was completed and the long-running code wasn’t blocking latter execution blocks.

Thanks!

Glad you were able to get it fixed @jarrodramsey, thanks for the help @ScruffR!