On Load function for the HR App

Hi. I may be asking the wrong questions or using the wrong terminology (or I’m just being dense), but I can’t find an answers to these questions in the documentation or this forum, so I thought I would try here. Hopefully someone can point me in the right direction.

Is there a function that is run when the HR app starts or is refreshed that can be modified to do whatever is required when the app opens? I want to initialise all of the elements according to what the current state of my AV Amp. For example, I can read which source the Amp is set to, which in turn tells me what other devices should be on, and I want to set the HR to the appropriate display.

I’m used to programming in Javascript where it is possible to create functions to do a set of tasks, even call orher functions. Is there something in HR that can accomplish a similar thing? For example, reset the UI to show everything as ‘off’ and then call a function that would update the UI appropriately. The reset function would be called everytime an option is selected (watch TV, listen to music etc).

I hope that makes sense. I do wonder if I am perhaps thinking about HR correctly. Any advice or pointers would be gratefully received.

Thank you!

I’m using a “Loaded” Event trigger on an element on the main / home page and a virtual device to keep track of the status of the app. I defined a variable in the virtual plugin that is initialized with the value “starting”.

When THR restarts, it triggers the “Loaded” event (but only when the variable has the value “starting”, defined as a condition). In the last action of the event trigger I set the virtual variable to “started”.

Thanks for the reply. That’s kind of what I’ve been looking at, but I’m still working out the logic of everything I would like to do. I’m happy knowing that I’m on the right track. Cheers!