Skip to content
caiosweet edited this page Nov 12, 2022 · 93 revisions

Welcome to the Centro Notifiche wiki. Please feel free to make any changes you want and put it out.

Index

 

New Features

  • Alexa - Added automatic SSML. - Ability to use entity_id, friendly_name or both for the media_player option. - Mobile Push and Dropin notification (not work during dnd mode).

  • Added support for multimedia content (used media_extractor component for Google).

  • Added management of Whatsapp messages. (How to configure it)

  • Added HTML management in Telegram messages.

  • Improvments in menagement of companion app messages: it's possible to send images, TTS messages and more

  • Added management of Email, Pushover and Pushbullet messages

  • Initial support of Discord messages

  • Google Home: added "beta" resume stream function after TTS

  • Actionable Notifications with Companion app and Telegram (BETA)

  • Messages to multiple notification service

 

What This Is

Notification Center is a package for Home Assistant, which works together with the Notifier App in AppDaemon.

 

What It Does

It is used to send, in one place, text messages (Telegram, Push...), TTS Google and Alexa, Voip notifications to you and/or your devices such as Pcs, smartphones, pads, etc.

 

How this works

In summary, you send notifications with the script service ( script.my_notify ) via variables. The script creates an event in Home Assistant, with the name " notifier " and with all the data set in the variables. Appdaemon’s Notifier application, which listens to the notifier event, distributes text, audio, and persistent notifications on the various devices based on the received data. The package must be configured with the secret file, essential to get the right information and avoid continuous changes in case of future updates.

 

Requirements

Before installing this package, you must install the following requirements.

 

Installation

  1. Download the last release from the release page.
    • Initialize the download by clicking on the "Source code(zip)" link at the bottom of the page.
  2. Unzip the file you downloaded wherever you prefer.
  3. Copy the packages folder to the Home Assistant configuration folder (usually /config/).
  4. Compile the secret file with your data.
  5. Restart Home Assistant.
  6. Configure your Lovelace GUI. Here some examples and here my configuration in yaml mode.

 

In the package folder, you will find all the files you need for the Notification Center to work properly.

The file 'secrets.yaml' must be created in the folder 'packages'. Here are the entries related to the entities present in the package.

How to compile the secret file - Click to expand

Section 1

In this section there are entities read by Home Assistant

Input Select Notify [Required]

For text notifications to use as Default.
Enter your text notification services with SERVICE_NAME ( object_id see notes at the end) E.g. notify.nome_del_notificatore will be either "Name del notificatore" or "Name Del notificatore" notify.geronimo will be "Geronimo", notify.family will be "Family", notify.telegram will be "Telegram" motify.telegram_caio will be "Telegram Caio" or "TELEGRAM CAIO" or "TELEGRAM Caio" (case insensitive).

# (Ref. `input_select.text_notify` in `hub_main.yaml` file)
text_notify_hub:
  - Telegram
  - News
  - News Telegram
  - Pushover
  - Discord
  - WhatsApp
  - Pushbullet
  - Test Nome NOTIFICA
  - Mobile App Oneplus A5010
  - Mobile App Macbook pro di Claudio
  - Pushover, Telegram, Mobile App Oneplus A5010
  - Mobile App Oneplus A5010, Telegram
  - Telegram, Discord

Section 2

In this section there are other services read by the Notifier app NB: These options can be commented, deleted or set with Null if not used

Data should be entered in the following way:
SERVICE: SERVICE-NAME ( object_id see notes at the end) or SERVICE PARAMETER Examples:
the service " tts.google_say " will be set thus tts_google: google_say
the service " tts.google_translate_say " (_default*) tts_google: tts.google_translate_say Each service uses different names and parameters and according to your configuration in configuration.yaml Check your services, for each I have also included the link for configuration and/or information

TTS Integration - Google Translate

# Services
tts_google: google_translate_say # or google_say or as you called the service.

Google Assistant Addon - (@AndBobsYourUncle) ~ (@marcelveldt) ~ (@Apipa169)

notify_google: google_assistant

Google Cloud

tts_google_cloud: google_cloud_say

ReversoTTS component for HomeAssistant

reverso_tts: reversotts_say

Dss Voip Notifier by @sdesalve (Gudia HassioHelp)

sip_server_name: fritz.box:5060

Alexa Actions (Wiki)

notifier_alexa_actionable_skill_id: "" # amzn1.ask.skill.a12a1a1a-123a-1234-a123-12345678a00a
  • NOTE

entity_id - domain - object_id - friendly_name For example, a device tracker of the type device_tracker.oneplus_a5010 is thus subdivided

device_tracker.oneplus_a5010
\____________/.\___________/
      ^       ^       ^
      |       |       |
   domain +  dot  + object_id = entity_id (device_tracker.oneplus_a5010)

