Maybe we’re not using the same language here. Integrations don’t go unavailable
and in fact they don’t have a state at all. Neither do devices. In HA, entities are the only things that have a state.
But you could, for example, look for which entities are unavailable and then determine which devices or integrations they belong to.
Or if you want to detect integrations that have errors (like the ones that have a red box around them when you view all your integrations by navigating to settings → devices and services) you could monitor for specific log errors. To do this, you can configure HA to fire events when items are posted to the log, and you can trigger off those events. Here is a post about that.
If none of this is getting what you want, it would be helpful if you could explain a bit more about what you’re actually trying to accomplish.