How to: Motion sensor return to last state with fade

I have set up a motion sensor turn the lights to bright when motion is detected.
When no motion is detected for 30 seconds the lights return to the last state, which is dimmed.

The transition from bright to dimmed is really rapid, I would like to make it slowly fade in about 30 seconds or so. This way you almost will not notice the transition.

Is there anyway I can set this up? I cannot figure it out.