Hi, @xman111 - here’s a possibility to consolidate things a bit.
First, create a notification group - then all you need to do is notify the group instead of each person individually. Place the following in your configuration.yaml under notify: (or in your notifications.yaml file if you are using that) and, unfortunately, there isn’t a reload for notifications so you have to re-start (unless someone else knows an easier method):
I used two “pairings” in the automation - one for home and one for school. You can copy/paste those to add more zones to the automation. I can’t find where these can be combined together into something like this that simplifies it even further (maybe a future update will address it):
zone:
- zone.home
- zone.school
The action section is then the service call to the group you set up in the notify: section of your config file. The template in the data section simply pulls the info from the trigger.event and the trigger.entity_id. Note that the template is generic and shouldn’t need to change when you had more zones to the trigger section.
Coming clean: I wasn’t able to test this completely, but it does pass the configuration check…
thanks KSC for typing all that out… you guys are awesome… i can’t wait to get home to try it out. I will just backup my config before i mess with everything. i really appreciate it sir!
Yea, I finally set up an automatic backup for all my config files… I’m embarrassed to say how many times I’ve had to recreate things because I didn’t have a recent backup…
yes, it’s quite a bit of work to recreate everything. that is one thing i couldn’t believe that you had to do in smartthings, was happy to see it available in Home Assistant… i have about 15 backups, before Zwave, before Caseta, etc… lol…
i was just thinking about this and have another question. In my arrives home automation, i have it turn on the front lights, turn off our alarm, then notify me and my wife. Can that be done with this as well or should the notify just be by itself and do the alarm and lights in a separate automation?
Definitely it can be done, and is the way I’d do it. Just add the other services to the action portion of the automation. For example:
action:
- service: notify.family_devices
data:
title: Notification
message: >
{% if trigger.event == "leave" %}
{{ trigger.from_state.attributes.friendly_name }} left {{ trigger.zone.attributes.friendly_name }}
{% else %}
{{ trigger.from_state.attributes.friendly_name }} entered {{ trigger.zone.attributes.friendly_name }}
{% endif %}
- service: light.turn_on
entity_id: light.front_lights
# You can add attributes, such as brightness and transitions here, too.
You can make it a little smarter by adding logic to determine if the sun is up or down with a service_template (make sure you have the sun component in your configuration.yaml file:
thanks again, can’t tell you how much I appreciate this. tbe wife and kids are annoyed at how much time I am spending on this, lol. can this all be done in the UI or don’t bother and just straight in the yaml files?
You can’t execute it, you need to enter/leave a zone. When you trigger it manually, it will skip all conditions and triggers and go directly to the action part and the action part doesn’t work because it uses data from the trigger, which is not available when you trigger it manually.
To test zones without leaving your home, you can use the device_tracker.see service.
You have a parameter listed more than once. If you post your automation, we can help figure it out. Sometimes it’s not the exact line, but one near it (depending on whether or not there’s a syntax error in there somewhere)
Yea, that’s why I couldn’t fully test what I posted…
Have to admit I never use the UI. I edit the YAML files directly. The UI interface was good to get started, but I quickly moved to direct YAML editing, including the lovelace files.
hey guys, i did get a couple notifications, going to keep testing… quick question on syntax. i am trying to add another zone but it is work richelle and it didn’t like that. should i rename the zone to a single word?