#Best practice - 1 Automation or split into 2 ("separation of concerns")

1 messages · Page 1 of 1 (latest)

rugged quiver
#

Hi,
I'm designing an automation to monitor an RF dog fence to alert the family when it goes offline or suffers a fault. Onne of my requirements is to detect when the Zooz relay module I'm using has gone offline (if it's offline, it can't monitor the fence controller operation). To implement this "heartbeat" or "watchdog" feature I need to ping the Zooz Z-wave device regularly. The rest of my automation would be what you might imagine, e.g., "If controller is on and the fault detection alarm is active, do XYZ" - in other words, it's event/state change based rather than anything running on a schedule or loop.
I'm thinking the clean design here would be two automations;

  1. the ping/heartbeat trigger which is responsible for triggering a device status update.
  2. The event/state based automation that checks for offline device or other conditions that indicate a problem.

I just wanted to ask here if this would be the best practice or if HA has some automation concepts or structures that cleanly support a mixed-type automation like this?

hidden fern
#

It is user preference to run this on one automation or to separate it into two.

You’d need a time-based trigger to control pinging the relay, and you’d need a state trigger to start whatever notification or alert actions you want to perform when the device changes to offline.

If you have both triggers in the same automation, you can give each trigger an ID, and then use a choose action to run the appropriate actions based on which trigger ID started the automation