You can do this by using a virtual switch.
There is a smartapp in the market place called “switch activates home phrase.” “Home phrase” is the original name for “routine.” People typically use this with IFTTT or Alexa, but you could use the same idea for this purpose.
One) create a virtual switch that will eventually run the routine that, say, you want to have run when the mode changes to “asleep.” Creating this switch is a one time step. For now we’ll call it “asleep mode switch.”
Two) use the “switch activates Home phrase” so that the asleep mode switch will start your good night routine.
Three) modify your good night routine so that it also turns off the asleep mode switch. That way it will be ready for the next time.
- now we have to have a way to turn on the asleep mode switch when the Mode changes to asleep. You can set this up with the official smart lighting feature.
Once you have this set up, anytime you change the mode to asleep, no matter how you changed it, the asleep mode switch will turn on. Then when it turns on, your good night routine will run and the asleep mode switch would be turned off again.
You can set up a number of different variations on this, but this will work. I’m sure you could also do it in core.
The only advantage of putting the original mode change inside a routine rather than just doing it through core is that then you can use the official widget feature if you like rather than having to open the app each time. But of course if you were going to do that, you might as well just run the routine that you were having the virtual switch run.
https://support.smartthings.com/hc/en-us/articles/206145893-Is-there-a-SmartThings-widget-
So… I think it would probably be more straightforward to just do this with core, but you can also do it as I described above.