Automatic disconnect option for external ssd when shutting down Dex

Is there a option for automaticly disconnect mij external ssd when i shut down my dex envoirment?
I use routine options for connecting with and disconnecting with my bleutooth mouse and keyboard. And also for using the monitor speakers natively for my audio.

I use my s23ultra trough a usb c cable connected to a 4k monitor with usb hub. The external ssd is connected trough that usb hub. Would be nice to automatic disconnect when shutting down Dex. Now i have to go to my phone and mannually disconnect. Could not find a option in routines.
Is there an other option?

Thanks

Hi @thomaslambregts
As per my knowledge, it’s not possible since your SSD is connected with the OS via I/O and DeX program don’t have that capability of disconnecting I/O devices.
Rather, I guess you could do it by programmatically using Android’s Broadcast Receiver, actually a custom made app. You need to catch the DeX exit event using the broadcast receiver and select the SSD device to disconnet.