Do 'something' when App opened?

I have an app that has some device info but in order to see the latest I need to:
-Open the app
-Then hit refresh button. This button I put tied to a refresh Handler function.

Otherwise the data displayed in opened app is from previous time app was opened.

Is there something I can use to call a specified Handler when the app is opened? Kinda like how 'updated()' runs every time you hit 'Done' but instead for every time app gets opened.

Sort of. Your app can't be "opened" unless it is displaying one of the UI pages. These are generated from a call to a method corresponding to that page in your app code, and you can call whatever methods you want from there.

For example, if this is part if your app:

preferences {
	page(name: "mainPage")

// ...

def mainPage() {
	dynamicPage(name: "mainPage", title: "My Page") {
		section {
			paragraph "Stuff here..."
} could put whatever you need to inside that mainPage() method, e.g., a call to some other method in your app (or on a device, etc., though I really prefer to keep that kind of thing to a minimum on page loads). This will be called whenever that page is rendered, essentially whenever your app UI, or at least this page, is opened.

This might need to be a dynamicPage instead of a plain page to work (as above). With your kind of app, you might already be using these; if not, it's an easy change!

Yeah it was as easy as that! I put under mainPage.

Download the Hubitat app