Tasker is one incredibly powerful automation app, and something that really sets Android apart from iOS. You can detect just about anything from the phone sensors, voice or other inputs, states or conditions, and much more and then create outputs to speak alerts, send texts, change the phone's states, execute tasks, and much more. There are also many 3rd party plugins that work with Tasker to further expand its functionality for example one that automates various conditions to do with motion (driving, walking, etc).
As the short linked article below explains you can program profiles and tasks related to waking up in the morning, something based on the amount of light, when connecting (or disconnecting) to a specific WiFi or Bluetooth, etc. It gives some idea of what it can be useful for but really the sky is not even the limit with this app.
Tasker can get fairly complex as you dig deeper and deeper and I see they are bringing out a simpler version to use, called Tasky. There is also an alternative app called Automate which is a bit simpler to use. Yes there is also IFTTT but that pales in comparison to Tasker. It is well worth buying the premium version of Tasker as it's an app you'll use as long as you use Android.
Tasker is one of those apps that you won't be able to live without once you start using it. Here's how to control all IoT devices.