WTH doesn't alerts support triggering scripts

WTH are alerts only support triggering a notify? Supporting scripts would be awesome.

I’m having a script that:
1 - if people are at home; only notifies those people
2 - if theres nobody; sends notify to the person last leaved home (within the last 5 minutes)
3 - if theres nobody; sends notify to all persons

This can’t be done using alerts. Automations support that, but it’s harder to archive things like skip first X messages, repeat every 30, 60, then 90 minutes, and so on.

How about having the alert integration just directly support the script syntax, and create variable(s) with the message details? That way you can notify if you want, or do a couple of different things directly in the alert config, or have it call a script.

FWIW, in the meantime, the “work around” I’ve seen used is to use a “dummy” notify that does nothing, then have an automation that watches for a call_service event that calls that notify. The automation actions can then do whatever you like.

Supporting the script syntax would be awesome, yes. But having this case inside the script works better for me, as I use it in several automations.

And thanks for the workaround, that could work at least for now.

Sorry, I’m not following what you mean. Can you elaborate?

In case it’s not clear what I meant, it might look something like this:

alert:
  xyz:
    ...
    action:
    - service: script.blah

Where that action key can accept anything that can go in a script or automation, including calling a script.

Would love this as well. Running into significant limitations with Alerts right now due to the inability to call a script (or more specifically MQTT Publish, even by proxy via a script).

I like the fact that Alert can track things like my Garage door being open # number of minutes. But, I don’t understand why I can’t just run a script?

1 Like

Another option would be to allow Alerts to trigger automations. There are workarounds like this but something native would be much nicer for lots of reasons.

Perhaps this could be accomplished via an event that is created when the Alert triggers then the Automation can listen for that as a trigger? Maybe it needs it’s own, new mechanism.

By allowing direct trigger of automations you could call scripts and do a bunch of other things too. My use case is to just get a script to run but doing it via an Automation (and the added power that comes with that) would be a good solution too.