So I’m trying to rewrite a SmartApp to connect to a device on my network (Rainmachine) via LAN instead of having to hit it from the cloud after port forwarding and all that mess.
After much pulling out of hair, I’ve managed to figure out how the callouts work and how to parse responses dealing with the async requirement and all that (beating a dead horse, I know, but THIS SUCKS SO BAD GOOD LORD).
My problem now is that the installation process for this application currently requires real-time, synchronous interaction with the user. It goes something like this:
1.) Page prompts user for login information for device
2.) Callouts happen logging into device and pulling down data
3.) Next page displays a list of items from the device for the user to choose from.
4.) Code executes to create virtual devices from those selected by the user
5.) All done. Yay.
So far, I have not been able to replicate this flow using the LAN callouts due to their asynchronous nature. I can kick off the login process which initiates the login callout, but there’s no way to connect the response back to the page to continue the process. I’ve tried putting in additional preference “waiting” pages that would essentially act as points where the user can just wait for the data to come back, but that doesn’t quite work out for some reason.
Has anyone else tried doing this? I know LAN-callouts are just insane hacks and workarounds in general, but has anyone hacked their way around this particular combination of doing those callouts within a SmartApp setup/install flow?