[Android Apps and Games] yungyeh:
Here is my Night Mode Settings. It basically switches the airplane on for your device automatically after midnight, and switches the wireless network back on in the morning. Additionally, these rules can do much more than a simple switch!

Considering the following scenario after midnight:

case 1:

Playing phone till midnight (@12:00AM), phone is still in use, don't activate airplane mode (using a delay). At 1:00am, done using the phone, turn the screen off and the airplane mode gets turned on. (Display trigger)

case 2:

If any power source is connected, don't turn on airplane mode at anytime. Once unplugging the power source during midnight period, airplane mode gets turned on. (Power source trigger)

case 3:

If no power source connected, or phone is not in use, activate airplane mode automatically at midnight. (Time trigger)

case4:

If I manually turn deactivate the airplane mode, re-activate the airplane mode when the phone is not in use after midnight. (Display trigger)

Then considering the following scenario in the morning:

case 1:

Deactivate the airplane mode at 7:30am.

case 2:

If I get up early, deactivate the airplane mode when I turn on the screen.

case 3:

If I get up early, deactivate the airplane mode when I plug in any power source.

Addtional note:

During midnight period and the airplane mode is activated, plugging in any power source will not deactivate airplane mode.

---------------------------------------------------------------

In order to achieve the automation above, you need to create 4 different rules

[COLOR="DarkSlateGray"][B]1st Rule[/B][/COLOR]
[COLOR="Blue"]Rule description:[/COLOR]
[COLOR="DarkGreen"]Night Mode Start[/COLOR]
[COLOR="Blue"]Trigger:[/COLOR]
"[[Composite OR Trigger]]:
[Triggers on 00:00, Repeat: Every Day (Doesn't wake device)
OR [External power is disconnected from device
OR Device disconnected from USB]
OR Device' screen is turned off]"
[COLOR="Blue"]Action:[/COLOR]
"[[Composite Action]]:
Activate Airplane Mode;
Enable rule (Night Mode End)"
[COLOR="Blue"]Enabled:[/COLOR]
TRUE
[COLOR="Blue"]Delayed Execution[/COLOR]
5 Minutes
[COLOR="Blue"]Active Hours[/COLOR]
Every Day from 00:00 to 06:30

[COLOR="DarkSlateGray"][B]2nd Rule[/B][/COLOR]
[COLOR="Blue"]Rule description:[/COLOR]
[COLOR="DarkGreen"]Night Mode End[/COLOR]
[COLOR="Blue"]Trigger:[/COLOR]
"[[Composite OR Trigger]]:
[Triggers on 7:30, Repeat: Every Day (Doesn't wake device)
OR External power is connected to the device
OR Device' screen is turned on]"
[COLOR="Blue"]Action:[/COLOR]
"[[Composite Action]]:
Deactivate Airplane Mode;
Disable rule (Night Mode End)"
[COLOR="Blue"]Enabled:[/COLOR]
FALSE
[COLOR="Blue"]Active Hours[/COLOR]
Every Day from 06:30 to 07:30

[COLOR="DarkSlateGray"][B]3rd Rule[/B][/COLOR]
[COLOR="Blue"]Rule description:[/COLOR]
[COLOR="DarkGreen"]Power Connected[/COLOR]
[COLOR="Blue"]Trigger:[/COLOR]
"[[Composite OR Trigger]]:
[External power is connected to the device
OR Device connected to USB]"
[COLOR="Blue"]Action:[/COLOR]
[Enable/Disable Rule Action]:
Disable rule (Night Mode Start)
[COLOR="Blue"]Enabled:[/COLOR]
TRUE

[COLOR="DarkSlateGray"][B]4th Rule[/B][/COLOR]
[COLOR="Blue"]Rule description:[/COLOR]
[COLOR="DarkGreen"]Power Disconnected[/COLOR]
[COLOR="Blue"]Trigger:[/COLOR]
"[[Composite OR Trigger]]:
[External power is disconnected from device
OR Device disconnected from USB]"
[COLOR="Blue"]Action:[/COLOR]
[Enable/Disable Rule Action]:
Enable rule (Night Mode Start)
[COLOR="Blue"]Enabled:[/COLOR]
TRUE

PS:

A delay (5 minutes) is added to the 1st rule so the airplane mode won't be re-activated too quick if you manually deactivate it. The delay time also allows you to cancel the execution if the rule attempts to start at midnight due to the time trigger.

I found it's always good to have the 3rd and the 4th rules running all time. :D Since automateIt does not have "current state monitor" and "IF operator", rules like the 3rd and the 4th rules are working similar to a state monitor and helping me to decide which rule should be run "under" certain state, not upon the change of a state.