Version without storage permissions:
TOGGLE [T] this flow on/off via the START (never the STOP) button! This allows you to control its state from the widget on your home screen (which doesn't have a STOP button).
When you set your screen brightness to 0 or unlock your phone (if chosen), the brightness is adjusted depending on the ambient light level.
On startup, you will get popups. Select what you want!
-If this program is not setup right (too bright / dark), change the "custom" value at the top of the flowchart.