Nested state contexts
Tasker supports grouping of states in profiles from the beginning. The enter task starts when all states become active, the exit task starts when one of the states become inactive.
The notion of nested contexts proposed here changes the behaviour of the exit task only. Namely, contexts in a profile are ordered, there are broad contexts and narrow contexts, the exit task starts if a narrow context becomes inactive while all broad contexts are still active.
For example let's consider simple profile
profile HomeAtNight
broad state Time from 22:00 to 6:00
narrow state WIFI Connected HomeAP
enter task
exit task
Тhe enter task starts when both Time and WIFI contexts become active, the exit task starts when the WIFI context deactivates and the Time context is still active. If the Time context deactivates first, nothing happens.
Nested contexts shall follow the macro-strategies for keeping power usage down as stated in the Power Usage section of Tasker Userguide. There is no need to actively monitor the broad context while the narrow context is active, for example. The check of the broad context may be postponed until the deactivation of the narrow context.