Format: <domain>.<object_id> . Example: light.kitchen is an entity_id. Normally the dot identifies an entity_id. It is often confused with the "name" of the entity object_id> and the descriptive name friendly_name

A descriptive name is something that a human being can easily read and remember ; O) instead of a numerical code or address and/or identifier. An entity_id that corresponds to " light.kitchen " may have as its descriptive name " Chandelier Kitchen " and as the name of the entity_id (better known as the object ID) " kitchen ". entity_id must always be written in lowercase, with the underscore instead of space and the point of division between domain and object.

Lists can be written in one of the following ways:

# Modo 1
notification_media_player_alexa_hub: [
  "Sala",
  "Studio",
  "Gruppo Alexa",
  "Last Alexa"
]

# Modo 2
notification_media_player_alexa_hub:
  - Sala
  - Studio
  - Gruppo Alexa
  - Last Alexa

This is the main file needed to create the notifier event via the my_notify script ( script.my_notify ). Contains numerous entities, from sensors to calculate the time of day, to the sensor for DND (Do Not Disturb), to the various switches to control priority of messages, text, tts, holidays and more.

To know all the package entities, use this jinja code in dev-tools templates - Click to expand
{% for state in states if 'package' in state.attributes -%}
{% if 'centro notifiche' in state.attributes.package|lower %}
- {{ state.entity_id -}}
{% endif %}
{%- endfor %}
Jinja code to show all HubMain entities - Click to expand
{% for state in states if 'package' in state.attributes -%}
{% if 'centro notifiche' in state.attributes.package|lower
  and 'main' in state.attributes.version|lower %}
- {{ state.entity_id -}}
{% endif %}
{%- endfor %}

This file contains all the entities used for Alexa. If you don’t have any Amazon Alexa devices, you can delete it, saving useless entities in the system.

Jinja code to show all HubAlexa entities - Click to expand
{% for state in states if 'package' in state.attributes -%}
{% if 'centro notifiche' in state.attributes.package|lower
  and 'alexa' in state.attributes.version|lower %}
- {{ state.entity_id -}}
{% endif %}
{%- endfor %}

This file contains all entities used for Google. If you don’t have any Google devices, you can delete it, saving useless entities in the system.

Jinja code to show all HubGoogle entities - Click to expand
{% for state in states if 'package' in state.attributes -%}
{% if 'centro notifiche' in state.attributes.package|lower
  and 'google' in state.attributes.version|lower %}
- {{ state.entity_id -}}
{% endif %}
{%- endfor %}
Some Examples - Click to expand

Credits for inspiration and mechanism

Janet (The Good Place) (@Lentron)

Speech Engine (@CCOSTAN)

Notifications (@mf-social)

Notification Center (@3vasi0n89)

my-home-automation (@happyleavesaoc)

 

Variables

Always remember that these options override those set by default (UI)

Below the data: we will enter all the parameters that relate to our notification, including the actual message, if we do not enter any parameter but only the message the notification center will use all the default settings that we have set in the frontend. I'll leave you a list Complete with the parameters and their operation

Options Type Requirement Default Description
message string Required Message to be sent.
title string Optional None Title for text notifications
Notify string
bool
Optional input_select
text_notify
0, False, Off, No
does not send the text notification.
Notify name or entity_id
send notification to a device other than the default one.
Multiple notification service is allowed
caption string Optional Message Text other than message
image string Optional The file to attach to message or remote path to an image.
link string Optional Add link in text notification Example HassioHelp.
called_number int Optional input_text
phone_called_number
telephone number DssVoip
username o number CallMeBot
if different from default.
priority bool Optional False 1, True, On, Yes
by-pass DND (do not disturb) and all switches or booleans.
no_show bool Optional False 1, True, On, Yes
disables persistent notification.
location string Optional All home: send notification only if at home.
not_home: send notification only if you are away from home.
Alexa bool/dict Optional False 1, True, On, Yes
enable alexa and send the main message.
Other parameters see below in dictionary mode
Google bool/dict Optional False 1, True, On, Yes
enable google and send the main message.
Other parameters see below in dictionary mode
Mobile dict Optional False All data under
Mobile App
Discord dict Optional False All data under
Discord

 

