84
submitted 2 weeks ago* (last edited 2 weeks ago) by [email protected] to c/homeassistant

This is surely common knowledge for some of you but I thought I'd share a story, as this just made me cringe

I never understood the point in the option to "run actions in parallel" I thought if I had a list of actions to complete, HA makes it through them almost instantly, and with the varying latency of each action they wouldn't complete at the same time anyways.

Then I tested my smoke alarm notification that I have had running for over a year.

It went-

If: list of smoke alarms detects smoke Then: Turn on the lamp next to my bed, then Send a notification to my phone.

I had made an error when setting up the lamp entity. (I made it full brightness on both scales, can only use one) this stopped the automation before the notification went out to my phone.

If it's important that the automation makes it to the end, run in parallel!

Talk about a false sense of security

top 14 comments
sorted by: hot top controversial new old
[-] slazer2au 57 points 2 weeks ago

This is also why testing is important. Speaking of which, when was the last time you tested your backups?

[-] [email protected] 26 points 2 weeks ago

OK daddd (or mommm) it probably is time for me to test my backups haha

[-] slazer2au 12 points 2 weeks ago

Good on ya kiddo. If you want we can go to the park and play some catch after dinner.

[-] [email protected] 19 points 2 weeks ago

I gotta be honest, I'm not sure I'd be willing to trust something I set up myself with general-purpose software to handle something as important as a smoke alarm alert.

That's the sort of thing that gets hardware dedicated to the task and doesn't rely on me configuring everything correctly and Linux not crashing because some other unrelated process had issues.

[-] [email protected] 20 points 2 weeks ago* (last edited 2 weeks ago)

Yes this is in addition to the normal alarm. The light is incase I'm sleeping, as I may not hear the basement alarm going off. The notification is if I'm not home.

[-] [email protected] 13 points 2 weeks ago

I would assume that turning on the lights and sending a push notification would happen in addition to normal smoke alarm things. An alert on my phone would be nowhere near enough if there was a real emergency, but it would be super helpful if I was out of the house

[-] [email protected] 7 points 2 weeks ago

I assume that this automation is in addition to the normal alarm from the smoke detectors, but I agree with your sentiment

[-] [email protected] 15 points 2 weeks ago

Parallel stuff is also used for... Well, some sequences you want to run in parallel.

[-] [email protected] 4 points 2 weeks ago

That was insightful

[-] [email protected] 1 points 2 weeks ago

Could you give som examples of where it’s desirable ?

[-] [email protected] 2 points 2 weeks ago* (last edited 2 weeks ago)

Let's say you have 2 scripts that do some stuff:

  • script A: turns a light pink for 20 seconds and then through a smart speaker you can hear 30 seconds of La Macarena.
  • script B: send 25 notifications to your phone, spaced by 30 seconds, in which each notification is a different letter of an encrypted message.

If you want those things to happen independently you must parallelize them.

So think about an automation that at a certain point you want to launch multiple scripts. I'd always parallelize, even if initially these scripts were "instantaneous", because you might change these and add more complexities in the future.

[-] [email protected] 14 points 2 weeks ago
[-] [email protected] 2 points 2 weeks ago

Nice tip. Thank you. I was similarly confused

[-] [email protected] 2 points 2 weeks ago

Also, test your automations! Specially those critical. It's very essy, you can virtually trigger them.

this post was submitted on 18 May 2024
84 points (98.8% liked)

homeassistant

11261 readers
100 users here now

Home Assistant is open source home automation that puts local control and privacy first. Powered by a worldwide community of tinkerers and DIY enthusiasts. Perfect to run on a Raspberry Pi or a local server. Available for free at home-assistant.io

founded 1 year ago
MODERATORS