#What I am trying t o accomplish is

1 messages ยท Page 1 of 1 (latest)

haughty obsidian
#

Ok, that's pretty easy. So, whenever one of you arrives into the zone, open the door? Do you want the inverse of that too?

grave tiger
#

no- I don't feel confident in closing the door - too many variables there.. I just want it to open...

haughty obsidian
#

Ok. What are the conditions for the door opening? Anything specific you can think of?

grave tiger
#

cell phone enters the home zone.. thats what I am using as a trigger and it seemed to work fine..

#

that is, till my wife and I were in the same car and returfned home together and both automations ran- there by stopping the door at 1/3 up

haughty obsidian
#

Ahhhhh gotcha. Ok, that's what I was looking for. So, really what you need is 3 triggers. One if you arrive home, one for your wife and one if you're together.

#

This can be one automation, tbh.

grave tiger
#

I am also considering adding my teen daughter into the mix..

haughty obsidian
#

Still easy.

grave tiger
#

I am contemplating using 3x "When" triggers with event IDs...

#

then usinfg a choose to go to a set of actions depending on who is coming home..? hmmm.. still don't know how it would act if two of the "When" evals returns as true..

haughty obsidian
#

So, the easiest way to accomplish this is exactly that. Three entity state triggers (one for each of you) and the mode set to single.

grave tiger
#

I am not surei get the "single" mode thing...

#

I've seen it mentioned...

haughty obsidian
#

That's where the single mode comes into play. It only allows one instance of the automation to run.

grave tiger
#

not sure what it means though..

haughty obsidian
#

But, I'd add a delay into the automation at the end to allow ffor the door to be completely open before the automation stops.

grave tiger
#

I mostly use the gui editor as I am trash when it comes to yaml and indention.. ๐Ÿ˜›

#

so "single" means the automation takes off when one of any of the triggers is true, then wont restart or something?

haughty obsidian
#

