How to make an old fashioned three way (three brightness) table lamp - smart?

I got it worked out and will post an update shortly. The updated is the second configuration in this post.