From 8ddc4414161afca5c0e4012890146233a6ddc2c6 Mon Sep 17 00:00:00 2001 From: caiosweet <24454580+caiosweet@users.noreply.github.com> Date: Sun, 22 Aug 2021 17:17:11 +0200 Subject: [PATCH 1/2] app notifier updates --- extra/my_lovelace_view.yaml | 3 ++- lovelace/card_impostazioni_assistente.yaml | 2 ++ lovelace/lovelace_view_stardard.yaml | 2 ++ packages/centro_notifiche/hub_alexa.yaml | 2 +- packages/centro_notifiche/hub_google.yaml | 2 +- packages/centro_notifiche/hub_main.yaml | 16 ++++++++++++++-- 6 files changed, 22 insertions(+), 5 deletions(-) mode change 100644 => 100755 packages/centro_notifiche/hub_alexa.yaml mode change 100644 => 100755 packages/centro_notifiche/hub_google.yaml mode change 100644 => 100755 packages/centro_notifiche/hub_main.yaml diff --git a/extra/my_lovelace_view.yaml b/extra/my_lovelace_view.yaml index 0ff95ea..54fc047 100644 --- a/extra/my_lovelace_view.yaml +++ b/extra/my_lovelace_view.yaml @@ -4,7 +4,6 @@ icon: mdi:account-tie-voice # panel: true cards: - !include ../cards/card_menu_centro_notifiche.yaml - # CARD Centro Notifiche - type: entities title: Centro Notifiche @@ -76,6 +75,8 @@ cards: - entity: input_select.language - entity: input_select.text_notify - entity: input_boolean.html_mode + - entity: input_boolean.tts_clock + - entity: input_boolean.wrap_text - entity: input_number.tts_wait_time - type: custom:fold-entity-row head: diff --git a/lovelace/card_impostazioni_assistente.yaml b/lovelace/card_impostazioni_assistente.yaml index 11dbf43..ce52088 100644 --- a/lovelace/card_impostazioni_assistente.yaml +++ b/lovelace/card_impostazioni_assistente.yaml @@ -7,6 +7,8 @@ entities: - entity: input_select.language - entity: input_select.text_notify - entity: input_boolean.html_mode + - entity: input_boolean.tts_clock + - entity: input_boolean.wrap_text - entity: input_number.tts_wait_time - type: section label: FERIALI - Orario modo silenzioso diff --git a/lovelace/lovelace_view_stardard.yaml b/lovelace/lovelace_view_stardard.yaml index 45ed02a..718346e 100644 --- a/lovelace/lovelace_view_stardard.yaml +++ b/lovelace/lovelace_view_stardard.yaml @@ -164,6 +164,8 @@ cards: - entity: input_select.language - entity: input_select.text_notify - entity: input_boolean.html_mode + - entity: input_boolean.tts_clock + - entity: input_boolean.wrap_text - entity: input_number.tts_wait_time - type: section label: FERIALI - Orario modo silenzioso diff --git a/packages/centro_notifiche/hub_alexa.yaml b/packages/centro_notifiche/hub_alexa.yaml old mode 100644 new mode 100755 index 48c2633..7278aec --- a/packages/centro_notifiche/hub_alexa.yaml +++ b/packages/centro_notifiche/hub_alexa.yaml @@ -10,7 +10,7 @@ homeassistant: package: Centro Notifiche πŸ”” site: hassiohelp.eu 🌐 author: Caio & Gianpi - version: Alexa 3.2.2 + version: Alexa 3.3.0 expose: &expose <<: *customize diff --git a/packages/centro_notifiche/hub_google.yaml b/packages/centro_notifiche/hub_google.yaml old mode 100644 new mode 100755 index ced48af..1fa5888 --- a/packages/centro_notifiche/hub_google.yaml +++ b/packages/centro_notifiche/hub_google.yaml @@ -10,7 +10,7 @@ homeassistant: package: Centro Notifiche πŸ”” site: hassiohelp.eu 🌐 author: Caio & Gianpi - version: Google 3.2.2 + version: Google 3.3.0 expose: &expose <<: *customize diff --git a/packages/centro_notifiche/hub_main.yaml b/packages/centro_notifiche/hub_main.yaml old mode 100644 new mode 100755 index ba66c09..ac0b521 --- a/packages/centro_notifiche/hub_main.yaml +++ b/packages/centro_notifiche/hub_main.yaml @@ -1,7 +1,7 @@ # package_hub_main: ### INFO # @author : Caio & Gianpi - hassiohelp.eu 🌐 -# @date : Started 01/11/2019 - Updated 15/03/2021 +# @date : Started 01/11/2019 - Updated 21/08/2021 # @package : Notification HUB - Centro Notifiche πŸ”” # @description : Package Appdaemon Notifier Center for Home Assistant # @repo : https://api.github.com/repos/caiosweet/Package-Notification-HUB-AppDaemon/releases @@ -18,7 +18,7 @@ homeassistant: package: Centro Notifiche πŸ”” site: hassiohelp.eu 🌐 author: Caio & Gianpi - version: Main 3.2.2 + version: Main 3.3.0 ## AUTOMATION automation.auto_volume_hub: @@ -98,6 +98,14 @@ homeassistant: <<: *customize friendly_name: Notifiche Testo icon: mdi:cellphone-message + input_boolean.tts_clock: + <<: *customize + friendly_name: TTS clock + icon: mdi:clock + input_boolean.wrap_text: + <<: *customize + friendly_name: Testo a capo + icon: mdi:text-box-check ## INPUT DATETIME input_datetime.start_morning: <<: *customize @@ -234,6 +242,8 @@ input_boolean: screen_notifications: speech_notifications: text_notifications: + tts_clock: + wrap_text: input_datetime: dnd_start_weekdays: has_date: false @@ -435,6 +445,8 @@ script: {{link|default}} location: >- {{location|default}} + mobile: >- + {{mobile|default}} no_show: >- {{no_show|default}} notify: >- From a4ce6cd5740b371173c062daf52d8196bf12161e Mon Sep 17 00:00:00 2001 From: caiosweet <24454580+caiosweet@users.noreply.github.com> Date: Fri, 27 Aug 2021 19:58:14 +0200 Subject: [PATCH 2/2] Update for version 2.2.0 Appdaemon Notifier --- examples/hub_automations.yaml | 36 +++++++---- extra/feed.yaml | 48 ++++++++++---- extra/feed_lovelace_view.yaml | 14 +++++ extra/my_lovelace_view.yaml | 2 + extra/sensor.yaml | 83 ++++++++++++++++--------- packages/centro_notifiche/hub_main.yaml | 8 +-- packages/secrets.example | 8 ++- 7 files changed, 140 insertions(+), 59 deletions(-) diff --git a/examples/hub_automations.yaml b/examples/hub_automations.yaml index abb4432..7cd08bd 100644 --- a/examples/hub_automations.yaml +++ b/examples/hub_automations.yaml @@ -1,4 +1,4 @@ ---- +# package_hub_automations: #----------------------------------------------------------------------------------------------------# # ESEMPI DI COME CREARE DELLE AUTOMAZIONI CON I RICHIAMI ALLE MACRO #----------------------------------------------------------------------------------------------------# @@ -64,8 +64,8 @@ automation: title: "HomeAssistant Start!" notify: "{{notification_service}}" message: | - Centro Notifiche operativo! πŸ‘ - {{states('sensor.ha_start')}} + πŸ“¬ Centro Notifiche operativo! πŸ‘¨β€βœˆοΈ + 🏁 {{states('sensor.ha_start')}} alexa: message_tts: >- Il sistema Γ¨ operativo!. @@ -74,8 +74,8 @@ automation: google: message_tts: >- Il sistema Γ¨ operativo!. - # media_content_id: https://actions.google.com/sounds/v1/human_voices/human_fart.ogg # media_content_type: sound + # media_content_id: https://actions.google.com/sounds/v1/human_voices/human_fart.ogg default: - service: "notify.{{notification_service}}" data: @@ -144,7 +144,7 @@ automation: link: "[Release Notes]({{state_attr('binary_sensor.updater','release_notes')}})" #----------------------------------------------------------------------------------------------------# - # Benvenuto # Esempio Macro elaborata al di fuori di build_message, dove al suo interno va inserito {{ benvenuto }} + # Benvenuto # Esempio Macro elaborata al di fuori di build_message, dove al suo interno va inserito {{ benvenuto|default }} #----------------------------------------------------------------------------------------------------# - alias: Benvenuto description: "Welcome Message" @@ -159,6 +159,7 @@ automation: - service: script.my_notify data: call_no_annuncio: 1 + google: true alexa: type: announce title: Benvenuto @@ -208,6 +209,7 @@ automation: data: alexa: type: announce + google: true call_no_annuncio: 1 call_bentornato: 1 title: Bentornato @@ -483,7 +485,7 @@ automation: trigger: - platform: event event_type: state_changed - condition: # and (trigger.event.data.old_state is none + condition: # and (trigger.event.data.old_state is none - "{{ trigger.event.data.entity_id.startswith('person') }}" - "{{ trigger.event.data.old_state is not none and 'latitude' in trigger.event.data @@ -508,7 +510,7 @@ automation: - conditions: "{{not to in 'home' and lat != ''}}" sequence: - service: telegram_bot.send_location - data_template: + data: disable_notification: true latitude: "{{lat}}" longitude: "{{long}}" @@ -551,12 +553,22 @@ automation: initial_state: true trigger: - platform: state - entity_id: sensor.stagioni + entity_id: sensor.season condition: - - condition: template - value_template: '{{ trigger.from_state is defined and trigger.from_state.state | lower != "unknown" }}' + - "{{ trigger.from_state is defined }}" action: + - variables: + from: "{{trigger.from_state.state if trigger.from_state is defined }}" + to: "{{states('sensor.season')}}" - service: script.my_notify data: - message: > - Arrivederci {{ trigger.from_state.state }}, e Salutiamo la Stagione {{ trigger.to_state.state }}! + message: > + {% set state_dict = { + 'spring': 'Primavera', + 'summer': 'Estate', + 'autumn': 'Autunno', + 'winter': 'Inverno' + } %} + {% set from = state_dict.get(from, from) %} + {% set to = state_dict.get(to, to) %} + Arrivederci {{ from }} e Salutiamo la Stagione {{ to }}! diff --git a/extra/feed.yaml b/extra/feed.yaml index df79bca..7c1e010 100644 --- a/extra/feed.yaml +++ b/extra/feed.yaml @@ -1,3 +1,4 @@ +# package_feed: # Requirement # https://github.com/custom-components/feedparser # https://github.com/iantrich/list-card @@ -13,7 +14,7 @@ homeassistant: package: "Feed πŸ“°" site: "hassiohelp.eu 🌐" author: "Caio" - version: "2.0.0" + version: "2.0.1" expose: &expose <<: *customize haaska_hidden: false @@ -37,6 +38,9 @@ homeassistant: sensor.feed_dpc: <<: *customize friendly_name: "Feed DPC" + sensor.feed_cb01: + <<: *customize + friendly_name: "CineBlog01" ############################################################################### ## COMPONENT ############################################################################### @@ -46,7 +50,10 @@ feedreader: - &feed_hassiohelp_commenti https://hassiohelp.eu/comments/feed/ - &feed_news_ansa https://www.ansa.it/sito/notizie/topnews/topnews_rss.xml - &feed_wikiquote https://it.wikiquote.org/w/api.php?action=featuredfeed&feed=qotd - - &feed_dpc http://www.protezionecivile.gov.it/web/guest/dettaglio/-/journal/rss/351565?doAsGroupId=20182&refererPlid=42041&controlPanelCategory=current_site.content&_15_groupId=20182 + # - &feed_dpc https://dpc-web-api.protezionecivile.gov.it/rss/dpcPortalGenerateRss?categoria=bollettino_criticita + # - &feed_dpc_meteo https://dpc-web-api.protezionecivile.gov.it/rss/dpcPortalGenerateRss?categoria=bollettino_vigilanza #TODO + # - &feed_dpc_news https://dpc-web-api.protezionecivile.gov.it/rss/dpcPortalGenerateRss?categoria=notizia #TODO + - &feed_cb01 http://feeds.feedburner.com/cineblog01/Film-In-Streaming-Gratis scan_interval: minutes: 30 max_entries: 20 @@ -80,11 +87,21 @@ sensor: - title - summary - published + # - platform: feedparser + # name: feed_dpc + # feed_url: *feed_dpc + # date_format: *data + # inclusions: *title_link_pub - platform: feedparser - name: feed_dpc - feed_url: *feed_dpc + name: feed_cb01 + feed_url: *feed_cb01 date_format: *data - inclusions: *title_link_pub + # inclusions: *title_link_pub + inclusions: + - title + - summary + - published + - link #######################################-####################################### ## AUTOMATION #######################################-####################################### @@ -95,14 +112,15 @@ automation: max_exceeded: silent max: 20 trigger: - platform: event - event_type: feedreader + - platform: event + event_type: feedreader variables: feed_hassiohelp_articoli: *feed_hassiohelp_articoli feed_hassiohelp_commenti: *feed_hassiohelp_commenti feed_news_ansa: *feed_news_ansa feed_wikiquote: *feed_wikiquote - feed_dpc: *feed_dpc + # feed_dpc: *feed_dpc + feed_cb01: *feed_cb01 action: - variables: feed_url: "{{trigger.event.data.feed_url}}" @@ -146,10 +164,18 @@ automation: title: "πŸ“‘ WikiQuote" message: "Aforisma del giorno. {{trigger.event.data.summary|striptags}}" link: "[Aforisma]({{feed_link}})" - - conditions: "{{feed_url == feed_dpc}}" + # - conditions: "{{feed_url == feed_dpc}}" + # sequence: + # - service: *notify + # data: + # title: "β›ˆοΈ Protezione Civile" + # message: "{{feed_title}}" + # link: "[Bollettini di criticitΓ ]({{feed_link}})" + - conditions: "{{ feed_url == feed_cb01 }}" sequence: - service: *notify data: - title: "β›ˆοΈ Protezione Civile" + title: "🎬 FILM CineBlog01 πŸŽ₯" message: "{{feed_title}}" - link: "[Bollettini di criticitΓ ]({{feed_link}})" + link: "[Link]({{feed_link}})" + default: [] diff --git a/extra/feed_lovelace_view.yaml b/extra/feed_lovelace_view.yaml index 44a22a4..fb7d6eb 100644 --- a/extra/feed_lovelace_view.yaml +++ b/extra/feed_lovelace_view.yaml @@ -75,3 +75,17 @@ cards: field: published style: - white-space: nowrap + + - type: custom:list-card + feed_attribute: entries + entity: sensor.feed_cb01 + title: "FILM CineBlog01" + row_limit: 20 + columns: + - title: "Titolo" + add_link: link + field: title + - title: Data + field: published + style: + - white-space: nowrap diff --git a/extra/my_lovelace_view.yaml b/extra/my_lovelace_view.yaml index 54fc047..60f8fc5 100644 --- a/extra/my_lovelace_view.yaml +++ b/extra/my_lovelace_view.yaml @@ -4,6 +4,8 @@ icon: mdi:account-tie-voice # panel: true cards: - !include ../cards/card_menu_centro_notifiche.yaml + # - !include ../cards/card_test_centro_notifiche.yaml + # - !include ../cards/card_test_centro_notifiche_change_me.yaml # CARD Centro Notifiche - type: entities title: Centro Notifiche diff --git a/extra/sensor.yaml b/extra/sensor.yaml index ea7bdd6..12dca96 100644 --- a/extra/sensor.yaml +++ b/extra/sensor.yaml @@ -2,39 +2,60 @@ sensor: - platform: command_line name: HA Start command: grep -m1 'Home Assistant initialized' home-assistant.log | awk '{ print $6, $7, $8, $9, $10 }' -############################################################################ -## In order to use sensor.ha_start, set the info logs in this way -############################################################################ -# logger: -# default: warn -# logs: -# homeassistant.bootstrap: info + ############################################################################ + ## In order to use sensor.ha_start, set the info logs in this way + ############################################################################ + # logger: + # default: warn + # logs: + # homeassistant.bootstrap: info -# ClockTime + # ClockTime - platform: time_date display_options: - - 'time' - - 'date' - - 'date_time' - - 'date_time_iso' - - 'time_date' - - 'time_utc' - - 'beat' + - "time" + - "date" + - "date_time" + - "date_time_iso" + - "time_date" + - "time_utc" + - "beat" -# Calcolo Giorno della settimana - - platform: template - sensors: - day_of_week: - friendly_name: 'Giorno della settimana' - value_template: > - {{ ['lun','mar','mer','gio','ven','sab','dom'][now().weekday()] }} - icon_template: >- - mdi:{{['emoticon-dead-outline', 'emoticon-angry-outline', 'emoticon-sad-outline','emoticon-neutral-outline','emoticon-cool-outline','emoticon-excited-outline','emoticon-happy-outline'][now().weekday()] }} +template: + sensor: + # Calcolo Giorno della settimana + - name: Giorno della settimana + unique_id: day_of_week + state: > + {{ ['lun','mar','mer','gio','ven','sab','dom'][now().weekday()] }} + icon: >- + mdi:{{['emoticon-dead-outline', 'emoticon-angry-outline', 'emoticon-sad-outline','emoticon-neutral-outline','emoticon-cool-outline','emoticon-excited-outline','emoticon-happy-outline'][now().weekday()] }} -# Calcolo Giorno dopo - tomorrow_day_of_week: - friendly_name: 'Domani' - value_template: > - {{ ['mar','mer','gio','ven','sab','dom','lun'][now().weekday()] }} - icon_template: >- - mdi:{{['emoticon-angry-outline', 'emoticon-sad-outline','emoticon-neutral-outline','emoticon-cool-outline','emoticon-excited-outline','emoticon-happy-outline','emoticon-dead-outline'][now().weekday()] }} + # Calcolo Giorno dopo + - name: Domani + unique_id: tomorrow_day_of_week + state: > + {{ ['mar','mer','gio','ven','sab','dom','lun'][now().weekday()] }} + icon: >- + mdi:{{['emoticon-angry-outline', 'emoticon-sad-outline','emoticon-neutral-outline','emoticon-cool-outline','emoticon-excited-outline','emoticon-happy-outline','emoticon-dead-outline'][now().weekday()] }} + + # Data e Ora per DarkSky package + # {{as_local(states.sensor.time.last_updated).timestamp() | timestamp_custom('%d/%m/%Y - %H:%M')}} + - name: Data e Ora + unique_id: data_ora + state: > + {{as_timestamp(states.sensor.time.last_updated)|timestamp_custom('%d/%m/%Y - %H:%M')}} + icon: mdi:calendar-clock + # value_template: > + # {{now().strftime("%d/%m/%Y - %H:%M")}} + + # Definizione Orario Alba e Tramonto + - name: Alba + unique_id: sunrise_time + state: '{% set timestamp = as_timestamp(states.sun.sun.attributes.next_rising) | timestamp_custom("%H:%M") %} {{ timestamp.lstrip("0") }}' + icon: mdi:weather-sunset-up + + - name: Tramonto + unique_id: sunset_time + state: '{% set timestamp = as_timestamp(states.sun.sun.attributes.next_setting) | timestamp_custom("%H:%M") %} {{ timestamp.lstrip("0") }}' + icon: mdi:weather-sunset-down diff --git a/packages/centro_notifiche/hub_main.yaml b/packages/centro_notifiche/hub_main.yaml index ac0b521..920dc13 100755 --- a/packages/centro_notifiche/hub_main.yaml +++ b/packages/centro_notifiche/hub_main.yaml @@ -435,12 +435,14 @@ script: {{called_number|default}} caption: >- {{caption|default}} - file: >- - {{file|default}} + discord: >- + {{discord|default}} google: >- {{google|default}} html: >- {{html|default}} + image: >- + {{image|default}} link: >- {{link|default}} location: >- @@ -455,8 +457,6 @@ script: {{priority|default}} title: >- {{title|default}} - url: >- - {{url|default}} #-------------------------------------------------------------------------------# # FILE TO BE INCLUDED IF MACROS ARE USED - NOTE: DO NOT MODIFY THE .yml EXTENSION #-------------------------------------------------------------------------------# diff --git a/packages/secrets.example b/packages/secrets.example index 0c315dd..d318674 100644 --- a/packages/secrets.example +++ b/packages/secrets.example @@ -9,13 +9,19 @@ text_notify_hub: - Telegram - News + - News Telegram - Pushover - - Android + - Discord - WhatsApp - Pushbullet - Test Nome NOTIFICA + - Mobile App Claudio - Mobile App Oneplus 5t - Mobile App Oneplus A5010 + - none + - Pushover, Telegram, Mobile App Claudio + - Mobile App Claudio, Telegram + - Telegram, Discord # Se possiedi almeno un dispositivo Alexa, altrimenti puoi cancellare questa parte ed il file hub_alexa.yaml # Input Select (input_select.notification_media_player_alexa nel file hub_alexa.yaml)