@Doekse this discussion prompted me to build exactly what was just asked for: an app that continuously logs Thread/Matter diagnostics so unavailability can be correlated with the mesh state after the fact.
Thread Diagnostics (test): Thread Diagnostics | Homey
Source: GitHub - stefan-schweiger/dev.schweiger.thread-diagnostics: Homey app that continuously logs Thread mesh and Matter device diagnostics · GitHub
It records role, leader data, partition ID, router/neighbor/child tables and OpenThread history events (role/partition changes, neighbors added/removed, captured between polls too) every 10 s, topology every 60 s, Matter node details every 15 min, and logs every (un)availability change in realtime with the device’s mesh identity. Everything lands in daily log files you can view/export from the app settings, plus Insights graphs.
One caveat: apps can’t call Homey.thread.executeCommand themselves (the homey:manager:api token lacks the required homey.system scope), so the full OpenThread diagnostics need an API key with full access (my.homey.app → Settings → API Keys) pasted into the app settings. Without it you still get topology, Matter nodes and availability logging.
Note that this is meant as a temporary debugging tool, not something to run forever: it writes a few MB of logs per day (capped at 25 MB by default, oldest files are pruned) and polls constantly, so uninstall or pause it once you’ve captured the problem.
@Pascal_Nohl this should cover what you asked for, no scripting needed.

