I just added a Dome motion sensor so I can turn my basement lights on as I walk down the stairs. To do this I set up an automation to turn on 4 lights when motion is detected and I would like to turn them off if no motion is detected after 10 minutes. I have setup a 2nd automation called “Motion Off” (Not sure if I can do everything in one automation)
What @myle said… but specifically with lowercase O … also I haven’t used the automation editor in a really long time but I do remember “For” not working from the editor (or it’s possible it wasn’t available at the time). But any automations I used “for:” in I had to manually edit… definitely worth it to try manually making your automations… you will thank yourself later …
then i would
do a records automation run the automation editor
- id: '1566823459891'
alias: New Automation
trigger:
- entity_id: sensor.ir_codes
platform: state
to: DOWN
action:
- data:
payload: IR-DIM DOWN
topic: IR/CODES
service: mqtt.publish
- service: script.turn_on
entity_id: script.gas_down
look at read and try to understand it
then I would Cut out of the automation.yaml file
and paste into a file inside the automations folder
#=======================================================================
# Dim the gas heater when i press the CH down on the TV remote
#=======================================================================
- id: CH DIM DOWN FOR GAS HEATER
alias: CH DIM DOWN FOR GAS HEATER
trigger:
- entity_id: sensor.ir_codes
platform: state
to: DOWN
action:
- data:
payload: IR-DIM DOWN
topic: IR/CODES
service: mqtt.publish
- service: script.turn_on
entity_id: script.gas_down
the other good thing about doing it this way you can add comments in and they dont get deleted
I did get the motion detector to turn the lights off after 10 minutes of inactivity. I changed “off” to lowercase as you recommended in the automation editor and it worked perfectly. Newb error lol
I even put a condition in to only turn the lights on when motion is detected up to 30 minutes before sunset as I already have another automation that turns certain lights on in the area the sensor is at sunset.
The only thing I am not sure about is if this can all be done in one single automation? Currently I have an automation for turning the lights on when motion is detected and another automation to turn the lights off after 10 minutes.