Linking this thread to the code I ended up actually using for this. My use case was a little different than dimmer level per mode. I have a Global virtual dimmer that all the dimmers in my house mirror. It fades slowly over time as the night progresses. Haven't looked at that code in awhile, but it's been working for me. The only odd quirk is if you turn on a light it turns on to it's current value, then adjusts to whatever the global is.