Best way to avoid automations or actions interfering with each other

I have a use case which is probably very common. I have a motion sensor that turns on the bedroom light but I don’t want it to turn on when
a. I have a Sleep scene activated
b. the light is switched on manually with the automatically created default button.

I have seen discussions to create a virtual sensor and check for it but the downside is wouldn’t I have to delete the default on / off switches and recreate them manually to set that sensor , same for any other automatons or scenes using that light.

Isn’t there a simpler way that lets me only update the motion sensor automation to check and abort if something else turned on the light ?

Also, what’s the correct way to replace the sleep scene cause I can’t set a state variable in a scene to disable the motion sensor automation

There is probably a more simple/better way to accomplish it but you could always use two helper switches. That way for whatever automation your using, when the switch is on, the automation won’t turn on.

So in your motion automation you would set two conditions

condition 1: the switch has been turned on manually (ie helper 1 has been triggered

condition 2: your sleep routine is running *ie helper 2 is on which will be turned on by your other script

Then if either condition is true, you can set a command to terminate the automation. This is all fairly easy to set up with the default UI

hope that helps until someone smarter than I comes along… :slight_smile:

Yeah, that seems like a good approach. But condition 1 is what I have concerns with.

If I need to set a helper switch when the switch has been turned on manually, I would need to delete or edit the switch that home assistant has automatically generated and then somehow alter it to also enable the helper switch (and I’m not sure how to do that)

Additionally, isn’t it a better approach to just check whether the light is already on in the motion sensor automation. If it’s already on then it means it was turned on either manually or by some other automation and then abort.

That way I don’t have delete and recreate the already existing switches manually to add in helper switches.

Thoughts?

Well what i meant was tie the manual button to a script that sets the helper, instread of just turning the light on. No deleting of anything required… I’m still sure there is a better way to do it. I just can’t think of anything. I’m pretty limited in what I actually understand about Home assistent works. The only reason I’ve gotten as far as I have is they keep making the UI easier to use lol