automation:
- alias: Turn on kitchen light when there is movement
trigger:
platform: state
entity_id: sensor.motion_sensor
to: 'on'
action:
service: light.turn_on
entity_id: light.kitchen_light
- alias: Turn off kitchen light 10 minutes after last movement
trigger:
platform: state
entity_id: sensor.motion_sensor
to: 'off'
for:
minutes: 10
action:
service: light.turn_off
entity_id: light.kitchen_light
But how could I implement it with the Automations UI?
If it canât be, then can I just paste it into my automations.yaml file (with appropriate modifications to suit my set-up), ignoring the fact that it hasnât got a HA generated id?
Jim
Whereâs the problem with the automations UI? Where did you get stuck?
Yes, you can. You can add the id yourself, just needs to be unique. You could also create an additional, separate file for automations you wrote manually and keep the ânotmalâ one for UI generated automations.
See here for more details
The example shows just one âautomationâ, but includes two âsetsâ of âTrigger->Actionsâ. When you get to the last Action in the UI, you canât continue by following it with a further âTrigger->Actionâ.
Because itâs two automations not one. You need to create one for turning it on and a second one for turning it off. The example shows two automations as well. In the example, each automation starts with a hyphen and alias:
Are you sure that these automations fit in your setup? How long does it take until your motion sensor changes from âonâ to âoffâ once there is no more motion? There are some motion sensor where you can adjust this, but for some itâs fixed at e.g. 5 minutes, this would mean it would actually take 15 minutes (5 motion sensor + 10 automation) for the light to turn off after no motion.
Like Burningstone said, there are two automations in the example. What leads you to interpret it as being only one automation?
If itâs the presence of the word âautomation:â then that simply serves as a heading to indicate that everything beneath it are automations. Take note of the format. The word âautomation:â is not indented and then each automation beneath it begins with a hyphen.