A simple automation
When this happens, do that.
An automation reacts to an event, for example: "When it gets dark and someone is at home, switch on the light in the hallway."
Create the automation
Settings → Configuration → Automations and New Automation. Give it a unique name.
Trigger
With Add your first Trigger you define what starts the automation, such as a time of day, a device switching on, or detected motion.
Condition (optional)
With Add your first Condition you restrict when it should apply, such as only at night or only when someone is at home.
Action
With Add your first Action you decide what should happen, such as switching on a light or sending a message.
Save
Click Add.
WARNING
Test a new automation before you rely on it, especially for heating, doors and alarms.
More on this: Create Automation, Define Trigger and Define Condition in the integrator handbook.