HA automation get notified of who opened or triggered device with time

Looking to add some more data to the notifications i received on my phone of when the gate is opened. Id like to add which user device triggered opening the gate and time. (I have 10 users on our house and it will be nice to get some more info when gate is opened)

Thanks a lot in advance!

Hello @jjramirez1991, I’m gonna do a shameless plug right here.

Here’s a blueprint I came up with, using the new fields.
It allows you to configure preset notification scripts to your mobile devices.
You can then use these notification scripts in your automation.

In the latest beta version, you’re also able to override the content of the message and the target device, as well as use template to customise the content from the automation itself (examples provided in the post as well).

P.S. To see what information is available to use in templates, you can fire the automation once via the trigger, then check the Traces page of the automation.

You should find variables that can be used on your automation under the Changed Variables tab of the trigger.

here other photo of the same automation, it works but looking to add some more info to the notification, any help is greatly appreciate


it

FAQ Guideline 11 - Format it properly

FAQ Guideline 14 - Screenshots

Don’t post a screenshot of the automation, post it in YAML format.

Sorry im new here, but here of the yaml

alias: Opening Ace Link Gate
description: ""
trigger:
  - platform: state
    entity_id:
      - cover.ace_link_gate
    to: opening

condition: []
action:
  - service: notify.mobile_app_s23_ultra_jonnathan
    data:
      message: "Opening Ace Gate by "
mode: single

You might want to read up on this:

If someone manually opens the gate (via its control switch), Home Assistant has no way of knowing that person’s identity.

If they open the gate via Home Assistant’s UI, then their identity is known. However, the process of determining their identity requires a bit of work.

  • The automation’s trigger variable contains a context property and it contains three other properties: id, parent_id, and user_id. Depending on the values of these three properties, you can determine if the cover was activated manually, by another script/automation, or by a user. Multiple conditions are used to make this determination (here’s an example to determine if the entity was manually controlled).

  • If it was activated by a user, the only thing it will report is a user_id (containing a long alphanumeric string).

  • The final step in the process is to identify which person entity has a matching user_id and that entity contains the person’s name. Alternately, if you’re not using person entities, you can create a hard-coded cross-reference table of user_ids and names (example).

1 Like

Amazing! it works amazing! Thanks a lot for the quick turn around!

1 Like