From 82fdd751b446228459faf2fb91e5389c34bc3498 Mon Sep 17 00:00:00 2001
From: caiosweet <24454580+caiosweet@users.noreply.github.com>
Date: Tue, 8 Dec 2020 13:50:42 +0100
Subject: [PATCH 01/13] Add files via upload
---
packages/centro_notifiche/hub_extra.yaml | 185 +++++++++++++----------
1 file changed, 102 insertions(+), 83 deletions(-)
diff --git a/packages/centro_notifiche/hub_extra.yaml b/packages/centro_notifiche/hub_extra.yaml
index 714e1df..85d81d9 100644
--- a/packages/centro_notifiche/hub_extra.yaml
+++ b/packages/centro_notifiche/hub_extra.yaml
@@ -9,7 +9,7 @@ homeassistant:
package: Centro Notifiche π
site: hassiohelp.eu π
author: Caio & Gianpi
- version: Extra 3.1.0
+ version: Extra 3.2.0
expose: &expose
<<: *customize
@@ -20,14 +20,18 @@ homeassistant:
automation.auto_volume_hub:
<<: *customize
friendly_name: Volume Automatico Hub
- automation.create_notification_automation_group_hub:
+ automation.hub_initialization_at_startup:
<<: *customize
- friendly_name: Crea Gruppo Automazioni HUB
- ## BINARY SENSOR
- binary_sensor.people_home:
- <<: *customize
- friendly_name: Persone in casa # People at Home
+ friendly_name: Startup HUB
## GROUP
+ group.automations_notification_hub:
+ <<: *customize
+ friendly_name: Automazioni HUB
+ icon: mdi:account-tie
+ group.location_tracker:
+ <<: *customize
+ friendly_name: Dispositivi tracciati
+ icon: mdi:target-account
group.media_player_alexa:
<<: *customize
friendly_name: Gruppo Alexa
@@ -40,6 +44,86 @@ homeassistant:
## AUTOMATION
#######################################-#######################################
automation:
+ #----------------------------------------------------------------------------------------------------#
+ # INITIALIZE
+ #----------------------------------------------------------------------------------------------------#
+ - alias: Hub initialization at startup
+ initial_state: true
+ trigger:
+ - platform: homeassistant
+ event: start
+ - platform: state
+ entity_id: automation.hub_initialization_at_startup
+ to: "on"
+ action:
+ # Crea un Gruppo location_tracker da entity Person.
+ - service: group.set
+ data:
+ object_id: location_tracker
+ entities: >-
+ {{states.person|join(',','entity_id')}}
+ - service: system_log.write
+ data:
+ message: "Successfully set location_tracker group."
+ level: info
+
+ - choose:
+ - conditions: "{{state_attr('input_select.notification_media_player_alexa', 'options') is not none }}"
+ sequence:
+ # Crea un Gruppo media_player_alexa da entity input_select.notification_media_player_alexa.
+ - service: group.set
+ data:
+ object_id: media_player_alexa
+ entities: >-
+ {% set lista_alexa = expand('input_select.notification_media_player_alexa')|join(',','attributes.options') %}
+ {{ states.media_player
+ | selectattr('attributes.friendly_name', 'defined')
+ | selectattr('attributes.friendly_name', 'in', lista_alexa)
+ | map(attribute='entity_id')|list
+ }}
+ - service: system_log.write
+ data:
+ message: "Successfully set media_player_alexa group."
+ level: info
+
+ - choose:
+ - conditions: "{{state_attr('input_select.notification_media_player_google', 'options') is not none }}"
+ sequence:
+ # Crea un Gruppo media_player_google da entity input_select.notification_media_player_google.
+ - service: group.set
+ data:
+ object_id: media_player_google
+ entities: >-
+ {% set lista_google = expand('input_select.notification_media_player_google')|join(',','attributes.options') %}
+ {{ states.media_player
+ | selectattr('attributes.friendly_name', 'defined')
+ | selectattr('attributes.friendly_name', 'in', lista_google)
+ | map(attribute='entity_id')|list
+ }}
+ - service: system_log.write
+ data:
+ message: "Successfully set media_player_google group."
+ level: info
+
+ # Crea un Gruppo Notifiche se l'attributo "id:" o il "nome" delle automazioni finiscono con "hub".
+ - service: group.set
+ data:
+ object_id: "automations_notification_hub"
+ entities: >
+ {%for item in states.automation if ((item.attributes.id|lower).endswith('hub'))
+ or ((item.attributes.friendly_name|lower).endswith('hub')) %}
+ {{-item.entity_id}}{%if not loop.last%},{%endif-%}{%endfor%}
+
+ # Execute auto_volume_hub Automation.
+ - service: automation.trigger
+ entity_id: automation.auto_volume_hub
+ # skip_condition: true
+
+ - service: system_log.write
+ data:
+ message: "Successfully END INITIALIZE."
+ level: info
+
#----------------------------------------------------------------------------------------------------#
# Automatic Volume - Media player volume adjustment, based on period_of_day_volume sensor
#----------------------------------------------------------------------------------------------------#
@@ -49,15 +133,13 @@ automation:
trigger:
- platform: state
entity_id: sensor.period_of_day_volume
- - platform: homeassistant
- event: start
action:
- variables:
- group_alexa: "{{state_attr('group.media_player_alexa', 'entity_id')|join(', ')}}"
- group_google: "{{state_attr('group.media_player_google', 'entity_id')|join(', ')}}"
- list_alexa: "{{ group_alexa if states.input_boolean.alexa_switch else 'none'}}" # return string!!
- list_google: "{{group_google if states.input_boolean.google_switch else 'none'}}"
- all_entity: "{{(list_alexa, list_google)|reject('sameas','none')|join(', ')}}"
+ group_alexa: "{{state_attr('group.media_player_alexa', 'entity_id')}}"
+ group_google: "{{state_attr('group.media_player_google', 'entity_id')}}"
+ list_alexa: "{{ group_alexa if states.input_boolean.alexa_switch else none}}" # return string!! Old type legacy
+ list_google: "{{group_google if states.input_boolean.google_switch else none}}"
+ all_entity: "{{(list_alexa|default((), true) + list_google|default((), true))|reject('sameas', none)|list}}"
volume: "{{states('sensor.period_of_day_volume')|float}}"
- choose:
- conditions: "{{list_alexa is not none}}"
@@ -74,12 +156,11 @@ automation:
- delay: "00:00:02"
- choose:
- - conditions: "{{list_alexa is not none or list_google is not none}}"
+ - conditions: "{{all_entity is not none}}"
sequence:
- service: media_player.volume_set
data:
- entity_id: >
- {{all_entity}}
+ entity_id: "{{all_entity}}"
volume_level: "{{(volume|round(2))/100}}"
- service: input_number.set_value
data:
@@ -87,33 +168,10 @@ automation:
- input_number.intercom_message_volume
- input_number.default_restore_volume
value: "{{volume}}"
-
- #----------------------------------------------------------------------------------------------------#
- # SET GROUP - Create an automation group if the "id:" attribute or the "name" of the automations ends with "hub"
- #----------------------------------------------------------------------------------------------------#
- - alias: Create Notification Automation Group Hub
- initial_state: true
- trigger:
- - platform: homeassistant
- event: start
- - platform: state
- entity_id: automation.create_notification_automation_group_hub
- to: "on"
- action:
- # Crea un Gruppo location_tracker da entity Person #TODO
- # - service: group.set
- # data:
- # object_id: location_tracker
- # entities: >-
- # {{states.person|join(',','entity_id')}}
- # Crea un Gruppo Notifiche se l'attributo "id:" o il "nome" delle automazioni finiscono con "hub"
- - service: group.set
- data:
- object_id: "automations_notification_hub"
- entities: >
- {%for item in states.automation if ((item.attributes.id|lower).endswith('hub'))
- or ((item.attributes.friendly_name|lower).endswith('hub')) %}
- {{-item.entity_id}}{%if not loop.last%},{%endif-%}{%endfor%}
+ - service: system_log.write
+ data:
+ message: "Successfully set Auto Volume Hub."
+ level: info
# ATTENZIONE!
# Se le automazioni sono create manualmente con id, la loro eliminazione va fatta manualmente dalla UI
@@ -124,42 +182,3 @@ automation:
# If automations are created manually with id, their deletion must be done manually from the UI
# Graphical interface -> settings/entities searches for entities for "restored" or "unavailable".
# Or in States put "automation." in the entities filter and "unavailable" in the states filter
-
-#######################################-#######################################
-## BINARY SENSOR
-#######################################-#######################################
-binary_sensor:
- - platform: template
- sensors:
- people_home:
- device_class: presence
- value_template: "{{is_state('group.location_tracker','home')}}"
- icon_template: >-
- {% set people = expand('group.location_tracker')|selectattr('state','eq','home')
- |list|count+(1 if is_state('input_boolean.guest_mode','on') else 0) %}
- {% set icon = {0 :'mdi:account-off',
- 1 :'mdi:account',
- 2 :'mdi:account-multiple',
- 3 :'mdi:account-multiple-check'} %}
- {{icon[people] if people in icon else 'mdi:account-group'}}
- attribute_templates:
- number: >-
- {% if is_state('group.location_tracker','home')%}
- {{expand('group.location_tracker')|selectattr('state','eq','home')
- |list|count+(1 if is_state('input_boolean.guest_mode','on') else 0)}}
- {%endif%}
- name: >-
- {% if is_state('group.location_tracker','home')%}
- {{expand('group.location_tracker')|selectattr('state','eq','home')
- |join(', ',attribute='name')+(', Ospiti' if is_state('input_boolean.guest_mode','on') else '')}}
- {%endif%}
-
-#######################################-#######################################
-## GROUP
-#######################################-#######################################
-group:
- media_player_alexa:
- entities: !secret media_player_alexa
-
- media_player_google:
- entities: !secret media_player_google
From d6d1f72fd88051d6c7edb6d22f398974e3893e5c Mon Sep 17 00:00:00 2001
From: caiosweet <24454580+caiosweet@users.noreply.github.com>
Date: Tue, 8 Dec 2020 14:04:57 +0100
Subject: [PATCH 02/13] Add files via upload
---
packages/centro_notifiche/hub_alexa.yaml | 2 +-
packages/centro_notifiche/hub_google.yaml | 2 +-
packages/centro_notifiche/hub_main.yaml | 37 +++++++++++++++--------
3 files changed, 27 insertions(+), 14 deletions(-)
diff --git a/packages/centro_notifiche/hub_alexa.yaml b/packages/centro_notifiche/hub_alexa.yaml
index f16a51f..26a6be3 100644
--- a/packages/centro_notifiche/hub_alexa.yaml
+++ b/packages/centro_notifiche/hub_alexa.yaml
@@ -9,7 +9,7 @@ homeassistant:
package: Centro Notifiche π
site: hassiohelp.eu π
author: Caio & Gianpi
- version: Alexa 3.1.0
+ version: Alexa 3.2.0
expose: &expose
<<: *customize
diff --git a/packages/centro_notifiche/hub_google.yaml b/packages/centro_notifiche/hub_google.yaml
index d10cc3b..36e66d2 100644
--- a/packages/centro_notifiche/hub_google.yaml
+++ b/packages/centro_notifiche/hub_google.yaml
@@ -9,7 +9,7 @@ homeassistant:
package: Centro Notifiche π
site: hassiohelp.eu π
author: Caio & Gianpi
- version: Google 3.1.0
+ version: Google 3.2.0
expose: &expose
<<: *customize
diff --git a/packages/centro_notifiche/hub_main.yaml b/packages/centro_notifiche/hub_main.yaml
index 1fed4c3..c2ee306 100644
--- a/packages/centro_notifiche/hub_main.yaml
+++ b/packages/centro_notifiche/hub_main.yaml
@@ -16,7 +16,7 @@ homeassistant:
package: Centro Notifiche π
site: hassiohelp.eu π
author: Caio & Gianpi
- version: Main 3.1.0
+ version: Main 3.2.0
expose: &expose
<<: *customize
@@ -38,15 +38,9 @@ homeassistant:
binary_sensor.dnd:
<<: *customize
friendly_name: Modo Silenzioso
- ## GROUP
- group.automations_notification_hub:
+ binary_sensor.people_home:
<<: *customize
- friendly_name: Automazioni HUB
- icon: mdi:account-tie
- group.location_tracker:
- <<: *customize
- friendly_name: Dispositivi tracciati
- icon: mdi:target-account
+ friendly_name: Persone in casa # People at Home
## INPUT BOOLEAN
input_boolean.guest_mode:
<<: *customize
@@ -210,9 +204,9 @@ media_extractor:
#######################################-#######################################
## GROUP
#######################################-#######################################
-group:
- location_tracker:
- entities: !secret location_tracker_hub
+# group:
+# location_tracker:
+# entities: !secret location_tracker_hub
#######################################-#######################################
## INPUT
@@ -332,6 +326,25 @@ binary_sensor:
icon_template: >
{%if is_state('binary_sensor.dnd','off')%}mdi:do-not-disturb-off{%else%}mdi:do-not-disturb{%endif%}
+ people_home:
+ device_class: presence
+ value_template: "{{expand(states.person)|selectattr('state','eq','home')|list|count > 0}}"
+ icon_template: >-
+ {% set people = expand(states.person)|selectattr('state','eq','home')
+ |list|count+(1 if is_state('input_boolean.guest_mode','on') else 0) %}
+ {% set icon = {0 :'mdi:account-off', 1 :'mdi:account', 2 :'mdi:account-multiple', 3 :'mdi:account-multiple-check'} %}
+ {{icon[people] if people in icon else 'mdi:account-group'}}
+ attribute_templates:
+ number: >-
+ {{expand(states.person)|selectattr('state','eq','home')
+ |list|count+(1 if is_state('input_boolean.guest_mode','on') else 0)}}
+ name: >-
+ {{expand(states.person)|selectattr('state','eq','home')
+ |join(', ',attribute='name')+(', Ospiti' if is_state('input_boolean.guest_mode','on') else '')}}
+ entity: >-
+ {{expand(states.person)|selectattr('state','eq','home')
+ |join(', ',attribute='entity_id')+(', Ospiti' if is_state('input_boolean.guest_mode','on') else '')}}
+
#######################################-#######################################
## SENSOR
#######################################-#######################################
From 1a8099dead33bd7585451ebf6ab7679be749fad1 Mon Sep 17 00:00:00 2001
From: caiosweet <24454580+caiosweet@users.noreply.github.com>
Date: Thu, 14 Jan 2021 21:10:00 +0100
Subject: [PATCH 03/13] Update secrets.example
---
packages/secrets.example | 27 +++------------------------
1 file changed, 3 insertions(+), 24 deletions(-)
diff --git a/packages/secrets.example b/packages/secrets.example
index 49d23b6..0c315dd 100644
--- a/packages/secrets.example
+++ b/packages/secrets.example
@@ -5,12 +5,6 @@
# SECTION 1 - In questa sezione ci sono le entitΓ lette da Home Assistant
#----------------------------------------------------------------------------------------------------#
-# Group (group.location_tracker nel file hub_main.yaml)
-location_tracker_hub:
- - person.claudio
- - person.tanja
-
-
# Input Select (input_select.text_notify nel file hub_main.yaml)
text_notify_hub:
- Telegram
@@ -23,6 +17,7 @@ text_notify_hub:
- Mobile App Oneplus 5t
- Mobile App Oneplus A5010
+# 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)
notification_media_player_alexa_hub:
- Sala
@@ -31,6 +26,7 @@ notification_media_player_alexa_hub:
- Gruppo Alexa
- Echo DOT di Caio
+# Se possiedi almeno un dispositivo Google, altrimenti puoi cancellare questa parte ed il file hub_google.yaml
# Input Select (input_select.notification_media_player_google nel file hub_google.yaml)
notification_media_player_google_hub:
- Red
@@ -46,28 +42,11 @@ notification_media_player_google_hub:
#----------------------------------------------------------------------------------------------------#
tts_google: google_translate_say # default google_translate_say
-tts_google_cloud: google_cloud # default google_cloud
+tts_google_cloud: google_cloud_say # default google_cloud
reverso_tts: reversotts_say # default reversotts_say
notify_google: google_assistant # default google_assistant
sip_server_name: fritz.box:5060 # default fritz.box:5060
-#----------------------------------------------------------------------------------------------------#
-# SECTION 3 - In questa sezione ci sono altre entitΓ lette da Home Assistant per Extra Feautures.
-# Es.: l'automazione per regolare i volumi dei lettori multimediali Alexa e Google.
-#----------------------------------------------------------------------------------------------------#
-
-# Group (group.media_player_alexa nel file hub_extra.yaml)
-media_player_alexa:
- - media_player.sala
- - media_player.studio
-
-# Group (group.media_player_google nel file hub_extra.yaml)
-media_player_google:
- - media_player.red
- - media_player.black
- - media_player.black_due
- - media_player.vlc
-
#----------------------------------------------------------------------------------------------------#
# END
#----------------------------------------------------------------------------------------------------#
From 15a0eb30b0a5d46715dde537d0344300fe39dbca Mon Sep 17 00:00:00 2001
From: caiosweet <24454580+caiosweet@users.noreply.github.com>
Date: Thu, 14 Jan 2021 21:10:23 +0100
Subject: [PATCH 04/13] Delete hub_extra.yaml
---
packages/centro_notifiche/hub_extra.yaml | 184 -----------------------
1 file changed, 184 deletions(-)
delete mode 100644 packages/centro_notifiche/hub_extra.yaml
diff --git a/packages/centro_notifiche/hub_extra.yaml b/packages/centro_notifiche/hub_extra.yaml
deleted file mode 100644
index 85d81d9..0000000
--- a/packages/centro_notifiche/hub_extra.yaml
+++ /dev/null
@@ -1,184 +0,0 @@
-#######################################-#######################################
-## CUSTOMIZE
-#######################################-#######################################
-homeassistant:
- customize:
- ## NODE ANCHORS
- package.node_anchors:
- customize: &customize
- package: Centro Notifiche π
- site: hassiohelp.eu π
- author: Caio & Gianpi
- version: Extra 3.2.0
-
- expose: &expose
- <<: *customize
- haaska_hidden: false
- homebridge_hidden: false
-
- ## AUTOMATION
- automation.auto_volume_hub:
- <<: *customize
- friendly_name: Volume Automatico Hub
- automation.hub_initialization_at_startup:
- <<: *customize
- friendly_name: Startup HUB
- ## GROUP
- group.automations_notification_hub:
- <<: *customize
- friendly_name: Automazioni HUB
- icon: mdi:account-tie
- group.location_tracker:
- <<: *customize
- friendly_name: Dispositivi tracciati
- icon: mdi:target-account
- group.media_player_alexa:
- <<: *customize
- friendly_name: Gruppo Alexa
- icon: mdi:speaker-multiple
- group.media_player_google:
- <<: *customize
- friendly_name: Gruppo Google
- icon: mdi:speaker-multiple
-#######################################-#######################################
-## AUTOMATION
-#######################################-#######################################
-automation:
- #----------------------------------------------------------------------------------------------------#
- # INITIALIZE
- #----------------------------------------------------------------------------------------------------#
- - alias: Hub initialization at startup
- initial_state: true
- trigger:
- - platform: homeassistant
- event: start
- - platform: state
- entity_id: automation.hub_initialization_at_startup
- to: "on"
- action:
- # Crea un Gruppo location_tracker da entity Person.
- - service: group.set
- data:
- object_id: location_tracker
- entities: >-
- {{states.person|join(',','entity_id')}}
- - service: system_log.write
- data:
- message: "Successfully set location_tracker group."
- level: info
-
- - choose:
- - conditions: "{{state_attr('input_select.notification_media_player_alexa', 'options') is not none }}"
- sequence:
- # Crea un Gruppo media_player_alexa da entity input_select.notification_media_player_alexa.
- - service: group.set
- data:
- object_id: media_player_alexa
- entities: >-
- {% set lista_alexa = expand('input_select.notification_media_player_alexa')|join(',','attributes.options') %}
- {{ states.media_player
- | selectattr('attributes.friendly_name', 'defined')
- | selectattr('attributes.friendly_name', 'in', lista_alexa)
- | map(attribute='entity_id')|list
- }}
- - service: system_log.write
- data:
- message: "Successfully set media_player_alexa group."
- level: info
-
- - choose:
- - conditions: "{{state_attr('input_select.notification_media_player_google', 'options') is not none }}"
- sequence:
- # Crea un Gruppo media_player_google da entity input_select.notification_media_player_google.
- - service: group.set
- data:
- object_id: media_player_google
- entities: >-
- {% set lista_google = expand('input_select.notification_media_player_google')|join(',','attributes.options') %}
- {{ states.media_player
- | selectattr('attributes.friendly_name', 'defined')
- | selectattr('attributes.friendly_name', 'in', lista_google)
- | map(attribute='entity_id')|list
- }}
- - service: system_log.write
- data:
- message: "Successfully set media_player_google group."
- level: info
-
- # Crea un Gruppo Notifiche se l'attributo "id:" o il "nome" delle automazioni finiscono con "hub".
- - service: group.set
- data:
- object_id: "automations_notification_hub"
- entities: >
- {%for item in states.automation if ((item.attributes.id|lower).endswith('hub'))
- or ((item.attributes.friendly_name|lower).endswith('hub')) %}
- {{-item.entity_id}}{%if not loop.last%},{%endif-%}{%endfor%}
-
- # Execute auto_volume_hub Automation.
- - service: automation.trigger
- entity_id: automation.auto_volume_hub
- # skip_condition: true
-
- - service: system_log.write
- data:
- message: "Successfully END INITIALIZE."
- level: info
-
- #----------------------------------------------------------------------------------------------------#
- # Automatic Volume - Media player volume adjustment, based on period_of_day_volume sensor
- #----------------------------------------------------------------------------------------------------#
- - alias: Auto Volume Hub
- mode: queued
- initial_state: true
- trigger:
- - platform: state
- entity_id: sensor.period_of_day_volume
- action:
- - variables:
- group_alexa: "{{state_attr('group.media_player_alexa', 'entity_id')}}"
- group_google: "{{state_attr('group.media_player_google', 'entity_id')}}"
- list_alexa: "{{ group_alexa if states.input_boolean.alexa_switch else none}}" # return string!! Old type legacy
- list_google: "{{group_google if states.input_boolean.google_switch else none}}"
- all_entity: "{{(list_alexa|default((), true) + list_google|default((), true))|reject('sameas', none)|list}}"
- volume: "{{states('sensor.period_of_day_volume')|float}}"
- - choose:
- - conditions: "{{list_alexa is not none}}"
- sequence:
- - service: notify.alexa_media
- data:
- data:
- type: tts
- target: "{{list_alexa}}"
- message: >
-
-
- volume
-
- - delay: "00:00:02"
- - choose:
- - conditions: "{{all_entity is not none}}"
- sequence:
- - service: media_player.volume_set
- data:
- entity_id: "{{all_entity}}"
- volume_level: "{{(volume|round(2))/100}}"
- - service: input_number.set_value
- data:
- entity_id:
- - input_number.intercom_message_volume
- - input_number.default_restore_volume
- value: "{{volume}}"
- - service: system_log.write
- data:
- message: "Successfully set Auto Volume Hub."
- level: info
-
- # ATTENZIONE!
- # Se le automazioni sono create manualmente con id, la loro eliminazione va fatta manualmente dalla UI
- # Interfaccia grafica --> impostazioni/entitΓ cerca le entitΓ per "ripristinato" o "non disponibile".
- # O in Stati metti "automation." in Filter entities e "unavailable" Filter States.
-
- # ATTENTION!
- # If automations are created manually with id, their deletion must be done manually from the UI
- # Graphical interface -> settings/entities searches for entities for "restored" or "unavailable".
- # Or in States put "automation." in the entities filter and "unavailable" in the states filter
From 15551d6f5a226de9569c01c15f7e047408054225 Mon Sep 17 00:00:00 2001
From: caiosweet <24454580+caiosweet@users.noreply.github.com>
Date: Thu, 14 Jan 2021 21:10:56 +0100
Subject: [PATCH 05/13] Add files via upload
---
packages/centro_notifiche/hub_common.yaml | 150 ++++++++++++++++++++++
1 file changed, 150 insertions(+)
create mode 100644 packages/centro_notifiche/hub_common.yaml
diff --git a/packages/centro_notifiche/hub_common.yaml b/packages/centro_notifiche/hub_common.yaml
new file mode 100644
index 0000000..12cdd54
--- /dev/null
+++ b/packages/centro_notifiche/hub_common.yaml
@@ -0,0 +1,150 @@
+#######################################-#######################################
+## CUSTOMIZE
+#######################################-#######################################
+homeassistant:
+ customize:
+ ## NODE ANCHORS
+ package.node_anchors:
+ customize: &customize
+ package: Centro Notifiche π
+ site: hassiohelp.eu π
+ author: Caio & Gianpi
+ version: Common 3.2.0
+
+ expose: &expose
+ <<: *customize
+ haaska_hidden: false
+ homebridge_hidden: false
+
+ ## AUTOMATION
+ automation.auto_volume_hub:
+ <<: *customize
+ friendly_name: Volume Automatico Hub
+ automation.hub_initialization_at_startup:
+ <<: *customize
+ friendly_name: Startup HUB
+ ## GROUP
+ group.automations_notification_hub:
+ <<: *customize
+ friendly_name: Automazioni HUB
+ icon: mdi:account-tie
+ group.location_tracker:
+ <<: *customize
+ friendly_name: Dispositivi tracciati
+ icon: mdi:target-account
+ group.media_player_alexa:
+ <<: *customize
+ friendly_name: Gruppo Alexa
+ icon: mdi:speaker-multiple
+ group.media_player_google:
+ <<: *customize
+ friendly_name: Gruppo Google
+ icon: mdi:speaker-multiple
+#######################################-#######################################
+## AUTOMATION
+#######################################-#######################################
+automation:
+ #----------------------------------------------------------------------------------------------------#
+ # INITIALIZE
+ #----------------------------------------------------------------------------------------------------#
+ - alias: Hub initialization at startup
+ initial_state: true
+ trigger:
+ - platform: homeassistant
+ event: start
+ - platform: event
+ event_type: automation_reloaded
+ action:
+ # Crea un Gruppo location_tracker da entity Person.
+ - service: group.set
+ data:
+ object_id: location_tracker
+ entities: >-
+ {{states.person|join(',','entity_id')}}
+
+ - choose:
+ - conditions: "{{state_attr('input_select.notification_media_player_alexa', 'options') is not none }}"
+ sequence:
+ # Crea un Gruppo media_player_alexa da entity input_select.notification_media_player_alexa.
+ - service: group.set
+ data:
+ object_id: media_player_alexa
+ entities: >-
+ {% set lista_alexa = expand('input_select.notification_media_player_alexa')|join(',','attributes.options') %}
+ {{ states.media_player
+ | selectattr('attributes.friendly_name', 'defined')
+ | selectattr('attributes.friendly_name', 'in', lista_alexa)
+ | map(attribute='entity_id')|list
+ }}
+
+ - choose:
+ - conditions: "{{state_attr('input_select.notification_media_player_google', 'options') is not none }}"
+ sequence:
+ # Crea un Gruppo media_player_google da entity input_select.notification_media_player_google.
+ - service: group.set
+ data:
+ object_id: media_player_google
+ entities: >-
+ {% set lista_google = expand('input_select.notification_media_player_google')|join(',','attributes.options') %}
+ {{ states.media_player
+ | selectattr('attributes.friendly_name', 'defined')
+ | selectattr('attributes.friendly_name', 'in', lista_google)
+ | map(attribute='entity_id')|list
+ }}
+
+ # Crea un Gruppo automations_notification_hub se l'attributo "id:" o il "nome" delle automazioni finiscono con "hub".
+ - service: group.set
+ data:
+ object_id: "automations_notification_hub"
+ entities: >
+ {%for item in states.automation if ((item.attributes.id|lower).endswith('hub'))
+ or ((item.attributes.friendly_name|lower).endswith('hub')) %}
+ {{-item.entity_id}}{%if not loop.last%},{%endif-%}{%endfor%}
+
+ # Execute auto_volume_hub Automation.
+ - service: automation.trigger
+ entity_id: automation.auto_volume_hub
+ # skip_condition: true
+
+ #----------------------------------------------------------------------------------------------------#
+ # Automatic Volume - Media player volume adjustment, based on period_of_day_volume sensor
+ #----------------------------------------------------------------------------------------------------#
+ - alias: Auto Volume Hub
+ mode: queued
+ initial_state: true
+ trigger:
+ - platform: state
+ entity_id: sensor.period_of_day_volume
+ action:
+ - variables:
+ list_alexa: "{{expand('group.media_player_alexa')|map(attribute='entity_id')|list}}"
+ list_google: "{{expand('group.media_player_google')|map(attribute='entity_id')|list}}"
+ all_entity: "{{list_alexa + list_google}}"
+ volume: "{{states('sensor.period_of_day_volume')|float}}"
+ - choose:
+ - conditions: "{{list_alexa|length > 0}}"
+ sequence:
+ - service: notify.alexa_media
+ data:
+ data:
+ type: tts
+ target: "{{list_alexa}}"
+ message: >
+
+
+ volume
+
+ - delay: "00:00:02"
+ - choose:
+ - conditions: "{{all_entity|length > 0}}"
+ sequence:
+ - service: media_player.volume_set
+ data:
+ entity_id: "{{all_entity}}"
+ volume_level: "{{(volume|round(2))/100}}"
+ - service: input_number.set_value
+ data:
+ entity_id:
+ - input_number.intercom_message_volume
+ - input_number.default_restore_volume
+ value: "{{volume}}"
From a47dc7820291ca3380b5f8571007fdce72acb152 Mon Sep 17 00:00:00 2001
From: caiosweet <24454580+caiosweet@users.noreply.github.com>
Date: Fri, 15 Jan 2021 22:03:12 +0100
Subject: [PATCH 06/13] Delete hub_common.yaml
---
packages/centro_notifiche/hub_common.yaml | 150 ----------------------
1 file changed, 150 deletions(-)
delete mode 100644 packages/centro_notifiche/hub_common.yaml
diff --git a/packages/centro_notifiche/hub_common.yaml b/packages/centro_notifiche/hub_common.yaml
deleted file mode 100644
index 12cdd54..0000000
--- a/packages/centro_notifiche/hub_common.yaml
+++ /dev/null
@@ -1,150 +0,0 @@
-#######################################-#######################################
-## CUSTOMIZE
-#######################################-#######################################
-homeassistant:
- customize:
- ## NODE ANCHORS
- package.node_anchors:
- customize: &customize
- package: Centro Notifiche π
- site: hassiohelp.eu π
- author: Caio & Gianpi
- version: Common 3.2.0
-
- expose: &expose
- <<: *customize
- haaska_hidden: false
- homebridge_hidden: false
-
- ## AUTOMATION
- automation.auto_volume_hub:
- <<: *customize
- friendly_name: Volume Automatico Hub
- automation.hub_initialization_at_startup:
- <<: *customize
- friendly_name: Startup HUB
- ## GROUP
- group.automations_notification_hub:
- <<: *customize
- friendly_name: Automazioni HUB
- icon: mdi:account-tie
- group.location_tracker:
- <<: *customize
- friendly_name: Dispositivi tracciati
- icon: mdi:target-account
- group.media_player_alexa:
- <<: *customize
- friendly_name: Gruppo Alexa
- icon: mdi:speaker-multiple
- group.media_player_google:
- <<: *customize
- friendly_name: Gruppo Google
- icon: mdi:speaker-multiple
-#######################################-#######################################
-## AUTOMATION
-#######################################-#######################################
-automation:
- #----------------------------------------------------------------------------------------------------#
- # INITIALIZE
- #----------------------------------------------------------------------------------------------------#
- - alias: Hub initialization at startup
- initial_state: true
- trigger:
- - platform: homeassistant
- event: start
- - platform: event
- event_type: automation_reloaded
- action:
- # Crea un Gruppo location_tracker da entity Person.
- - service: group.set
- data:
- object_id: location_tracker
- entities: >-
- {{states.person|join(',','entity_id')}}
-
- - choose:
- - conditions: "{{state_attr('input_select.notification_media_player_alexa', 'options') is not none }}"
- sequence:
- # Crea un Gruppo media_player_alexa da entity input_select.notification_media_player_alexa.
- - service: group.set
- data:
- object_id: media_player_alexa
- entities: >-
- {% set lista_alexa = expand('input_select.notification_media_player_alexa')|join(',','attributes.options') %}
- {{ states.media_player
- | selectattr('attributes.friendly_name', 'defined')
- | selectattr('attributes.friendly_name', 'in', lista_alexa)
- | map(attribute='entity_id')|list
- }}
-
- - choose:
- - conditions: "{{state_attr('input_select.notification_media_player_google', 'options') is not none }}"
- sequence:
- # Crea un Gruppo media_player_google da entity input_select.notification_media_player_google.
- - service: group.set
- data:
- object_id: media_player_google
- entities: >-
- {% set lista_google = expand('input_select.notification_media_player_google')|join(',','attributes.options') %}
- {{ states.media_player
- | selectattr('attributes.friendly_name', 'defined')
- | selectattr('attributes.friendly_name', 'in', lista_google)
- | map(attribute='entity_id')|list
- }}
-
- # Crea un Gruppo automations_notification_hub se l'attributo "id:" o il "nome" delle automazioni finiscono con "hub".
- - service: group.set
- data:
- object_id: "automations_notification_hub"
- entities: >
- {%for item in states.automation if ((item.attributes.id|lower).endswith('hub'))
- or ((item.attributes.friendly_name|lower).endswith('hub')) %}
- {{-item.entity_id}}{%if not loop.last%},{%endif-%}{%endfor%}
-
- # Execute auto_volume_hub Automation.
- - service: automation.trigger
- entity_id: automation.auto_volume_hub
- # skip_condition: true
-
- #----------------------------------------------------------------------------------------------------#
- # Automatic Volume - Media player volume adjustment, based on period_of_day_volume sensor
- #----------------------------------------------------------------------------------------------------#
- - alias: Auto Volume Hub
- mode: queued
- initial_state: true
- trigger:
- - platform: state
- entity_id: sensor.period_of_day_volume
- action:
- - variables:
- list_alexa: "{{expand('group.media_player_alexa')|map(attribute='entity_id')|list}}"
- list_google: "{{expand('group.media_player_google')|map(attribute='entity_id')|list}}"
- all_entity: "{{list_alexa + list_google}}"
- volume: "{{states('sensor.period_of_day_volume')|float}}"
- - choose:
- - conditions: "{{list_alexa|length > 0}}"
- sequence:
- - service: notify.alexa_media
- data:
- data:
- type: tts
- target: "{{list_alexa}}"
- message: >
-
-
- volume
-
- - delay: "00:00:02"
- - choose:
- - conditions: "{{all_entity|length > 0}}"
- sequence:
- - service: media_player.volume_set
- data:
- entity_id: "{{all_entity}}"
- volume_level: "{{(volume|round(2))/100}}"
- - service: input_number.set_value
- data:
- entity_id:
- - input_number.intercom_message_volume
- - input_number.default_restore_volume
- value: "{{volume}}"
From e40d7d1aba2d16046a5abde6a04f74be4d895731 Mon Sep 17 00:00:00 2001
From: caiosweet <24454580+caiosweet@users.noreply.github.com>
Date: Fri, 15 Jan 2021 22:03:51 +0100
Subject: [PATCH 07/13] Add files via upload
---
packages/centro_notifiche/hub_main.yaml | 181 ++++++++++++++++++++----
1 file changed, 155 insertions(+), 26 deletions(-)
diff --git a/packages/centro_notifiche/hub_main.yaml b/packages/centro_notifiche/hub_main.yaml
index c2ee306..7c317fc 100644
--- a/packages/centro_notifiche/hub_main.yaml
+++ b/packages/centro_notifiche/hub_main.yaml
@@ -1,7 +1,7 @@
### INFO
-# @author : Caio & Gianpi - hassiohelp.eu
-# @date : Started 01/11/2019 - Updated 07/11/2020
-# @package : Notification HUB - Centro Notifiche
+# @author : Caio & Gianpi - hassiohelp.eu π
+# @date : Started 01/11/2019 - Updated 15/01/2021
+# @package : Notification HUB - Centro Notifiche π
# @description : Package Appdaemon Notifier Center for Home Assistant
############################################################################
@@ -18,12 +18,13 @@ homeassistant:
author: Caio & Gianpi
version: Main 3.2.0
- expose: &expose
- <<: *customize
- haaska_hidden: false
- homebridge_hidden: false
-
## AUTOMATION
+ automation.auto_volume_hub:
+ <<: *customize
+ friendly_name: Volume Automatico Hub
+ automation.hub_initialization_at_startup:
+ <<: *customize
+ friendly_name: Startup HUB
automation.guest_mode_hub:
<<: *customize
friendly_name: Modo Ospite
@@ -41,6 +42,23 @@ homeassistant:
binary_sensor.people_home:
<<: *customize
friendly_name: Persone in casa # People at Home
+ ## GROUP
+ group.automations_notification_hub:
+ <<: *customize
+ friendly_name: Automazioni HUB
+ icon: mdi:account-tie
+ group.location_tracker:
+ <<: *customize
+ friendly_name: Dispositivi tracciati
+ icon: mdi:target-account
+ group.media_player_alexa:
+ <<: *customize
+ friendly_name: Gruppo Alexa
+ icon: mdi:speaker-multiple
+ group.media_player_google:
+ <<: *customize
+ friendly_name: Gruppo Google
+ icon: mdi:speaker-multiple
## INPUT BOOLEAN
input_boolean.guest_mode:
<<: *customize
@@ -201,13 +219,6 @@ homeassistant:
###############################################################################
media_extractor:
-#######################################-#######################################
-## GROUP
-#######################################-#######################################
-# group:
-# location_tracker:
-# entities: !secret location_tracker_hub
-
#######################################-#######################################
## INPUT
#######################################-#######################################
@@ -280,18 +291,25 @@ input_select:
options: !secret text_notify_hub
phone_notify:
options: ["Telegram Call", "Voip Call"]
- language: # Uncomment if you want Extra language for Alexa
+ language:
options:
- ["it-IT", "en-GB", "en-US", "fr-FR", "de-DE", "es-ES", "ja-JP"]
- # "en-CA",
- # "en-AU",
- # "en-IN",
- # "fr-CA",
- # "hi-IN",
- # "ja-JP",
- # "pt-BR",
- # "es-US",
- # "es-MX",
+ - it-IT
+ - en-GB
+ - en-US
+ - fr-FR
+ - de-DE
+ - es-ES
+ - ja-JP
+ # Extra Only For Alexa
+ - en-CA
+ - en-AU
+ - en-IN
+ - fr-CA
+ - hi-IN
+ - ja-JP
+ - pt-BR
+ - es-US
+ - es-MX
input_text:
last_message:
max: 255
@@ -447,6 +465,115 @@ shell_command:
## AUTOMATION
#######################################-#######################################
automation:
+ #----------------------------------------------------------------------------------------------------#
+ # INITIALIZE
+ #----------------------------------------------------------------------------------------------------#
+ - alias: Hub initialization at startup
+ initial_state: true
+ trigger:
+ - platform: homeassistant
+ event: start
+ - platform: event
+ event_type: automation_reloaded
+ action:
+ # Automatic creation of the location_tracker Group from Domain Person.
+ # {{expand(states.person)|map(attribute='entity_id')|list}}
+ - service: group.set
+ data:
+ object_id: location_tracker
+ entities: >-
+ {{states.person|join(',','entity_id')}}
+
+ - choose:
+ - conditions: "{{state_attr('input_select.notification_media_player_alexa', 'options') is not none }}"
+ sequence:
+ # Automatic creation of the media_player_alexa Group
+ # from entity input_select.notification_media_player_alexa if it exists.
+ - service: group.set
+ data:
+ object_id: media_player_alexa
+ entities: >-
+ {% set lista_alexa = expand('input_select.notification_media_player_alexa')|join(',','attributes.options') %}
+ {{ states.media_player
+ | selectattr('attributes.friendly_name', 'defined')
+ | selectattr('attributes.friendly_name', 'in', lista_alexa)
+ | map(attribute='entity_id')|list
+ }}
+
+ - choose:
+ - conditions: "{{state_attr('input_select.notification_media_player_google', 'options') is not none }}"
+ sequence:
+ # Automatic creation of the media_player_google Group
+ # from entity input_select.notification_media_player_google if it exists.
+ - service: group.set
+ data:
+ object_id: media_player_google
+ entities: >-
+ {% set lista_google = expand('input_select.notification_media_player_google')|join(',','attributes.options') %}
+ {{ states.media_player
+ | selectattr('attributes.friendly_name', 'defined')
+ | selectattr('attributes.friendly_name', 'in', lista_google)
+ | map(attribute='entity_id')|list
+ }}
+
+ # Automatic creation of an automations_notification_hub Group
+ # if the "id:" attribute or the "name" of the automations ends with "hub".
+ - service: group.set
+ data:
+ object_id: "automations_notification_hub"
+ entities: >
+ {%for item in states.automation if ((item.attributes.id|lower).endswith('hub'))
+ or ((item.attributes.friendly_name|lower).endswith('hub')) %}
+ {{-item.entity_id}}{%if not loop.last%},{%endif-%}{%endfor%}
+
+ # Execute auto_volume_hub Automation.
+ - service: automation.trigger
+ entity_id: automation.auto_volume_hub
+ # skip_condition: true
+
+ #----------------------------------------------------------------------------------------------------#
+ # Automatic Volume - Media player volume adjustment, based on period_of_day_volume sensor
+ #----------------------------------------------------------------------------------------------------#
+ - alias: Auto Volume Hub
+ mode: queued
+ initial_state: true
+ trigger:
+ - platform: state
+ entity_id: sensor.period_of_day_volume
+ action:
+ - variables:
+ list_alexa: "{{expand('group.media_player_alexa')|map(attribute='entity_id')|list}}"
+ list_google: "{{expand('group.media_player_google')|map(attribute='entity_id')|list}}"
+ all_entity: "{{list_alexa + list_google}}"
+ volume: "{{states('sensor.period_of_day_volume')|float}}"
+ - choose:
+ - conditions: "{{list_alexa|length > 0}}"
+ sequence:
+ - service: notify.alexa_media
+ data:
+ data:
+ type: tts
+ target: "{{list_alexa}}"
+ message: >
+
+
+ volume
+
+ - delay: "00:00:02"
+ - choose:
+ - conditions: "{{all_entity|length > 0}}"
+ sequence:
+ - service: media_player.volume_set
+ data:
+ entity_id: "{{all_entity}}"
+ volume_level: "{{(volume|round(2))/100}}"
+ - service: input_number.set_value
+ data:
+ entity_id:
+ - input_number.intercom_message_volume
+ - input_number.default_restore_volume
+ value: "{{volume}}"
+
#----------------------------------------------------------------------------------------------------#
# LAST MESSAGE - Repeat the last text sent (Excluding tts messages)
#----------------------------------------------------------------------------------------------------#
@@ -477,6 +604,7 @@ automation:
entity_id:
# - input_boolean.priority_message
- input_boolean.last_message
+
#----------------------------------------------------------------------------------------------------#
# INTERCOM - To send messages from the GUI (graphical user interface)
#----------------------------------------------------------------------------------------------------#
@@ -498,6 +626,7 @@ automation:
data:
entity_id: input_text.intercom_message_hub
value: ""
+
#----------------------------------------------------------------------------------------------------#
# GUEST - On and Off guest mode - The TTS works even if you are away from home.
# Useful even if you want to exclude automations if there are guests in the house
From e6f8d2afb7acdd71f03bc3a6e63c03309666ec9a Mon Sep 17 00:00:00 2001
From: caiosweet <24454580+caiosweet@users.noreply.github.com>
Date: Fri, 19 Feb 2021 18:07:35 +0100
Subject: [PATCH 08/13] Update my_lovelace_card.yaml
Fixed lovelace-paper-buttons-row Breaking Changes
---
extra/my_lovelace_card.yaml | 90 +++++++++++++++----------------------
1 file changed, 36 insertions(+), 54 deletions(-)
diff --git a/extra/my_lovelace_card.yaml b/extra/my_lovelace_card.yaml
index 5b5e2f6..ce3baaf 100644
--- a/extra/my_lovelace_card.yaml
+++ b/extra/my_lovelace_card.yaml
@@ -33,9 +33,9 @@ cards:
- type: custom:paper-buttons-row
buttons:
- entity: binary_sensor.people_home
- name: false
+ layout: icon
- entity: group.location_tracker
- name: false
+ layout: icon
tap_action:
action: more-info
state_icons:
@@ -49,35 +49,35 @@ cards:
button:
color: var(--paper-item-icon-active-color)
- entity: input_boolean.phone_notifications
- name: false
+ layout: icon
state_icons:
"off": "mdi:phone-off"
- entity: input_boolean.speech_notifications
- name: false
+ layout: icon
state_icons:
"on": "mdi:account-tie-voice"
"off": "mdi:account-tie-voice-off"
- entity: input_boolean.text_notifications
- name: false
+ layout: icon
state_icons:
"off": "mdi:cellphone-message-off"
- entity: input_boolean.screen_notifications
- name: false
+ layout: icon
state_icons:
"off": "mdi:message-bulleted-off"
- entity: input_boolean.guest_mode
- name: false
+ layout: icon
state_icons:
"on": "mdi:account-multiple-plus"
"off": "mdi:account-multiple-minus-outline"
- entity: input_boolean.priority_message
- name: false
+ layout: icon
state_icons:
"off": "mdi:alarm-light-outline"
- entity: input_boolean.holidays
- name: false
+ layout: icon
- entity: binary_sensor.dnd
- name: false
+ layout: icon
state_icons:
"on": "mdi:do-not-disturb"
"off": "mdi:do-not-disturb-off"
@@ -92,14 +92,12 @@ cards:
overflow: hidden; box-shadow: none; background: none; border-radius: 0px; font-size: 0.9em;
}
columns: 3
- # show_name: false
show_icon: false
state_color: true
entities:
- entity: sensor.period_of_day
- entity: sensor.period_of_day_volume
- entity: input_number.default_restore_volume
- # Second column
- entity: input_select.notification_media_player_alexa
tap_action:
action: call-service
@@ -147,19 +145,21 @@ cards:
- type: custom:paper-buttons-row
buttons:
- entity: input_boolean.google_switch
+ layout: icon|name
name: Google
- entity: input_select.tts_notify
+ layout: icon|state
icon: false
- state_icons:
- "Google Say": "mdi:google"
- "Google Cloud": "mdi:google-cloud"
- "Google Assistant": "mdi:google-assistant"
- "Reverso": "mdi:cached"
+ # state_icons:
+ # "google say": "mdi:google"
+ # "google cloud": "mdi:google-cloud"
+ # "google assistant": "mdi:google-assistant"
+ # "reverso": "mdi:cached"
state_text:
- "Google Say": "Say"
- "Google Cloud": "Cloud"
- "Google Assistant": "Assistant"
- "Reverso": "Reverso"
+ "google say": "Say"
+ "google cloud": "Cloud"
+ "google assistant": "Assistant"
+ "reverso": "Reverso"
# state_styles:
# "on":
# button:
@@ -174,21 +174,23 @@ cards:
entity_id: input_select.tts_notify
- entity: input_boolean.alexa_switch
+ layout: icon|name
name: Alexa
- entity: input_select.default_alexa_type
- tooltip: false
- icon: false
- state_icons:
- "TTS": "mdi:text-shadow"
- "Push": "mdi:cellphone-text"
- "Dropin": "mdi:form-dropdown"
- state_text:
- "TTS": "TTS"
- "Announce": "Announce"
- "Push": "Push"
- "Dropin": "Dropin"
+ layout: state
+ state:
+ case: first
+ # state_icons:
+ # "TTS": "mdi:text-shadow"
+ # "Push": "mdi:cellphone-text"
+ # "Dropin": "mdi:form-dropdown"
+ # state_text:
+ # "tts": "TTS"
+ # "announce": "Announce"
+ # "push": "Push"
+ # "dropin": "Dropin"
state_styles:
- "Announce":
+ "announce":
button:
color: var(--paper-item-icon-active-color)
tap_action:
@@ -197,6 +199,7 @@ cards:
service_data:
entity_id: input_select.default_alexa_type
- entity: input_boolean.alexa_ssml
+ layout: icon|name
name: SSML
# TEXT INPUT ROW
- type: divider
@@ -224,27 +227,6 @@ cards:
service: input_boolean.turn_on
service_data:
entity_id: input_boolean.last_message
- # - entity: sensor.centro_notifiche
- extend_paper_buttons_row:
- buttons:
- - entity: input_boolean.html_mode
- # name: false
- tap_action:
- action: toggle
- state_icons:
- "off": "mdi:language-markdown"
- "on": "mdi:language-html5"
- state_text:
- "off": "Modo Markdown"
- "on": "Modo HTML"
- state_styles:
- # "off":
- # button:
- # color: red
- "on":
- button:
- color: var(--paper-item-icon-active-color)
-
entities:
- type: custom:lovelace-multiline-text-input-card
style: |
From 6aac2e53156bd62bcac5bdb66abd3140fa9714da Mon Sep 17 00:00:00 2001
From: caiosweet <24454580+caiosweet@users.noreply.github.com>
Date: Mon, 15 Mar 2021 18:09:31 +0100
Subject: [PATCH 09/13] Update Card-mod
---
extra/my_lovelace_card.yaml | 73 ++++++++++++++++++++-----------------
1 file changed, 39 insertions(+), 34 deletions(-)
diff --git a/extra/my_lovelace_card.yaml b/extra/my_lovelace_card.yaml
index ce3baaf..a048ad6 100644
--- a/extra/my_lovelace_card.yaml
+++ b/extra/my_lovelace_card.yaml
@@ -4,17 +4,18 @@ cards:
- type: custom:banner-card
heading: [mdi:account-tie, Alfred]
link: centro_notifiche
- style: |
- ha-card {
- overflow: hidden;
- --bc-font-size-heading: 2em;
- --bc-font-size-entity-value: 1em;
- font-size: 1em;
- --paper-icon-button: var(--paper-item-icon-active-color);
- border-radius: var(--ha-card-border-radius) var(--ha-card-border-radius) 0px 0px;
- background: content-box radial-gradient(var(--light-primary-color), var(--primary-color));
- box-shadow: none;
- }
+ card_mod:
+ style: |
+ ha-card {
+ overflow: hidden;
+ --bc-font-size-heading: 2em;
+ --bc-font-size-entity-value: 1em;
+ font-size: 1em;
+ --paper-icon-button: var(--paper-item-icon-active-color);
+ border-radius: var(--ha-card-border-radius) var(--ha-card-border-radius) 0px 0px;
+ background: content-box radial-gradient(var(--light-primary-color), var(--primary-color));
+ box-shadow: none;
+ }
# MARKDOWN SENSOR NOTIFIER APP CONDITIONAL
- type: conditional
conditions:
@@ -22,11 +23,12 @@ cards:
state_not: "on"
card:
type: markdown
- style: |
- ha-card {
- border-radius: var(--ha-card-border-radius) var(--ha-card-border-radius) 0px 0px;
- background: red; box-shadow: none; color: yellow;
- }
+ card_mod:
+ style: |
+ ha-card {
+ border-radius: var(--ha-card-border-radius) var(--ha-card-border-radius) 0px 0px;
+ background: red; box-shadow: none; color: yellow;
+ }
content: >-
β {{states('sensor.centro_notifiche')}}
# PAPER BUTTONS Row 1
@@ -87,10 +89,11 @@ cards:
height: 1px
# GLANCE
- type: glance
- style: |
- ha-card {
- overflow: hidden; box-shadow: none; background: none; border-radius: 0px; font-size: 0.9em;
- }
+ card_mod:
+ style: |
+ ha-card {
+ overflow: hidden; box-shadow: none; background: none; border-radius: 0px; font-size: 0.9em;
+ }
columns: 3
show_icon: false
state_color: true
@@ -207,13 +210,14 @@ cards:
background-color: var(--primary-color)
height: 1px
- type: entities
- style: |
- ha-card {
- background:none; border-radius: 0px; box-shadow: none;
- }
- .card-content {
- padding-top: 0; margin-top: 0; padding-bottom: 0; margin-bottom: 0;
- }
+ card_mod:
+ style: |
+ ha-card {
+ background:none; border-radius: 0px; box-shadow: none;
+ }
+ .card-content {
+ padding-top: 0; margin-top: 0; padding-bottom: 0; margin-bottom: 0;
+ }
entities:
- type: custom:fold-entity-row
padding: 0
@@ -229,13 +233,14 @@ cards:
entity_id: input_boolean.last_message
entities:
- type: custom:lovelace-multiline-text-input-card
- style: |
- ha-card {
- background:none; border-radius: 0px; box-shadow: none;
- color: var(--primary-text-color);
- }
- textarea.textarea {margin-top: 0;}
- .card-content {padding-top: 0;}
+ card_mod:
+ style: |
+ ha-card {
+ background:none; border-radius: 0px; box-shadow: none;
+ color: var(--primary-text-color);
+ }
+ textarea.textarea {margin-top: 0;}
+ .card-content {padding-top: 0;}
# autosave: true
entity: input_text.intercom_message_hub
max_length: 255
From cfa6531f5a8d8e206699024d02c60f860ee6ae0b Mon Sep 17 00:00:00 2001
From: caiosweet <24454580+caiosweet@users.noreply.github.com>
Date: Mon, 15 Mar 2021 18:15:11 +0100
Subject: [PATCH 10/13] Update my_lovelace_view.yaml
---
extra/my_lovelace_view.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/extra/my_lovelace_view.yaml b/extra/my_lovelace_view.yaml
index cd8ed2c..0ff95ea 100644
--- a/extra/my_lovelace_view.yaml
+++ b/extra/my_lovelace_view.yaml
@@ -36,6 +36,7 @@ cards:
service_data:
entity_id: input_boolean.speech_notifications
- type: call-service
+ entity: input_boolean.last_message
name: Ultimo Messaggio
action_name: Ascolta
service: input_boolean.turn_on
@@ -174,4 +175,3 @@ cards:
entities:
- entity: input_text.phone_called_number
- entity: input_select.phone_notify
-
From f51a545145c15b13de506a4d5b478cbddc64cd09 Mon Sep 17 00:00:00 2001
From: caiosweet <24454580+caiosweet@users.noreply.github.com>
Date: Mon, 15 Mar 2021 18:17:12 +0100
Subject: [PATCH 11/13] Update binary_sensor.yaml
---
extra/binary_sensor.yaml | 27 ---------------------------
1 file changed, 27 deletions(-)
diff --git a/extra/binary_sensor.yaml b/extra/binary_sensor.yaml
index 01066ad..0ce4a40 100644
--- a/extra/binary_sensor.yaml
+++ b/extra/binary_sensor.yaml
@@ -6,30 +6,3 @@ binary_sensor:
add_holidays:
- '2020-08-31'
- '2021-08-31'
-
- - platform: template
- sensors:
- people_home:
- friendly_name: Persone in casa
- device_class: presence
- value_template: "{{is_state('group.location_tracker','home')}}"
- icon_template: >-
- {% set people = expand('group.location_tracker')|selectattr('state','eq','home')
- |list|count+(1 if is_state('input_boolean.guest_mode','on') else 0) %}
- {% set icon = {0 :'mdi:account-off',
- 1 :'mdi:account',
- 2 :'mdi:account-multiple',
- 3 :'mdi:account-multiple-check'} %}
- {{icon[people] if people in icon else 'mdi:account-group'}}
- attribute_templates:
- number: >-
- {% if is_state('group.location_tracker','home')%}
- {{expand('group.location_tracker')|selectattr('state','eq','home')
- |list|count+(1 if is_state('input_boolean.guest_mode','on') else 0)}}
- {%endif%}
- name: >-
- {% if is_state('group.location_tracker','home')%}
- {{expand('group.location_tracker')|selectattr('state','eq','home')
- |join(', ',attribute='name')+(', Ospiti' if is_state('input_boolean.guest_mode','on') else '')}}
- {%endif%}
-
From 6b94c3fe17072747f234e5e404308df9b6c630c2 Mon Sep 17 00:00:00 2001
From: caiosweet <24454580+caiosweet@users.noreply.github.com>
Date: Mon, 15 Mar 2021 19:16:03 +0100
Subject: [PATCH 12/13] Initialization of the entity
input_text.personal_assistant_name
---
packages/centro_notifiche/hub_main.yaml | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/packages/centro_notifiche/hub_main.yaml b/packages/centro_notifiche/hub_main.yaml
index 7c317fc..f11f912 100644
--- a/packages/centro_notifiche/hub_main.yaml
+++ b/packages/centro_notifiche/hub_main.yaml
@@ -1,6 +1,6 @@
### INFO
# @author : Caio & Gianpi - hassiohelp.eu π
-# @date : Started 01/11/2019 - Updated 15/01/2021
+# @date : Started 01/11/2019 - Updated 15/03/2021
# @package : Notification HUB - Centro Notifiche π
# @description : Package Appdaemon Notifier Center for Home Assistant
############################################################################
@@ -476,7 +476,7 @@ automation:
- platform: event
event_type: automation_reloaded
action:
- # Automatic creation of the location_tracker Group from Domain Person.
+ # Automatic creation of the location_tracker Group from Person Domain.
# {{expand(states.person)|map(attribute='entity_id')|list}}
- service: group.set
data:
@@ -516,6 +516,14 @@ automation:
| map(attribute='entity_id')|list
}}
+ - choose:
+ - conditions: "{{states('input_text.personal_assistant_name') == 'unknown' }}"
+ sequence:
+ - service: input_text.set_value
+ data:
+ entity_id: input_text.personal_assistant_name
+ value: ""
+
# Automatic creation of an automations_notification_hub Group
# if the "id:" attribute or the "name" of the automations ends with "hub".
- service: group.set
From 834e785b931daf22798fa1345c72396f18bc0141 Mon Sep 17 00:00:00 2001
From: caiosweet <24454580+caiosweet@users.noreply.github.com>
Date: Mon, 15 Mar 2021 19:22:19 +0100
Subject: [PATCH 13/13] Update hub_automations.yaml
---
examples/hub_automations.yaml | 103 +++++++++++++++++++---------------
1 file changed, 59 insertions(+), 44 deletions(-)
diff --git a/examples/hub_automations.yaml b/examples/hub_automations.yaml
index e57d2b7..83b8809 100644
--- a/examples/hub_automations.yaml
+++ b/examples/hub_automations.yaml
@@ -57,7 +57,7 @@ automation:
- platform: state
entity_id: sensor.centro_notifiche
to: "on"
- timeout: 60
+ timeout: 120
continue_on_timeout: true
- service: script.my_notify
data:
@@ -71,8 +71,8 @@ automation:
Il sistema Γ¨ operativo!.
voice: Giorgio
type: tts
- google:
- media_content_id: https://actions.google.com/sounds/v1/human_voices/human_fart.ogg
+ # google:
+ # media_content_id: https://actions.google.com/sounds/v1/human_voices/human_fart.ogg
# media_content_type: sound
default:
- service: "notify.{{notification_service}}"
@@ -151,7 +151,6 @@ automation:
trigger:
- platform: state
entity_id: person.claudio
- from: "not_home"
to: "home"
for: "00:02:00"
action:
@@ -200,7 +199,6 @@ automation:
trigger:
- platform: state
entity_id: person.claudio
- from: "not_home"
to: "home"
for: "00:02:00"
action:
@@ -369,38 +367,38 @@ automation:
# SEGUIMI - Imposta il Media Player in automatico
#----------------------------------------------------------------------------------------------------#
- alias: Seguimi Hub
- mode: queued
+ mode: restart
+ max_exceeded: silent
trigger:
platform: state
entity_id:
- binary_sensor.motion_sensor_158d000222ccb7 #studio
- - binary_sensor.motion_sensor_158d0001e5cfdd #corridoio
+ # - binary_sensor.motion_sensor_158d0001e5cfdd #corridoio
+ - binary_sensor.pir_corridoio
+ - binary_sensor.pir_sala
- binary_sensor.cam_sala
from: "off"
to: "on"
action:
+ - variables:
+ studio: "{{is_state('binary_sensor.motion_sensor_158d000222ccb7', 'on')}}"
+ corridoio: "{{is_state('binary_sensor.pir_corridoio', 'on')}}"
+ sala: "{{is_state('binary_sensor.pir_sala', 'on') or is_state('binary_sensor.cam_sala', 'on')}}"
- service: input_select.select_option
entity_id: input_select.notification_media_player_alexa
data:
option: >-
- {% if is_state("binary_sensor.motion_sensor_158d000222ccb7", "on") %}
- Studio
- {% elif is_state("binary_sensor.cam_sala", "on") %}
- Sala
- {% else %}
- Gruppo Alexa
- {% endif %}
+ {% if studio %} Studio
+ {% elif sala %} Sala
+ {% else %} Gruppo Alexa {% endif %}
- service: input_select.select_option
entity_id: input_select.notification_media_player_google
data:
option: >-
- {% if is_state("binary_sensor.motion_sensor_158d000222ccb7", "on") %}
- Red
- {% elif is_state("binary_sensor.cam_sala", "on") %}
- Black
- {% elif is_state("binary_sensor.motion_sensor_158d0001e5cfdd", "on") %}
- Black due
- {% endif %}
+ {% if studio %} Red
+ {% elif sala %} Black
+ {% elif corridoio %} Black due
+ {% else %} Gruppo Google {% endif %}
#----------------------------------------------------------------------------------------------------#
# HACS - Updates
@@ -472,8 +470,8 @@ automation:
message: Autenticazione Richiesta
notify: pushover
link: "[Integrazioni]({{external_url}}/config/integrations)"
- # link Markdown --> [Nome link](LINK)
- # link html --> "Nome link"
+ # link Markdown --> [Nome link](LINK)
+ # link html --> "Nome link"
#----------------------------------------------------------------------------------------------------#
# Test trigger event - Notifica location
@@ -481,33 +479,20 @@ automation:
- alias: Notifica location
initial_state: true
trigger:
- # - platform: state
- # entity_id:
- # - person.claudio
- platform: event
event_type: state_changed
- condition:
- # - "{{ trigger.to_state is not none
- # and (trigger.from_state is none or trigger.to_state.state != trigger.from_state.state) }}"
-
+ condition: # ??trigger.event.data.old_state is none
- "{{ trigger.event.data.entity_id.startswith('person') }}"
- - "{{trigger.event.data.old_state is not none
- and (trigger.event.data.old_state is none or trigger.event.data.new_state.state != trigger.event.data.old_state.state)
- }}"
+ - "{{ trigger.event.data.old_state is not none
+ and (trigger.event.data.old_state is none
+ or trigger.event.data.new_state.state != trigger.event.data.old_state.state) }}"
action:
- variables:
- # lat: "{{trigger.to_state.attributes.latitude}}"
- # long: "{{trigger.to_state.attributes.longitude}}"
- # from: "{{trigger.from_state.state if trigger.from_state is not none else 'sconosciuto'}}"
- # to: "{{trigger.to_state.state}}"
- # name: "{{trigger.to_state.name}}"
-
lat: "{{trigger.event.data.new_state.attributes.latitude}}"
long: "{{trigger.event.data.new_state.attributes.longitude}}"
from: "{{trigger.event.data.old_state.state if trigger.event.data.old_state is not none else 'sconosciuto'}}"
to: "{{trigger.event.data.new_state.state}}"
name: "{{trigger.event.data.new_state.attributes.friendly_name}}"
-
- service: script.my_notify
data:
alexa: true
@@ -517,10 +502,6 @@ automation:
{% set from = state_dict.get(from, from) %}
{% set to = state_dict.get(to, to) %}
{{ name }} si Γ¨ spostato da {{ from }} a {{ to }}
- # link: >
- # {% if lat and not to in 'home' %}
- # [Mappa](https://www.openstreetmap.org/?mlat={{lat}}&mlon={{long}}#map=8/{{lat}}/{{long}})
- # {% endif %}
- choose:
- conditions: "{{not to in 'home' and lat != ''}}"
sequence:
@@ -530,3 +511,37 @@ automation:
latitude: "{{lat}}"
longitude: "{{long}}"
# target: target
+
+ #----------------------------------------------------------------------------------------------------#
+ # Notifica Person location
+ #----------------------------------------------------------------------------------------------------#
+ # - alias: Notifica Person location
+ # initial_state: true
+ # trigger:
+ # - platform: state
+ # entity_id:
+ # - person.claudio
+ # condition:
+ # - "{{ trigger.to_state is not none
+ # and (trigger.from_state is none or trigger.to_state.state != trigger.from_state.state) }}"
+ # action:
+ # - variables:
+ # lat: "{{trigger.to_state.attributes.latitude}}"
+ # long: "{{trigger.to_state.attributes.longitude}}"
+ # from: "{{trigger.from_state.state if trigger.from_state is not none else 'sconosciuto'}}"
+ # to: "{{trigger.to_state.state}}"
+ # name: "{{trigger.to_state.name}}"
+ # - service: script.my_notify
+ # data:
+ # alexa: true
+ # title: "π Location {{name}}"
+ # message: >
+ # {% set state_dict = {'home': 'Casa', 'not_home': 'Fuori Casa'} %}
+ # {% set from = state_dict.get(from, from) %}
+ # {% set to = state_dict.get(to, to) %}
+ # {{ name }} si Γ¨ spostato da {{ from }} a {{ to }}
+ # link: >
+ # {% if lat and not to in 'home' %}
+ # [Mappa](https://www.openstreetmap.org/?mlat={{lat}}&mlon={{long}}#map=8/{{lat}}/{{long}})
+ # {% endif %}
+