So, there are 4 modes for automations/scripts:
1, single = one instance only at a time
2. restart = if the automation is already running, stop it and start again
3. parallel (max #) = allow multiple instances of the automation to run at the same time
4. queued (max #) = Run the automation, but queue up multiple instances if the triggers fire again.

#

dotsvertical > Mode will allow you to change the mode in the UI. ๐Ÿ™‚

#

Do you know roughly how long it takes for the garage door to open?

grave tiger
#

I guess like 6 seconds maybe 8?

haughty obsidian
#
description: ""
mode: single
trigger:
  - platform: state
    entity_id:
      - person.bill
    from: not_home
    to: home
  - platform: state
    entity_id:
      - person.bill
    from: not_home
    to: home
  - platform: state
    entity_id:
      - person.bill
    from: not_home
    to: home
condition: []
action:
  - service: cover.open_cover
    target:
      entity_id: cover.dining_room_curtains
  - delay:
      hours: 0
      minutes: 0
      seconds: 30
      milliseconds: 0
grave tiger
#

I'm also just starting on automations for signficant things... still trying to figoure out if they shoud be device-centric or person-centric or purpose-centric or..

haughty obsidian
#

NEVER device centric. NEVER.

grave tiger
#

so like, if I had a garage door automation where it looked for various things to change its state, that would be bad..?

haughty obsidian
#

Ahhhh, no. That would be fine.

grave tiger
#

so device centric means more like "lightbulb #1"

haughty obsidian
#

Sorry... thought you meant device triggers and actions. Avoid those.

#

Yup. I got ya now.

#

So, the way that I have my automations are basically in terms of areas/devices/events, if that makes sense.

grave tiger
#

this is all just musing about things at the moment.. For example, I made one automation for each zone.. like Wife Wirk Me Work Wife Home Me Home etc

#

so if I made it person-centric, I could have triggers for Wife Home Wife Work Wife Store etc

haughty obsidian
#

Yup and that's perfect. You could combine them into a bigger automation, but there are pros and cons for that.

#

Yeah, you could do that too.

#

Either way works and it really boils down to how your brain works. So, for me, I think of my automations in terms of areas first (Attic, bathroom, hallway, living room, etc). Then, I do my automations by what I need to happen in that area.

grave tiger
#

so.. I suppose I could make a single automation for "Home Zone" and then have it watch for each person exit/entry and then do stuff based on that. hmm though, I am trying to think if that risks another unintended consequence.. like I am driving oout as my daughter returns from a walk so we have an enter and an exit at the same time...

#

if its in single and timed to wait, it might not see the trigger of daughter retuns from walk

haughty obsidian
#

That's where the mode and holding state comes into play.

#

Actually, if you are leaving, unless you have triggers setup on that, it would be fine. The automation above would still fire.

grave tiger
#

I do have leaving triggers to send txt messages to wifes phone

#

eg "Me has left home"

#

or "wife has left work"

haughty obsidian
#

Eh, those would be fine. But, you can also do things based upon how many people are home as well. zone.home returns an int of how many people are in the zone.

grave tiger
#

"wife has left work" goes to my daughters cell so she knows she has about 30 mins to do everything my wife asker her to do that day ๐Ÿ˜๐Ÿ˜‚๐Ÿคฃ

haughty obsidian
#

lmao that's actually pretty awesome.

#

Yeah, all of those would stiil fire and I would keep them in separate automations.

grave tiger
#

so all the "left <zone>" in one automation and all the "entered <zone>" in another..?

haughty obsidian
#

Yup

#

That way you have concurrently running automations.

#

So, you could do separate automations for you leaving/arriving, your wife leaving/arriving and your daughter leaving/arriving. So, 6 automations total.

#

Plus, don't be shied away from having a lot of automations. HA can handle it.

#

I have 99 (right now) for my tiny house.

grave tiger
#

I also am doing multiple actions in parallel- is that a best practice..?

#

example:

haughty obsidian
#

You mean in a parallel block or multiple automations all firing at the same time?

grave tiger
#
      - conditions:
          - condition: trigger
            id:
              - home-yes
          - condition: sun
            after: sunrise
            before: sunset
        sequence:
          - parallel:
              - device_id: b55035b38e57772127407ff4afafb367
                domain: cover
                entity_id: 300e86600bda34f495c8c7220f4f0af3
                type: open
              - service: tts.speak
                metadata: {}
                data:
                  cache: true
                  media_player_entity_id: media_player.alarm_speakers
                  message: Vern has entered home zone. Opening garage door.
                target:
                  entity_id: tts.home_assistant_cloud
              - service: notify.mobile_app_kyms_iphone14
                data: {}```
haughty obsidian
#

Get those device ids out of there and we'll talk ๐Ÿ˜‰ lol

grave tiger
#

yeah.. those are created by the gui.. ๐Ÿ˜ฆ

haughty obsidian
#

Ok, so parallel can be tricky. You have no control over what order they fire in.

grave tiger
#

I was gunna post the screen shot from the gui but this stupid discord doesn't allow gfx pastes ๐Ÿ˜›

haughty obsidian
#

So, in that parallel block, the tts.speak can fire after the notification.

#

Yeah, I know... lol it bit me too.

#

changes ARE coming soon

#

I prefer the yaml code anyhow ๐Ÿ˜‰

grave tiger
#

I am interested in the alerts happening asap... I put them in parallel since it seemed they wouldnt conflict with one another since they all went different places...

haughty obsidian
#

Right and that's fine.

#

Just be aware that in parallel blocks, some things may happen before other things.

grave tiger
#

wait., what? that makes no sense

#

"these parallel things happen in this sequence" seems like ..uhmm

haughty obsidian
#

For instance, I have a message handler script that gets a generated message from Google AI. The first thing I have to do is create variables, then call google, then I can process the rest. So, a prallel block wont' work for me.

#

Yup. It doesn't work that way in HA.

#

Some of the caveats of running actions in parallel:

There is no order guarantee. The actions will be started in parallel, but there is no guarantee that they will be completed in the same order.
If one action fails or errors, the other actions will keep running until they too have finished or errored.
Variables created/modified in one parallelized action are not available in another parallelized action. Each step in a parallelized has its own scope.

grave tiger
#

For the most part, every action shold happen as close to the trigger as is possible.. I want the text message to come right away.. I want the tts to announce the person, I want the door to open all as soon as the trigger is detected...

haughty obsidian
#

And usually that will happen. But it's not guaranteed.

#

Each action gets thrown off to a separate thread (for all intents and purposes). There's no guarantee they'll complete in order.

grave tiger
#

ah.. so "parallel" means to spawn a task/thread to handle each - instead of a thread spawned then wait till its done, then spawn the next thread..?

haughty obsidian
#

Right... async versus sync.

grave tiger
#

ok.. so is the thread spawn in the order the events are listed unde the "parallel" block..?

haughty obsidian
#

Yup, basically the backend loops over the actions and throws them into threads.

#

But, because of the async nature of it, some tasks will complete before others and wiill throw the actions out of order. In your use case, that's perfectly fine. You don't care about order. But in a script like mine, order matters.

grave tiger
#

in an automation, can I have two (or more) triggers have the same trigger ID e.g.
"Me enters home zone" event id "home-yes"
"Wife enters home zone" event id "home-yes"

haughty obsidian
#

Sure.

#

That way, the same actions happen regardless of which one of you triggered it.

grave tiger
#

hmm.. I'm already seeing a problem.. I need separate ids so I can do the right text messages like "Wife arriving home" instead of "someone arriving home"

haughty obsidian
#

Actually... no. But if you strictly want to use the UI, yes. You can determine exactly what trigger fired and use the data there to build the message out. BUT, you'd need to YAML it.

grave tiger
#

I get super frustrated trying to use the yaml w/o the gui.. I make some small mistake and the yaml syntax is blown up and I'm dead and don't kmnow enough to fix it. ๐Ÿ˜ฆ I endup more successful if I stay in the gui...

haughty obsidian
#

You can still use the GUI, but you have to switch the action to YAML mode ( dotsvertical > Edit in YAML). You can switch the entire editor or the individual blocks themselves.

#

BUT... while you're learning, I'd say just stick with the GUI and go with separate trigger IDs.

#

Then use a choose block to determine which one of you actually triggered it.

grave tiger
#

I have to struggle with yaml for all my esphome stuff so I guess I'll eventually give up the "training wheels" of the gui.. ยฏ_(ใƒ„)_/ยฏ

haughty obsidian
#

KISS (until you get better at it). lol

#

tbf, I still do a lot of stuff in the GUI and only switch to YAML if I have to. I can do everything in YAML, but sometimes it's just easier to do it in the UI.

grave tiger
#

good to know...

haughty obsidian
#

Plus, I have to be able to answer questions about both... sooooo, yeah ๐Ÿ˜‰

grave tiger
#

in the esphome discord, I posted my most recent builds.. I "upcycled" some old tech gear including an old 1970's desk phone speaker and a pair of 1980's radio shack mini intercoms.. ๐Ÿ™‚

#

I put them in the "show off" section ๐Ÿ˜

haughty obsidian
#

I remember the intercoms! I helped you with that automation too ๐Ÿ˜‰

grave tiger
#

ah- yeah! ๐Ÿ˜„

#

I put the photos of the build up there now.. plus took more photos of the bell speaker phone one

#

ok, I'm gunna see if I can muddle my way through re-architecting the garage door automations.. lets see if I am back here sobbing in an hour or so ๐Ÿ˜‚

haughty obsidian
#

I'll check them out! And yeah, feel free to pop back (and ping me if you want). Also, take a look at what I sent you earlier. Should be enough to get you started.

grave tiger
#

I don't think I'll have a worse day than the folks over at CrowdStrike tho ๐Ÿค”

haughty obsidian
#

Screw CS. I'm happy to see them burn. lol

grave tiger
#

there are some really hilarious memes floating..

haughty obsidian