If you’re like most people, you probably have a few lights in your home that you’d like to be able to control with a simple automation. Maybe you want to turn on a light for 20 seconds when someone enters the room, or perhaps you want to have a light turn on automatically when it gets dark outside.
Whatever the reason, it’s actually quite easy to set up a light to turn on for a specific amount of time in Home Assistant. In this article, we’ll show you how to do just that.
First, you’ll need to create a new automation in Home Assistant. To do this, click on the “Automation” tab in the left sidebar, and then click the “Add Automation” button.
In the “Trigger” section, select the “State” trigger type, and then enter “light.turn_on” in the “Entity ID” field. This will cause the automation to trigger whenever any light is turned on.
In the “Action” section, select the “Call Service” action type, and then enter “light.turn_on” in the “Service” field. This will cause the automation to turn on the light that triggered the automation.
Finally, in the “Conditions” section, click the “Add Condition” button. In the “Condition” dropdown, select “Time”, and then enter “00:00:20” in the “Value” field. This will cause the automation to only trigger if the light is turned on at 00:00:20 (20 seconds after midnight).
And that’s it! Now, whenever any light is turned on at 00:00:20, it will turn on for 20 seconds.
Other related questions:
How do you set a timer at Home Assistant?
You can set a timer in Home Assistant by using the “timer” service.
How do I turn on Advanced Mode Home Assistant?
Advanced Mode can be turned on by going to the Home Assistant Settings page, and toggling the “Advanced Mode” switch.
How do I add lights to my group Home Assistant?
1. In your configuration.yaml file, add the following:
group: !include_dir_merge_list groups
2. Save the file and restart Home Assistant.
3. Add your lights to the groups.yaml file in your Home Assistant config directory.
4. Restart Home Assistant.
What code does Home Assistant use?
Home Assistant uses Python 3 for its codebase.
Bibliography
- How to Turn Light on only for 2 minutes? – Configuration
- Automation – Use motion to turn on light for some time using …
- Adding delay to turn light off after it’s turned on – Configuration
- Turn light off after X minutes, no matter how it was turned on
- Turn light on for 30 seconds? – Home Assistant Community
- Simple Light automation to turn light ON and OFF according to …
- Light turn on every 2 minutes and 52 seconds – Configuration