Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notify Engine update and documentation #67

Closed
BeardedTinker opened this issue Jul 30, 2021 · 5 comments
Closed

Notify Engine update and documentation #67

BeardedTinker opened this issue Jul 30, 2021 · 5 comments
Assignees
Labels
documentation Improvements or additions to documentation Enhancement New feature or request Notification Everything related to notifications

Comments

@BeardedTinker
Copy link
Owner

As Notify Engine is subject of one of my future videos, you can read here more documentation.

I have first started using this script by @CCOSTAN year ago and one of the first things I did was to adapt it to support some specifics of the Android Companion App options.

This script will work with most notification platforms that Home Assistant has integration with (TBH - all I've tested so far work, but potentially there could be some that are not supported at the moment).

Script only requires MINIMAL configuration, and that is for you to customise part with available notification platforms in your system.

    - service: >
          {% if who == 'person1' %}
            notify.mobile_app_eml_l29
          {% elif who == 'person2' %}
            notify.mobile_app_ele_l29
          {% elif who == 'kid1' %}
            notify.mobile_app_iphone
          {% elif who == 'kid2' %}
            notify.mobile_app_fig_lx1
          {% elif who == 'parents' %}
            notify.parents
          {% elif who == 'family' %}
            notify.family
          {% elif who == 'discord' %}
            notify.andrej_discord
            {% else %}
            notify.telegram_bot
          {% endif %}

You can add as many integration here as you wish and also by using groups you can group multiple notification platforms into new group (in this example parents, family and discord are multiple devices and services under single name).

And if you want to use it, you just have to call this script from any automation where you need to call it, and provide variables that would customise notifications.

For example, this is what I call from automation if front door is open:

- service: script.notify_engine
  data:
    who: 'family'
    title: '🚪*Front door*'
    value1: 'Front door is open! Outside temperature is {{ states("sensor.balcony_temperature") }}°C'
    tag_id: 'warning'
    group: home
    color: '#ff0000'
    target_id: !secret telegram_bot_chat_id

And you do have a lot of variables you can play with.

Main ones are:
who: List of available platforms and variable that is used to select where to push notification
title: Title of the message - not all notification platforms support this
value1: value2: value3: Value variables are used as messge body. Up to 3 lines can be used
target_id: Some platforms require you to specify target ID of the channel for message in ex. Discord, Telegram etc

As minimum, for basic notification platform, you need value1: That is just single line of message. And if you do not specify who: , default platform will be used.

Additional variables that can customise for your notifications look or behave are these:
subtitle: Subtitle can be used for text under the title (subtitle in iOS, subject in Android)
clickAction: Used toprovide URL that can be called after clisking notification (url in iOS, clickAction in Android)
tag_id: Used to tag notifications, useful for mobile app notifications
group: Used to group notificatrions, useful for mobile app notifications
sticky: Android specific - true will make notification stick even when you press on it, default is false
color: Android specific - change notification color. can use hex code or color name (#ff0000 or 'orange')
channel_id: Android specific - create or use channel for notification. Default is 'general'
importance_id: Android specific - in combination with channel used to define importance: high, low, max, min and default
vibrationPattern: Android specific - NOT YET USED
ledColor: Android specific - you can use hex code or color name (#ff0000 or 'orange')
timeout_sec: Android specific - allows you to atumaticly expire notification after nnn secons - numeric value, in ex. 900
camera_entity: Disply image
ios_category: iOS specific -
iso_sound: iOS specific - DISABLED
ios_badge: iOS specific - DISABLED

Some variables are platform specific, and whenever possible, I've tried to combine platform specific commands with one single variable. So even if you have Android and iOS devices in your household, they should receive similar notifications.

@BeardedTinker BeardedTinker added documentation Improvements or additions to documentation Enhancement New feature or request Notification Everything related to notifications labels Jul 30, 2021
@BeardedTinker BeardedTinker self-assigned this Jul 30, 2021
@CCOSTAN
Copy link

CCOSTAN commented Jul 30, 2021

I think my notify engine will be broken sooner rather than later with the new updates to the IOS Companion.

CCOSTAN/Home-AssistantConfig#1072

Because of the dynamic actions now, I think passing variables to a script will become a lot harder.. (I think)

@BeardedTinker
Copy link
Owner Author

I see what you mean. Not using actions here, was thinking to implement it without much thought on what huge complexity this really would add in terms of variables. It would be really to hard to manage.

@BeardedTinker
Copy link
Owner Author

Update all my automation that use Notfiy Script to use same set of variables (most of the time).

Now every call to notify_script: has following format and variables:

- service: script.notify_engine
  data:
    who: 'family'
    title: '*Front door*'
    value1: "Motion in apartment! No family member is home"
    target_id: !secret telegram_bot_chat_id
    group: security
    tag_id: 'emergency'
    importance_id: default
    color: 'red'
    sticky: 'true'
#    timeout: 

Also, created Excel file with all notifications and how they are use, to whom they send message etc.
I'm still not using importance_id: so it's currently at default setting for everything, and not all automation have, use or need timeout:.

@carltonwb
Copy link

"Also, created Excel file with all notifications and how they are use, to whom they send message etc."
Very interesting, I keep a spreadsheet for all my devices, with mac, id, software version, etc.
What is your format for the notifications?

@stale
Copy link

stale bot commented Nov 13, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation Enhancement New feature or request Notification Everything related to notifications
Projects
None yet
Development

No branches or pull requests

3 participants