Skip to content

Commit

Permalink
Update for version 2.2.0 Appdaemon Notifier
Browse files Browse the repository at this point in the history
  • Loading branch information
caiosweet committed Aug 27, 2021
1 parent 8ddc441 commit a4ce6cd
Show file tree
Hide file tree
Showing 7 changed files with 140 additions and 59 deletions.
36 changes: 24 additions & 12 deletions examples/hub_automations.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
# package_hub_automations:
#----------------------------------------------------------------------------------------------------#
# ESEMPI DI COME CREARE DELLE AUTOMAZIONI CON I RICHIAMI ALLE MACRO
#----------------------------------------------------------------------------------------------------#
Expand Down Expand Up @@ -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!.
Expand All @@ -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:
Expand Down Expand Up @@ -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"
Expand All @@ -159,6 +159,7 @@ automation:
- service: script.my_notify
data:
call_no_annuncio: 1
google: true
alexa:
type: announce
title: Benvenuto
Expand Down Expand Up @@ -208,6 +209,7 @@ automation:
data:
alexa:
type: announce
google: true
call_no_annuncio: 1
call_bentornato: 1
title: Bentornato
Expand Down Expand Up @@ -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
Expand All @@ -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}}"
Expand Down Expand Up @@ -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 }}!
48 changes: 37 additions & 11 deletions extra/feed.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# package_feed:
# Requirement
# https://github.com/custom-components/feedparser
# https://github.com/iantrich/list-card
Expand All @@ -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
Expand All @@ -37,6 +38,9 @@ homeassistant:
sensor.feed_dpc:
<<: *customize
friendly_name: "Feed DPC"
sensor.feed_cb01:
<<: *customize
friendly_name: "CineBlog01"
###############################################################################
## COMPONENT
###############################################################################
Expand All @@ -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
Expand Down Expand Up @@ -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
#######################################-#######################################
Expand All @@ -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}}"
Expand Down Expand Up @@ -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: []
14 changes: 14 additions & 0 deletions extra/feed_lovelace_view.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions extra/my_lovelace_view.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
83 changes: 52 additions & 31 deletions extra/sensor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions packages/centro_notifiche/hub_main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: >-
Expand All @@ -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
#-------------------------------------------------------------------------------#
Expand Down
8 changes: 7 additions & 1 deletion packages/secrets.example
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a4ce6cd

Please sign in to comment.