Skip to content

Commit

Permalink
Merge pull request #26 from caiosweet/dev
Browse files Browse the repository at this point in the history
Update for version 2.2.0 Appdaemon Notifier
  • Loading branch information
caiosweet authored Aug 28, 2021
2 parents 6d5a071 + a4ce6cd commit 246ac3b
Show file tree
Hide file tree
Showing 11 changed files with 162 additions and 64 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
5 changes: 4 additions & 1 deletion extra/my_lovelace_view.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +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 Expand Up @@ -76,6 +77,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:
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
2 changes: 2 additions & 0 deletions lovelace/card_impostazioni_assistente.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions lovelace/lovelace_view_stardard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/centro_notifiche/hub_alexa.yaml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/centro_notifiche/hub_google.yaml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 246ac3b

Please sign in to comment.