Is there a driver method that executes on each Startup?

Does anybody know - is there a driver method that fires on system startup.

What I'm looking for is something like the Installed(), Initialized(), updated() methods but which fires each time the system starts (and when you switch from one driver to another)?

The use case I have is for Zwave in particular - I want to be able to query device parameters and device state each time the system starts. The reason is that these parameters may have changed while hubitat was disabled (or changed due to use of the basic parameter tool or otherwise) - I'd also like to be able to get a basicReport from the device on startup (to ensure correct currentValue state in case the device was changed while Hubitat was off).

I recognize I could do this with Rule Machine to have a rule execute custom commands on startup - but I'm looking for something built-in / automatic where another user of the driver would not have to add rules and the like.

I believe that would be initialize(). Haven't tested it in a log time, though.

I assume this is still true:

3 Likes

Thank you.
I think that is exactly what I was looking for. I had the "initialize()" routine, but it wasn't firing - I didn't know about adding the capability. Seems to solve my problem. I'll give it a try tonight!

I'm not 100% it actually works as listed, though. I saw at least 1 other post saying it DOESN'T run after reboot - but I didn't read the whole thread. Maybe they were missing the capability and only had the handler.

If you think of it, and have time, post back after testing!

I will. Thanks.

It does (or should) work. I use it in a bunch of my mqtt and websocket drivers. It’s been working for me.

4 Likes

So is the handler only called if the initialize capability is specified too?

1 Like

yup!

1 Like

Same for me. I rely on it for things like opening websocket connections or logging in to remote servers in several of my drivers.

1 Like