Connect to WiFi only if ethernet disconnected or not working

I disabled WiFi on my Pis with DietPi installed but I ask if it’s possibile to configure the systems that if ethernet is disconnected or not working WiFi is enabled and used with same ethernet IP/DNS configuration.

If you enable both via dietpi-config, currently WiFi will be preferred. With v6.27 we plan to rework our network settings to be more flexible and e.g. allow to choose which to check and in case connect first.

But that would only work on boot. E.g. it is checked first if the WiFi cable is connected, in case tries to connect it and get an IP assigned, else tries to connect to WiFi.

Otherwise there are tools like ifplugd, which monitors connection states and raises the interface automatically on plug.