Noobish Automation questions

Hello. I’m just getting started on Home Assistant. Since this is all new to me, I have what is probably a set of N00Bish questions about automations and scripting.

Starting with the project at hand: I have several Reolink cameras connected to an NVR. The Reolink iPhone app is OK, but it doesn’t send a picture along with the PUSH notifications (for easy diagnosis of person detection). It also does not support the idea of a “temporary mute” on motion, e.g. don’t want to see a bunch of messages if I’m in my back yard.

I’m starting to test automations to detect motion and to send a snapshot via a push notification when that happens.

This has led to two high-level questions:

  1. What to do about persistent variables? Would this be a template sensor possibly? The goal would be to store whether I have called for a “mute” for a particular period of time or not. This variable should stay active beyond any single automation.

  2. What about modular programming? Can I call a script including an input parameter? I will have multiple automations (one for each camera) and it would be nice to call a script and pass the snapshot filename as the only thing that changes across cameras.

Sorry for the basic questions, and guidance very much appreciated.

For your mute, if you are looking to have it for a standard time, then i would you a toggle helper (for mute on/off) and then have an automation that if the toggle helper has been turned on for x time, turn it off. You can then use the state of this toggle helper in other automations/scripts.

description: ""
mode: single
trigger:
  - platform: state
    entity_id:
      - input_boolean.mute_motion
    to: "on"
    for:
      hours: 1
      minutes: 0
      seconds: 0
condition: []
action:
  - service: input_boolean.turn_off
    data: {}
    target:
      entity_id: input_boolean.mute_motion

Yes you can pass values to scripts. See scripts documentation.