Code References for Child Apps

I've created an app for some basic led strips light management. I currently have three led strips. This is just for me learning and experimenting.

My current app takes inputs with 'capability.colorControl'; and changes the color every 30 minutes. Works great on all three led strips. However, all three strips are subscribed to the same color changing event. What if I wanted them to change independently of each other?

I'm thinking it would be cool if it worked similar to RM. I could name the "instance", then select one led strip, and then it would be on it's own schedule. Then, when looking at the "Apps" menu item, I would have "Light Color Changer" as the main app, and then my custom instance names as the three "child apps??".

Is there a code example that shows how to create these child instances of an app, similar to RM?

I had been looking at this code:

Is it really as simple as adding lines 18 and 19 to my code for page?

Those lines just allow for customizing the app name. It doesn't create child apps. That is a little more involved but certainly do-able.

Lines 50-52 show how to add a child app.

Line 25 is the reference to the parent app to relate them.

You'll probably just want to make a new parent app and use your existing code as the child.


Thank you very much! I'll study over this tonight and post back tomorrow.

1 Like

Good luck!

1 Like

Well... that was amazing! Your examples were easy to follow; did exactly what I wanted; gave me some new ideas; showed me some new techniques (love the next page functionality); and I already have the new system up and running. I certainly didn't expect it to only be a one hour job.

The two hints you provided were much appreciated. Making my app the child app; and basically copying your parent app. And how to relate them using the namespace and app name.

Again, thank you!!