Options Type Requirement Default Description
mode bool Optional False Useful to use as a switch with templates.
message_tts / message string Optional Main message For alexa you can also use message, overwrites the main message anyway and does not pass to the build message template.
media_player string/list Optional selected entity_id, friendly_name or both, for media player, sensor or group. (es. Last Alexa, Studio, media_player.sala)
volume float Optional 0.1 Set the volume to a value between 0 and 1 (e.g. 0.3)
method string Optional all all, speak
type string Optional tts tts, announce, push, dropin_notification or dropin
title string Optional Main title Title for the push service (not valid for dropin notification)
push bool Optional False Send a push notification in addition to the tts message
wait_time float Optional 0 Estimated time to end the message before moving on to the next.
Value expressed in seconds (e.g. -2 or 8)
ssml bool Optional off By-pass switch SSML. Turn on or off ssml SSML mode
audio string Optional None Audio file to play.
language string Optional it-IT The format is xx-XX (e.g. en-GB) see supported language table
rate float Optional 100 min value 20 max 200
pitch float Optional 0 min value -33.3 max 50
ssml_volume float Optional 0 min value -50 max 4.08
voice string Optional Alexa See supported voice-id table
whisper bool Optional False whispers
notifier string Optional alexa_media Alexa services
media_content_id string Optional None Es. amzn_sfx_doorbell_chime_01, Alexa. GoodMorning. Play
media_content_type string Optional None sound, sequence, image, TUNEIN, AMAZON_MUSIC, SPOTIFY, APPLE_MUSIC ...

Alexa supported language and Voice

Table - Click to expand
Language Code Voice-id
Italian it-IT Carla, Giorgio, Bianca
English US en-US Ivy, Joanna, Joey, Justin, Kendra, Kimberly, Matthew, Salli,
English Canada en-CA
English Australia en-AU Nicole, Russell,
English UK en-GB Amy, Brian, Emma,
English India en-IN Aditi, Raveena,
French France fr-CA Chantal,
French Canada fr-FR Celine, Lea, Mathieu,
German de-DE Hans, Marlene, Vicki,
Hindi hi-IN Aditi,
Japanese ja-JP Mizuki, Takumi,
Portuguese Brazilian pt-BR Vitoria, Camila, Ricardo,
Spanish US es-US Penelope, Lupe, Miguel,
Spanish Spain es-ES Conchita, Enrique, Lucia,
Spanish Mexico es-MX Mia
Options Type Requirement Default Description
mode bool Optional Optional Useful to use as a switch with templates.
message string Optional Main Message Alternative message to the main one
media_player string Optional - entity_id (comma separated list).
volume float Optional None Volume with a value between 0 to 1 (e.g. 0.9)
media_content_id float Optional None xxxxxxx
media_content_type string Optional None xxxxxxx

 

 

 

 

Configuration yaml Examples

Configuration.yaml - Click to expand

TTS

tts:
  - platform: google_translate
    language: 'it'
    cache: true
    cache_dir: /config/www/tts
    time_memory: 300
    base_url: !secret internal_url #external_url

  - platform: reversotts
    language: "Fabiana-Italian"
    bitrate: "128k"
    pitch: "100"

  - platform: reversotts
      language: 'Chiara-Italian'
      pitch: "100"
      bitrate: "22k"

  - platform: google_cloud
    key_file: text-to-speech.json
    voice: it-IT-Standard-B
    encoding: linear16
    speed: 0.9
    pitch: -2.5
    gain: 3.0
    profiles:
      - small-bluetooth-speaker-class-device

NOTIFY

In order to better manage the various notification services, it is recommended to use the service name and optionally a specific name. Why this? Because, for example, the service for sending an image can change from one notification service to another.

notify:
  ### PUSHBULLET
  - name: pushbullet
    platform: pushbullet
    api_key: !secret pushbullet_api

  ### PUSHOVER
  - name: pushover
    platform: pushover
    api_key: !secret pushover_api
    user_key: !secret pushover_user

  ### TELEGRAM
  - name: telegram
    platform: telegram
    chat_id: !secret telegram_chatid

  - name: telegram_micasa
    platform: telegram
    chat_id: !secret telegram_micasa

  - name: telegram_news
    platform: telegram
    chat_id: !secret telegram_news

  - name: Telegram Test Nome NOTIFICA
    platform: telegram
    chat_id: !secret telegram_test

  ### GRUPPO NOTIFICHE
  - name: alert
    platform: group
    services:
      - service: telegram
      - service: pushover
      - service: pushbullet

  ### GOOGLE ASSISTANT WEB SERVER
  - name: Google Assistant
    platform: rest
    resource: http://192.168.1.3:5000/broadcast_message

  - name: Google Assistant Command
    platform: rest
    resource: http://192.168.1.3:5000/command

  ### ASSISTANT RELAY
  - name: Google Assistant
    platform: rest
    resource: http://192.168.1.101:3000/assistant
    headers:
      Content-Type: application/json
    method: POST_JSON
    message_param_name: command
    data:
      user: USER
      broadcast: true

  ### WHATSAPP
  - name: WhatsApp
    platform: rest
    resource: https://api.callmebot.com/whatsapp.php
    data:
      source: HA
      phone: !secret whatsapp_phone
      apikey: !secret whatsapp_apikey

 

License

MIT

N|Solid

Clone this wiki locally