I got the idea for this set of tasks/profiles from my GPS, because it changes intensity and brightness depending on whether you're driving during the day or night, and automatically changes if you happen to be driving from daytime to nighttime.
This set of tasks and profiles will first prompt you to select Car or Desk Mode when plugging USB power into your phone. If you chose Desk Mode, nothing happens (unless you want to change the task to make it do something). It just defaults to whatever your phone normally does when you plug your USB cable into it from your computer. If you've chosen Car Mode, depending on the time of day, your brightness level will either be bright (daytime) or dimmer (night time). The time is checked against sunrise and sunset data for your location (taken exactly from http://tasker.wikidot.com/sunrise-and-sunset-times), and if you're using your phone in Car Mode during the sunrise or sunset time, your display will change to brighter or dimmer depending on the time.
- Plugged In (Plugged_In.prf.xml_ - Main profile - prompts for Car or Desk Mode.
- Change Car Mode (Change_Car_Mode.prf.xml)- stays active while in Car mode to be able to change from daytime to nighttime mode (and vice-versa) if Car Mode is active during sunrise/sunset times.
- Find My Phone (Find_My_Phone.prf.xml)- GPS and Net locator for your phone w/ 100m radius.
- Get Sunrise/Sunset Data (Get_S_S_Data.prf.xml)- runs from Midnight to 1 AM to download the sunrise/sunset times for that day.
- Car Mode (Car_Mode.tsk.xml) - the initial automatic daytime/nighttime mode selection.
- Change Car Mode (Change_Car_Mode.tsk.xml) - changes daytime/nighttime mode while Plugged In is active.
- Daytime Car Mode (Daytime_Car_Mode.tsk.xml) - Sets Stay On (with USB Power) (if this doesn't work, change to "Turn on" under Display->Turn On), Turns off Keyguard, sets Display Timeout to infinite (*,*,*), turns GPS on, turns Auto Brightness Off, and sets Display Brightness to 255 (change to suit your tastes, if desired).
- Desk Mode (Desk_Mode.tsk.xml) - does nothing except what your phone normally defaults to when plugged to a computer.
- Mode Select (Mode_Select.tsk.xml) - Where the Car Mode and Desk Mode are selected.
- Nighttime Car Mode (Nighttime_Car_Mode.tsk.xml) - Sets Stay On (with USB Power) (if this doesn't work, change to "Turn on" under Display->Turn On), Turns off Keyguard, sets Display Timeout to infinite (*,*,*), turns GPS on, turns Auto Brightness Off, and sets Display Brightness to 50 (change to suit your tastes, if desired).
- Plugged In (Plugged_In.tsk.xml) - runs the Mode Select task.
- Sunrise/Sunset (Sunrise_Sunset.tsk.xml) - finds the sunrise/sunset times for the day.
- Unplug Reset (Unplug_Reset.tsk.xml) - Changes all the Daytime/Nighttime values to normal.
Please note that you may have to adjust these tasks to suit your particular OS version. This has been tested only on an HTC Inspire 4G and has been fixed to handle the latest update (2.3.3). Prior to the latest update, in the Daytime and Nighttime Car Mode tasks, I had "Turn On" instead of "Stay On". Keep that in mind if your phone does not stay on.
Also, sometimes the Unplug Reset task will not complete. I have yet to figure out why, but if someone finds a solution (or even can enhance/improve this set of tasks/profiles), by all means, have at it. I am by no means a "Tasker expert", so any help to make this a better function would be appreciated.