Hey all, so as the topic states, im looking for a simple way to exclude other automations to run or at least don’t mess with the important one while one specific automation is running. In my case I need the iRobot automation to have the light on, and then them to be turned off when he docks, what works flawlessly, but the problem is, that there are other automations that get triggered, for example the movement sensor light on and off, and that messes with the iRobot automation witch results in lights being of at the end…
The idea on its own wasn’t working here, but since its like exactly the same topic, im just updating it…
Looking for a template for → If the iRobot Script isn’t working, when a movement is detected and the Brightness is below 50 lux turn on the light, if there has been no movement for 20 sec, and the robot script isn’t running, turn off the light
Since you didn’t post the “iRobot automation” I’m going to assume that the automation triggers then performs the action and finishes with no built-in delays.
If that’s the case then you could put a condition in your other automations that checks the state of the iRobot and if it’s in a “running” state (whatever that is since I don’t use one) to prevent the other unwanted automations from running during that time.
I did put in the iRobot automation, it’s the first thing there, it’s just a simple clock automation, the only thing it does is start the script ( second thing ) each day at 18:00. And the idea sounds good but kinda wouldn’t work, one of the automations will be powering off all lights when last person leaves home, but at the same time, iRobot lights should stay on…
you want the lights off after the vacuum docks. But you don’t want the lights to be turned off during the vacuum cycle by motion detectors sensing no motion. Is that correct?
if so then (based on the automations you provided in the link) add a condition to the “Movement Sensor Off” automation to have the vacuum docked in order for it to run and turn off the lights.
You don’t show that one in the link but why couldn’t you put in the same vacuum condition for that automation too?
the kinda problem is, I would have to do it with almost each automation later on also, can I just create a new thing / rule / automation that says, the robot script is the king, don’t mess with him while he’s running ?.. instead of correcting each automation that could run in the same time as the irobot one ?
I already did in post 2 above but i’ll make it more specific.
Using your existing “movement off” automation in your link just add the condition:
- id: '1655769740983'
alias: Storage Room Motion Light Off
description: ''
trigger:
- type: no_motion
platform: device
device_id: a7c16b625014e54702a0eb60f899c17b
entity_id: binary_sensor.motion_sensor_storage_room_occupancy
domain: binary_sensor
for:
hours: 0
minutes: 0
seconds: 3
condition:
- condition: state
entity_id: vacuum.darth_vader
state: docked ## <--this is the part I'm not sure about since i don't have one to know the state required
action:
- type: turn_off
device_id: 1b063fe6b9f5a6f80e4a64227a8056ce
entity_id: switch.0x54ef4410003b3633
domain: switch
mode: single
in the above the automation to turn off the lights won’t run unless the robot is docked.
While it is possible to do that it’s usually not the best practice because you could get into a state that you aren’t sure if the automations are on or off and it makes troubleshooting those non-running automations more difficult. “is the automation not running because of the trigger or condition not being met or did I completely forget that I turned the automation off last week?” (yes speaking from experience here… )
Makes sense and seems to be good for my case but what about the brightness part there ? and do I need to use both device ID and entity ID in such an automation ?
The problem is that you are only triggering the automation once on motion detected.
The way you have it now the sequence is:
motion detected
check conditions
if conditions are all true
turn on the light
** check to see if there was no motion detected for more than 10 seconds
if no motion for 10 seconds then turn off the light.
the problem is in the ** portion.
you triggered the automation by motion detected so that no motion for 10 seconds section fails immediately. So the light doesn’t get turned off.
you can solve it by creating a second automation to turn the light off or you can use a wait_for_trigger instead of the if/then construct.
that way it will wait for the no motion for 10 seconds to occur then turn off the light.
The one big issue with the wait_for_trigger is that if the trigger takes a long to time to happen (continuous motion for a long time) and automations get reloaded then the automation gets reset and the light never turns off then either.
if that is acceptable then this should work (I wrote the change in yaml since I never use the UI):