Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 96121

Avoiding device conflicts with multiple automations?

$
0
0

@mmiller7 wrote:

How do you avoid conflicts with automatons that control the same device?

Is there any way to have some kind of global states/function-calls that will let me keep things more organized, and let me keep the light on “if A or B or C said it should be on”?

For example, I have a floor lamp I have a few times I’d like it to be on:
-Based on time of day (morning/evening based on sunrise/sunset)
-Based on if we are home (any time of day)
-Based on future motion/door sensor, for X minutes after entering the room

  • I have the time of day working well (on at X, off at sunrise, on at sunset, off at X)
  • I have working “if we leave home during the day” (device trackers in a group) working to shut off lights but it then gets complex to keep track of edge cases where if we leave after sunset it will turn off when it should stay on because of condition #1
  • I forsee many more complicated edge cases when I add in a door/motion sensor, I’d like to make it turn on for X minutes after the door is opened…but then I don’t know how I will keep it from turning off if you come home near sunset and it should stay on until the specified time

I feel like there has to be a better way than making dozens of interdependent conditions in dozens of automations that interact with overlap…if this was normal code instead of YAML I’d make function calls to “OR” together, or a global integer counting how many things want a device to be on which can increment +1 when another thing wants it on, or decrement -1 when it wants to go off) and then compare if >0 conditions want it on. But I don’t see a way to do that here.

Posts: 4

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 96121

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>