Make Diangositc Tool run automatically and trigger another process

My YunoHost server

Hardware: Raspberry Pi 3 local
YunoHost version: 11.0.10.2
I have access to my server : Through SSH and through the webadmin
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : no
If yes, please explain:

Description of my issue

I love the Diagnostic Tool, it’s great and it gives me good information. The biggest issue I have is my local ISP changing my IP address on me periodically and throughout the day. The Diagnostic Tool tells me what my IP address should be so I can update my DNS records.

I’d like to figure out how to get the Diganostic Tool to run regularly and then, if the IP address error returns, have it send me the correct IP address it knows it should be to another process. Otherwise being able to generate that correct IP address myself within said process and run that on a schedule.

My registrar gives me the ability to change my DNS A record IP addresses through an API, so I’d like to:

  1. Be notified when the Yunohost can tell it doesn’t have the right IP address for the domains pointing to it.
  2. Have that detection trigger a process that updates the A records to the correct IP address via the API.
  3. Have all this run on a schedule so I can check regularly or else know immediately to minimize downtime with outside users.

Despite my limited technical knowledge, I believe one could write some scripts to do this. I’m curious if anyone has any ideas, leads they could point out, or existing apps that are doing this?