Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##########################################################################################################################################
- ####################################################### P A C K A G E #################################################################
- #########################################################################################################################################
- homeassistant:
- customize:
- package.node_anchors:
- customize: &customize
- package: "cn_centro_messaggi"
- version: "v1.1"
- author: "Calas"
- expose: &expose
- <<: *customize
- haaska_hidden: false
- homebridge_hidden: false
- ################################################
- ## Input Text Customize
- ################################################
- input_text.cn_ultimo_messaggio:
- <<: *customize
- ################################################
- ## Input Boolean Customize
- ################################################
- input_boolean.ultimo_messaggio:
- <<: *customize
- input_boolean.messaggio_prioritario:
- <<: *customize
- input_boolean.modo_ospite:
- <<: *customize
- input_boolean.non_disturbare:
- <<: *customize
- input_boolean.invio_volume_riavvio:
- <<: *customize
- ################################################
- ## Input Datetime Customize
- ################################################
- input_datetime.inizio_dnd:
- <<: *customize
- input_datetime.fine_dnd:
- <<: *customize
- input_datetime.start_mattina:
- <<: *customize
- input_datetime.start_pomeriggio:
- <<: *customize
- input_datetime.start_sera:
- <<: *customize
- input_datetime.start_notte:
- <<: *customize
- ################################################
- ## Input Number Customize
- ################################################
- input_number.volume_mattina:
- <<: *customize
- input_number.volume_pomeriggio:
- <<: *customize
- input_number.volume_sera:
- <<: *customize
- input_number.volume_notte:
- <<: *customize
- input_number.volume_riascolto:
- <<: *customize
- input_number.salvataggio_volume:
- <<: *customize
- input_number.ritardo_invio_volume_riavvio:
- <<: *customize
- ################################################
- ## Sensor Customize
- ################################################
- sensor.periodo:
- <<: *customize
- sensor.volume_periodo:
- <<: *customize
- sensor.volume_periodo_template:
- <<: *customize
- ################################################
- ## Binary Sensor Customize
- ################################################
- binary_sensor.dnd:
- <<: *customize
- ################################################
- ## Script Customize
- ################################################
- script.set_volume_speaker:
- <<: *customize
- script.set_volume_prioritario:
- <<: *customize
- script.set_volume_riascolto:
- <<: *customize
- script.salvataggio_volume:
- <<: *customize
- ################################################
- ## Automations Customize
- ################################################
- automation.crea_gruppo_notifiche_cnv:
- <<: *customize
- automation.crea_gruppo_notifiche_cnt:
- <<: *customize
- automation.ripeti_ultimo_messaggio:
- <<: *customize
- automation.settaggio_volume:
- <<: *customize
- automation.non_disturbare_start:
- <<: *customize
- automation.non_disturbare_fine:
- <<: *customize
- automation.dnd_on:
- <<: *customize
- automation.dnd_off:
- <<: *customize
- automation.messaggio_prioritario:
- <<: *customize
- automation.messaggio_prioritario_off:
- <<: *customize
- input_text.interfono_message:
- <<: *customize
- input_select.interfono_mittente:
- <<: *customize
- input_number.interfono_volume:
- <<: *customize
- input_boolean.interfono_ripristino_volume:
- <<: *customize
- #******************************************************************************#
- # C O R P O #
- #******************************************************************************#
- ################################################################################
- #################################################### INPUT #####################
- ################################################################################
- ################################################################################
- ## Input Text
- ################################################
- input_text:
- cn_ultimo_messaggio:
- initial: ""
- name: Ultimo Messaggio
- max: 255
- interfono_message:
- name: Messaggio
- max: 255
- initial: ''
- ################################################################################
- ## Input Boolean
- ################################################
- input_boolean:
- ultimo_messaggio:
- name: Ultimo Messaggio
- icon: mdi:repeat-once
- messaggio_prioritario:
- name: Messaggio Prioritario
- icon: mdi:message-alert
- modo_ospite:
- name: Modalità Ospite
- icon: mdi:account-check
- non_disturbare:
- name: Non disturbare automatico
- icon: mdi:volume-off
- non_disturbare_switch:
- name: Non disturbare
- icon: mdi:do-not-disturb-off
- invio_volume_riavvio:
- name: Invio volume al riavvio
- icon: mdi:leak-off
- ################################################################################
- ## Input Datetime
- ################################################
- input_datetime:
- inizio_dnd:
- name: Non disturbare inizio
- has_date: false
- has_time: true
- fine_dnd:
- name: Non disturbare fine
- has_date: false
- has_time: true
- start_mattina:
- name: Mattina
- has_date: false
- has_time: true
- start_pomeriggio:
- name: Pomeriggio
- has_date: false
- has_time: true
- start_sera:
- name: Sera
- has_date: false
- has_time: true
- start_notte:
- name: Notte
- has_date: false
- has_time: true
- ################################################################################
- ## Input Number
- ################################################
- input_number:
- volume_mattina:
- name: Vol Mattina
- icon: mdi:volume-high
- min: 0
- max: 100
- step: 10
- unit_of_measurement: "%"
- volume_pomeriggio:
- name: Vol Pomeriggio
- icon: mdi:volume-high
- min: 0
- max: 100
- step: 10
- unit_of_measurement: "%"
- volume_sera:
- name: Vol Sera
- icon: mdi:volume-high
- min: 0
- max: 100
- step: 10
- unit_of_measurement: "%"
- volume_notte:
- name: Vol Notte
- icon: mdi:volume-high
- min: 0
- max: 100
- step: 10
- unit_of_measurement: "%"
- volume_riascolto:
- name: Volune Riascolto
- icon: mdi:volume-high
- initial: 80
- min: 0
- max: 100
- step: 10
- unit_of_measurement: "%"
- salvataggio_volume:
- name: Salvataggio Volume
- icon: mdi:volume-high
- min: 0
- max: 100
- step: 10
- unit_of_measurement: "%"
- ritardo_invio_volume_riavvio:
- name: 'Ritardo invio volume'
- icon: mdi:timer-sand
- min: 1
- max: 360
- step: 1
- unit_of_measurement: 'minuti'
- # Input number di servizio usato per memorizzare il volume precedente quando viene modificato per una notifica, così da ripristinarlo al termine della notifica
- alexa_prev_volume:
- name: Volume precedente di Alexa
- min: 0
- max: 1
- initial: 0.6
- mode: slider
- step: 0.1
- interfono_volume:
- name: Volume
- icon: mdi:volume-high
- initial: 50
- min: 0
- max: 100
- step: 10
- unit_of_measurement: '%'
- ################################################################################
- ## Input Select
- ################################################
- input_select:
- interfono_mittente:
- name: Mittente
- icon: mdi:account-arrow-right
- options:
- - Francesco
- - Simona
- - Generico
- initial: Generico
- interfono_sorgente:
- name: Sorgente
- icon: mdi:speaker-wireless
- options:
- - Soggiorno
- - Cucina
- - Cameretta
- - Camera
- - Studio
- - Bagno
- - Tutti
- initial: Tutti
- ################################################################################
- ## Group
- ################################################
- group:
- dot_non_distrubare:
- name: Gruppo Alexa
- entities:
- - switch.soggiorno_do_not_disturb_switch
- - switch.camera_da_letto_do_not_disturb_switch
- - switch.echo_show_cucina_do_not_disturb_switch
- - switch.cameretta_do_not_disturb_switch
- echos:
- name: Dispositivi Alexa
- entities:
- - media_player.echo_show_cucina
- - media_player.soggiorno
- - media_player.camera_da_letto
- - media_player.studio
- - media_player.bagno
- - media_player.fire_tv_cucina
- - media_player.fire_tv_soggiorno
- ################################################################################
- ## Sensor
- ################################################
- sensor:
- - platform: template
- sensors:
- last_alexa:
- value_template: >
- {{ expand(states.group.echos) | selectattr('attributes.last_called','eq',True) | map(attribute='entity_id') | first }}
- #- platform: template # ALEXA LAST CALL
- # sensors:
- # last_alexa:
- # friendly_name: 'Last Alexa'
- # value_template: >-
- # {% if is_state_attr('media_player.echo_show_cucina','last_called', true) %}
- # echo_show_cucina
- # {% elif is_state_attr('media_player.soggiorno','last_called', true) %}
- # soggiorno
- # {% elif is_state_attr('media_player.camera_da_letto','last_called', true) %}
- # camera_da_letto
- # {% elif is_state_attr('media_player.cameretta','last_called', true) %}
- # camera_da_letto
- # {% else %}
- # none
- # {% endif %}
- - platform: template # SENSORE VOLUME
- sensors:
- volume_alexa_soggiorno:
- friendly_name: "Volume Alexa Soggiorno"
- value_template: "{{ state_attr('media_player.soggiorno', 'volume_level') |float *10 }}"
- volume_alexa_show:
- friendly_name: "Volume Alexa Show"
- value_template: "{{ state_attr('media_player.echo_show_cucina', 'volume_level') |float *10 }}"
- volume_alexa_camera_da_letto:
- friendly_name: "Volume Alexa Camera da letto"
- value_template: "{{ state_attr('media_player.camera_da_letto', 'volume_level') |float *10 }}"
- volume_alexa_cameretta:
- friendly_name: "Volume Alexa Cameretta"
- value_template: "{{ state_attr('media_player.cameretta', 'volume_level') |float *10 }}"
- volume_alexa_studio:
- friendly_name: "Volume Alexa Studio"
- value_template: "{{ state_attr('media_player.studio', 'volume_level') |float *10 }}"
- volume_alexa_bagno:
- friendly_name: "Volume Alexa Bagno"
- value_template: "{{ state_attr('media_player.bagno', 'volume_level') |float *10 }}"
- - platform: template # Periodo del giorno
- sensors:
- periodo:
- friendly_name: "Periodo del Giorno"
- value_template: >
- {% set x = states('sensor.time') %}
- {% set nt = now().time() %}
- {% set nt = (nt.hour*60+nt.minute)*60+nt.second %}
- {% if state_attr('input_datetime.start_mattina', 'timestamp') <= nt < state_attr('input_datetime.start_pomeriggio', 'timestamp') %} Mattino
- {% elif state_attr('input_datetime.start_pomeriggio', 'timestamp') <= nt < state_attr('input_datetime.start_sera', 'timestamp') %} Pomeriggio
- {% elif state_attr('input_datetime.start_sera', 'timestamp') <= nt < state_attr('input_datetime.start_notte', 'timestamp') %} Sera
- {% elif (state_attr('input_datetime.start_sera', 'timestamp') > state_attr('input_datetime.start_notte', 'timestamp'))
- and (nt > state_attr('input_datetime.start_sera', 'timestamp') or nt < state_attr('input_datetime.start_notte', 'timestamp')) %} Sera
- {% else %} Notte
- {% endif %}
- icon_template: >
- {% if is_state('sensor.periodo', 'Mattino') %} mdi:weather-sunset-up
- {% elif is_state('sensor.periodo', 'Pomeriggio') %} mdi:weather-sunny
- {% elif is_state('sensor.periodo', 'Sera') %} mdi:weather-sunset-down
- {% else %} mdi:weather-night
- {% endif %}
- volume_periodo:
- friendly_name: "Volume Attuale"
- value_template: >
- {% if is_state('sensor.periodo', 'Mattino') %} {{states('input_number.volume_mattina') | int / 100 }}
- {% elif is_state('sensor.periodo', 'Pomeriggio') %} {{states('input_number.volume_pomeriggio') | int / 100 }}
- {% elif is_state('sensor.periodo', 'Sera') %} {{states('input_number.volume_sera') | int / 100 }}
- {% else %} {{states('input_number.volume_notte') | int / 100 }}
- {% endif %}
- icon_template: >
- {% if is_state('sensor.volume_periodo', '0.0') %}mdi:volume-off
- {% elif is_state('sensor.volume_periodo', '0.1') %}mdi:volume-low
- {% elif is_state('sensor.volume_periodo', '0.2') %}mdi:volume-low
- {% elif is_state('sensor.volume_periodo', '0.3') %}mdi:volume-low
- {% elif is_state('sensor.volume_periodo', '0.4') %}mdi:volume-medium
- {% elif is_state('sensor.volume_periodo', '0.5') %}mdi:volume-medium
- {% elif is_state('sensor.volume_periodo', '0.6') %}mdi:volume-medium
- {% else %}mdi:volume-high
- {% endif %}
- volume_periodo_template:
- friendly_name: "Volume Attuale"
- value_template: >
- {% if is_state('sensor.periodo', 'Mattino') %} {{states('input_number.volume_mattina') | int }}
- {% elif is_state('sensor.periodo', 'Pomeriggio') %} {{states('input_number.volume_pomeriggio') | int }}
- {% elif is_state('sensor.periodo', 'Sera') %} {{states('input_number.volume_sera') | int }}
- {% else %} {{states('input_number.volume_notte') | int }}
- {% endif %}
- icon_template: >
- {% if is_state('sensor.volume_periodo', '0.0') %}mdi:volume-off
- {% elif is_state('sensor.volume_periodo', '0.1') %}mdi:volume-low
- {% elif is_state('sensor.volume_periodo', '0.2') %}mdi:volume-low
- {% elif is_state('sensor.volume_periodo', '0.3') %}mdi:volume-low
- {% elif is_state('sensor.volume_periodo', '0.4') %}mdi:volume-medium
- {% elif is_state('sensor.volume_periodo', '0.5') %}mdi:volume-medium
- {% elif is_state('sensor.volume_periodo', '0.6') %}mdi:volume-medium
- {% else %}mdi:volume-high
- {% endif %}
- - platform: template
- sensors:
- interfono_mittente:
- friendly_name_template: "Mittente Interfono"
- value_template: "{{ {
- 'Francesco' : 'Messaggio da Francesco',
- 'Simona' : 'Messaggio da Simona',
- 'Generico' : 'Nuovo messaggio',
- } [states('input_select.interfono_mittente')] }}"
- - platform: template
- sensors:
- interfono_sorgente:
- friendly_name_template: "Sorgente Interfono"
- value_template: "{{ {
- 'Soggiorno' : 'media_player.soggiorno',
- 'Cucina' : 'media_player.echo_show_cucina',
- 'Studio' : 'media_player.studio',
- 'Cameretta' : 'media_player.cameretta',
- 'Camera' : 'media_player.camera_da_letto',
- 'Bagno' : 'media_player.bagno',
- 'Tutti' : 'media_player.ovunque',
- } [states('input_select.interfono_sorgente')] }}"
- ################################################################################
- ## Binary Sensor
- ################################################
- binary_sensor:
- - platform: template
- sensors:
- dnd:
- friendly_name: "Non Disturbare"
- value_template: >
- {% set x1 = states('sensor.time') %}
- {% set t = now().time() %}
- {% set t = (t.hour*60+t.minute)*60+t.second %}
- {% set start = state_attr('input_datetime.inizio_dnd', 'timestamp') %}
- {% set stop = state_attr('input_datetime.fine_dnd', 'timestamp') %}
- {% if start < stop %}
- {{ start < t < stop }}
- {% else %}
- {{ t > start or t < stop }}
- {% endif %}
- icon_template: >
- {% if is_state('binary_sensor.dnd','off') %} mdi:do-not-disturb-off {% else %} mdi:do-not-disturb {% endif %}
- - platform: mqtt
- name: "ripristino volume riascolto"
- state_topic: "cn/ripristino_volume_interfono"
- payload_on: "on"
- payload_off: "off"
- qos: 0
- ################################################################################
- ## Timer
- ###################################################
- timer:
- ritardo_invio_volume_riavvio:
- name: 'Tempo Residuo invio volume'
- icon: mdi:clock-alert-outline
- ################################################################################
- ## Notify
- ###################################################
- notify:
- - name: ALL_DEVICES
- platform: group
- services:
- - service: mobile_app_iphone
- - service: mobile_app_iphone_12
- ################################################################################
- ## Script
- ################################################
- script:
- set_volume_speaker:
- sequence:
- - service: media_player.volume_set
- data_template:
- entity_id: media_player.in_casa
- volume_level: "{{ states('sensor.volume_periodo') }}"
- - delay: "00:00:05"
- - service: media_player.volume_set
- data_template:
- entity_id: media_player.in_casa
- volume_level: "{{ states('sensor.volume_periodo') }}"
- set_volume_prioritario:
- sequence:
- - service: media_player.volume_set
- data_template:
- entity_id: media_player.in_casa
- volume_level: "{{ states('input_number.volume_messaggio_prioritario') | int / 100 }}"
- set_volume_riascolto:
- sequence:
- - service: media_player.volume_set
- data_template:
- entity_id: media_player.in_casa
- volume_level: "{{ states('input_number.volume_riascolto') | int / 100 }}"
- salvataggio_volume:
- sequence:
- - service: input_number.set_value
- data_template:
- entity_id: input_number.salvataggio_volume
- value: "{{ state_attr('media_player.soggiorno','volume_level') }}"
- invio_volume_riavvio:
- alias: 'Stop temporaneo invio volume al riavvio'
- icon: mdi:check-decagram
- sequence:
- - service: timer.start
- data_template:
- entity_id: timer.ritardo_invio_volume_riavvio
- duration: '{{ states("input_number.ritardo_invio_volume_riavvio") | int * 60 }}'
- # Script di notifica centralizzato intelligente
- multinotify:
- alias: 'Notifica intelligente'
- description: 'Invia una notifica parametrica alle app/Alexa, potendo selezionare il volume e vari parametri opzionali'
- fields:
- title:
- description: 'Titolo della notifica'
- example: 'Avviso importante'
- message:
- description: 'Testo da notificare che verrà letto ed inviato come corpo della notifica'
- example: 'Un dispositivo non sta funzionando'
- alexa_message:
- description: 'Testo che Alexa dovrà pronunciare, se differente da message. Se non specificato verrà usato message.'
- example: '<say-as interpret-as="interjection">yippii</say-as>. Questo verrebbe male nelle notifiche dell''app!'
- alexa_target:
- description: 'Dispositivo o dispositivi Alexa a cui inviare la notifica'
- example: 'media_player.ovunque'
- alexa_volume_target:
- description: 'Singolo dispositivo Alexa a cui modificare il volume per la notifica'
- example: 'media_player.mansarda'
- alexa_volume:
- description: "Volume che si desidera impostare per l'annuncio su alexa_volume_target"
- example: "0.6"
- alexa_volume_restore:
- description: 'Se alexa_volume_target è impostato, se true o non specificato ripristina il volume precedente. Se false non ripristina il volume precedente'
- example: 'false'
- alexa_force:
- description: "True per forzare la notifica Alexa al di fuori dell'orario, False o non definita per riprodurre la notifica Alexa solo in orario consono"
- example: 'false'
- notify_app:
- description: "Il nome del servizio di notifica app o non compilare per non inviare notifiche all'app"
- example: 'notify.ALL_DEVICES'
- group:
- description: 'Stringa identificativa del gruppo di notifiche. Sul telefono le notifiche saranno raggruppate in base a questo valore. Se non specificato sarà usato channel o "info"'
- example: 'alarm'
- channel:
- description: 'Stringa identificativa del canale, ovvero il gruppo di notifiche con impostazioni a se stanti sul telefono. Se non specificato sarà usato group o "info"'
- example: 'Generic'
- icon:
- description: 'nome del file (senza percorso, senza notify_ e senza estensione) che deve essere usato da mostrare nella notifica. nell''esempio "warning" diventerà "/local/notify_warning.png". Se non specificato userà channel, group o "info"'
- example: 'warning'
- tag:
- description: "Campo tag della notifica ad app. Se impostato sul telefono l'eventuale notifica sarà sostituita alla seguente con tag uguale"
- example: 'fulmini'
- critical:
- description: 'impostare a "true" per inviare una notifica immediata. Se "false" o non specificata la notifica sarà riprodotta quando verrà sbloccato il telefono'
- example: 'true'
- android:
- description: "Adatta le notichie per la versione Android dell'app"
- example: 'true'
- sequence:
- # Sezione messaggio all'app
- - choose:
- - conditions:
- - condition: template
- value_template: "{{ notify_app is defined }}"
- - condition: template
- value_template: "{{critical}}"
- - condition: template
- value_template: "{{android}}"
- sequence:
- - service: '{{notify_app}}'
- data:
- title: "{{title | default('Notifica da casa')}}"
- message: "{{message}}"
- data:
- group: "{{group | default(channel) | default('info')}}"
- channel: "{{channel | default(group) | default('info')}}"
- tag: "{{tag}}"
- icon_url: "/local/notify_{{icon | default(channel) | default(group) | default('info')}}.png"
- ttl: 0
- priority: high
- - conditions:
- - condition: template
- value_template: "{{ notify_app is defined }}"
- - condition: template
- value_template: "{{critical}}"
- sequence:
- - service: '{{notify_app}}'
- data:
- title: "{{title | default('Notifica da casa')}}"
- message: "{{message}}"
- data:
- channel: "{{channel | default(group) | default('info')}}"
- group: "{{group | default(channel) | default('info')}}"
- tag: "{{tag}}"
- push:
- sound:
- name: "default"
- critical: 1
- volume: 1.0
- - conditions:
- - condition: template
- value_template: "{{ notify_app is defined }}"
- sequence:
- - service: '{{notify_app}}'
- data:
- title: "{{title | default('Notifica da casa')}}"
- message: "{{message}}"
- data:
- group: "{{group | default(channel) | default('info')}}"
- channel: "{{channel | default(group) | default('info')}}"
- tag: "{{tag}}"
- icon_url: "/local/notify_{{icon | default(channel) | default(group) | default('info')}}.png"
- # Sezione messaggio Alexa
- - choose:
- - conditions:
- - condition: or
- conditions:
- - condition: template
- value_template: "{{ alexa_force | default(false) }}"
- - condition: time
- after: input_datetime.fine_dnd
- before: input_datetime.inizio_dnd
- sequence:
- - choose:
- - conditions:
- - condition: template
- value_template: "{{ alexa_volume_target is defined}}"
- sequence:
- - service: input_number.set_value
- data:
- entity_id: input_number.alexa_prev_volume
- value: "{{state_attr(alexa_volume_target, 'volume_level')}}"
- - service: media_player.volume_set
- data:
- entity_id: "{{alexa_volume_target}}"
- volume_level: "{{alexa_volume | default('0.6') | round(2)}}"
- - choose:
- - conditions:
- - condition: template
- value_template: "{{ alexa_target is defined }}"
- sequence:
- - service: notify.alexa_media
- data:
- message: "{{alexa_message | default(alexa)}}"
- data:
- method: all
- type: announce
- target: "{{alexa_target}}"
- - choose:
- - conditions:
- - condition: template
- value_template: "{{ alexa_volume_target is defined and (alexa_volume_restore is not defined or alexa_volume_restore == true)}}"
- sequence:
- - service: media_player.volume_set
- data:
- entity_id: "{{alexa_volume_target}}"
- volume_level: "{{states('input_number.alexa_prev_volume') | round(2)}}"
- volume_alexa_interfono:
- sequence:
- - service: media_player.volume_set
- data_template:
- entity_id: '{{ alexainterfono }}'
- volume_level: '{{ volumelevel }}'
- ripristino_volume_interfono:
- sequence:
- - service: media_player.volume_set
- data_template:
- entity_id: media_player.ovunque
- volume_level: "{{ states('sensor.volume_periodo') }}"
- - delay: '00:00:05'
- - service: media_player.volume_set
- data_template:
- entity_id: media_player.ovunque
- volume_level: "{{ states('sensor.volume_periodo') }}"
- - delay: '00:00:15'
- - service: media_player.volume_set
- data_template:
- entity_id: media_player.ovunque
- volume_level: "{{ states('sensor.volume_periodo') }}"
- annuncio:
- sequence:
- - service: notify.alexa_media
- data_template:
- target:
- - "{{ states.sensor.interfono_sorgente.state }}"
- data:
- type: announce
- method: speak
- message: "{{ states('sensor.interfono_mittente') }}, {{ states('input_text.interfono_message') }}"
- ################################################################################
- ################################################################################
- ## Automations
- ################################################
- automation:
- - alias: Crea Gruppo Notifiche CNV
- id: 97c2c84236a930ec04cfb5fa9ad37f8f
- initial_state: true
- trigger:
- - platform: homeassistant
- event: start
- - platform: state
- entity_id: automation.crea_gruppo_notifiche_cnv
- to: "on"
- action:
- # - delay: "00:00:35"
- - service: group.set
- data_template:
- object_id: "gruppo_cnv"
- name: "Notifiche Vocali"
- icon: mdi:group
- # visible: true
- entities: >
- {%- for item in states.automation if ((item.attributes.id | lower).endswith('cnv')) -%}
- {{ item.entity_id }}{% if not loop.last %}, {% endif %}
- {%- endfor -%}
- - alias: Crea Gruppo Notifiche CNT
- id: 3fe38a1606f0009e6f4a9c8a4fee9036
- initial_state: true
- trigger:
- - platform: homeassistant
- event: start
- - platform: state
- entity_id: automation.crea_gruppo_notifiche_cnt
- to: "on"
- action:
- # - delay: "00:00:30"
- - service: group.set
- data_template:
- object_id: "gruppo_cnt"
- name: "Notifiche di testo"
- icon: mdi:group
- # visible: true
- entities: >
- {%- for item in states.automation if ((item.attributes.id | lower).endswith('cnt')) -%}
- {{ item.entity_id }}{% if not loop.last %}, {% endif %}
- {%- endfor -%}
- - alias: Ripeti Ultimo Messaggio
- id: e2b6ecb56610d204aca0aa6a9fd32e3a
- mode: single
- trigger:
- - platform: state
- entity_id: input_boolean.ultimo_messaggio
- to: "on"
- action:
- - service: input_boolean.turn_on
- data:
- entity_id: input_boolean.messaggio_prioritario
- - service: script.salvataggio_volume
- - service: script.set_volume_riascolto
- - service: notify.alexa_media
- data_template:
- target: >-
- {% if is_state('sensor.last_alexa', 'none') %}
- media_player.in_casa
- {% else %}
- media_player.{{ states.sensor.last_alexa.state }}
- {% endif %}
- data:
- type: announce
- method: speak
- message: "{{ states('sensor.ultimo_messaggio') }}"
- - service: input_boolean.turn_off
- data:
- entity_id: input_boolean.ultimo_messaggio
- - delay: "00:00:05"
- - service: input_boolean.turn_off
- data:
- entity_id: input_boolean.messaggio_prioritario
- - delay: "00:00:05"
- - service: script.set_volume_speaker
- - alias: Settaggio Volume
- id: ef51cea18df6676ca22ad2fc0b46f6f3
- initial_state: true
- trigger:
- - platform: time # MATTINA
- at: input_datetime.start_mattina
- - platform: time # POMERIGGIO
- at: input_datetime.start_pomeriggio
- - platform: time # SERA
- at: input_datetime.start_sera
- - platform: time # NOTTE
- at: input_datetime.start_notte
- action:
- - service: script.set_volume_speaker
- - alias: Non Disturbare start
- id: 0efb52d4034dc699965c45e5b2ece1b7
- initial_state: true
- trigger:
- - platform: template
- value_template: "{{ states('sensor.time') == (states.input_datetime.inizio_dnd.attributes.timestamp | int | timestamp_custom('%H:%M', False)) }}"
- condition:
- - condition: state
- entity_id: input_boolean.non_disturbare
- state: "on"
- action:
- - service: switch.turn_on
- data:
- entity_id: switch.ovunque_do_not_disturb_switch
- - alias: Non Disturbare fine
- id: 39de2fcf97af70bfad380bfad35dc584
- initial_state: true
- trigger:
- - platform: template
- value_template: "{{ states('sensor.time') == (states.input_datetime.fine_dnd.attributes.timestamp | int | timestamp_custom('%H:%M', False)) }}"
- condition:
- - condition: state
- entity_id: input_boolean.non_disturbare
- state: "on"
- action:
- - service: switch.turn_off
- data:
- entity_id: switch.ovunque_do_not_disturb_switch
- - alias: DND ON
- id: 83b5b9909be71842c973592d3668eb1b
- initial_state: true
- trigger:
- - platform: state
- entity_id: switch.ovunque_do_not_disturb_switch
- to: "on"
- action:
- - service: media_player.volume_mute
- data:
- entity_id: media_player.ovunque
- is_volume_muted: true
- - alias: DND Off
- id: 34a2a807638f7edfbaa7b5c42df46255
- initial_state: true
- trigger:
- - platform: state
- entity_id: switch.ovunque_do_not_disturb_switch
- to: "off"
- action:
- - service: media_player.volume_mute
- data:
- entity_id: media_player.ovunque
- is_volume_muted: false
- - id: messaggio_prioritario_cnv
- alias: Messaggio Prioritario
- trigger:
- - platform: state
- entity_id: input_boolean.messaggio_prioritario
- to: "on"
- condition:
- - condition: state
- entity_id: switch.ovunque_do_not_disturb_switch
- state: "on"
- action:
- - service: switch.turn_off
- data:
- entity_id: switch.ovunque_do_not_disturb_switch
- - id: messaggio_prioritario_off
- alias: Messaggio Prioritario off
- trigger:
- - platform: state
- entity_id: input_boolean.messaggio_prioritario
- to: "off"
- condition:
- - condition: state
- entity_id: binary_sensor.dnd
- state: "on"
- action:
- - service: switch.turn_on
- data:
- entity_id: switch.ovunque_do_not_disturb_switch
- - alias: 'Attivazione / Disattivazione ritardo'
- id: 567332b3c1d55400c7337df898934574
- initial_state: true
- mode: single
- max_exceeded: silent
- trigger:
- - platform: state
- entity_id: input_boolean.invio_volume_riavvio
- to: 'off'
- action:
- - service: timer.cancel
- entity_id: timer.ritardo_invio_volume_riavvio
- - alias: 'Ripristino invio volume - cancella timer'
- id: 857afbeb5ee38aed318af5237172ce04
- initial_state: true
- mode: single
- max_exceeded: silent
- trigger:
- - platform: state
- entity_id: input_boolean.invio_volume_riavvio
- to: 'off'
- action:
- - service: timer.cancel
- entity_id: timer.ritardo_invio_volume_riavvio
- - alias: 'Ripristino invio volume - ricarica timer'
- id: a3616a76f464446921188ab26243e971
- initial_state: true
- mode: single
- max_exceeded: silent
- trigger:
- - platform: state
- entity_id: input_number.ritardo_invio_volume_riavvio
- condition:
- - condition: state
- entity_id: input_boolean.invio_volume_riavvio
- state: 'on'
- action:
- - service: timer.cancel
- entity_id: timer.ritardo_invio_volume_riavvio
- - service: script.invio_volume_riavvio
- - alias: 'Start timer Invio volume al riavvio'
- id: cb1a6d4c816560b17e8b9db35b348264
- initial_state: true
- trigger:
- - platform: homeassistant
- event: start
- condition:
- - condition: state
- entity_id: input_boolean.invio_volume_riavvio
- state: 'on'
- action:
- - service: script.invio_volume_riavvio
- - alias: 'Invio volume - Fine timer'
- id: d7992818ba660ff9ad50c372488456d1
- initial_state: true
- mode: single
- max_exceeded: silent
- trigger:
- - platform: event
- event_type: timer.finished
- event_data:
- entity_id: timer.ritardo_invio_volume_riavvio
- action:
- - service: script.set_volume_speaker
- - alias: "Regolazione volume"
- id: 59c5bae742bb759fbb985797c9be169c
- trigger:
- - platform: state
- entity_id: input_text.interfono_message
- condition:
- condition: template
- value_template: >
- {{ states('input_text.interfono_message') | length > 0 }}
- action:
- - service: script.turn_on
- entity_id: script.volume_alexa_interfono
- data_template:
- variables:
- alexainterfono: "{{ states('sensor.interfono_sorgente') }}"
- volumelevel: "{{ states('input_number.interfono_volume') | int / 100 }}"
- - delay: '00:00:02'
- - service: script.turn_on
- entity_id: script.annuncio
- # - service: notify.alexa_media
- # data_template:
- # target:
- # - '{{ states.sensor.interfono_sorgente.state }}'
- # data:
- # type: announce
- # method: speak
- # message: "{{ states('sensor.interfono_mittente') }}, {{ states('input_text.interfono_message') }}"
- - service: input_text.set_value
- data_template:
- entity_id: input_text.cn_ultimo_messaggio
- value: "{{ states('sensor.interfono_mittente') }}, {{ states('input_text.interfono_message') }}"
- - service: input_text.set_value
- data:
- entity_id: input_text.interfono_message
- value: ''
- - service: mqtt.publish
- data_template:
- payload: "on"
- topic: cn/ripristino_volume_interfono
- retain: false
- qos: 1
- - alias: Ripristino Volume interfono
- id: b24fb02f2548cdf4d364d45565c17c46
- trigger:
- platform: state
- entity_id: binary_sensor.ripristino_volume_riascolto
- to: 'on'
- action:
- - delay: '00:00:08'
- - service: script.set_volume_speaker
- - service: mqtt.publish
- data_template:
- payload: "off"
- topic: cn/ripristino_volume_interfono
- retain: false
- qos: 1
- ###################################################################
- - type: vertical-stack
- cards:
- - type: entities
- title: Centro Notifiche
- show_header_toggle: false
- entities:
- - type: section
- label: Monitor
- - entity: sensor.time
- name: Ora attuale
- - type: custom:fold-entity-row
- head: sensor.periodo
- items:
- - input_datetime.start_mattina
- - input_datetime.start_pomeriggio
- - input_datetime.start_sera
- - input_datetime.start_notte
- - type: custom:fold-entity-row
- head: sensor.volume_periodo_template
- items:
- - input_number.volume_mattina
- - input_number.volume_pomeriggio
- - input_number.volume_sera
- - input_number.volume_notte
- - type: call-service
- icon: mdi:repeat
- name: Ultimo Messaggio
- action_name: Riascolta
- service: input_boolean.turn_on
- service_data:
- entity_id: input_boolean.ultimo_messaggio
- - entity: input_number.volume_riascolto
- - type: section
- label: Modalità
- - entity: input_boolean.non_disturbare_switch
- name: Non disturbare
- icon_state: true
- - entity: input_boolean.modo_ospite
- state_color: true
- - type: section
- label: " "
- - entity: input_boolean.messaggio_prioritario
- state_color: true
- - type: section
- label: " "
- - type: custom:fold-entity-row
- head: group.gruppo_cnv
- name: Notifiche Vocali
- group_config:
- secondary_info: last-changed
- - type: custom:fold-entity-row
- head: group.gruppo_cnt
- name: Notifiche di testo
- group_config:
- icon: mdi:home-automation
- ################################# PARTE RADIO PRESA DA HASSIOHELP
- - type: vertical-stack
- cards:
- - type: picture-entity
- entity: camera.logo_stazionealexa
- camera_image: camera.logo_stazione
- show_name: false
- show_state: false
- - entities:
- - entity: input_select.stazioni_radioalexa
- - entity: input_select.alexa_speaker
- - entity: input_boolean.web_radioalexa
- name: Radio
- icon: 'mdi:power'
- state_color: true
- - entity: input_number.volume_radioalexa
- state_color: true
- - entity: script.alexa_meteo
- icon: 'mdi:white-balance-sunny'
- name: Info Meteo
- state_color: true
- - entity: script.alexa_ultime_notizie
- name: Info Notizie
- icon: 'mdi:newspaper'
- state_color: true
- - entity: script.alexa_traffico
- name: Info Traffico Lavoro
- icon: 'mdi:traffic-light'
- state_color: true
- - entity: input_boolean.impostazioni_radio_alexa
- name: Impostazioni
- state_color: true
- type: entities
- show_header_toggle: false
- - type: conditional
- conditions:
- - entity: input_boolean.impostazioni_radio_alexa
- state: 'on'
- - entity: input_boolean.impostazioni_radio_alexa
- state_not: 'off'
- card:
- type: entities
- entities:
- - entity: automation.notifica_aggiornamento_disponibile_alexa_web_radio
- name: Notifica Push Update
- icon: 'mdi:bell-ring'
- state_color: true
- - entity: sensor.sensore_versionealexa
- name: Versione Installata
- icon: 'mdi:google-circles-extended'
- - entity: sensor.ultima_versione_alexa_webradio
- name: Ultima Versione Disponibile
- icon: 'mdi:update'
- title: 'Update:'
- - type: conditional
- conditions:
- - entity: input_boolean.impostazioni_radio_alexa
- state: 'on'
- - entity: input_boolean.impostazioni_radio_alexa
- state_not: 'off'
- card:
- type: entities
- entities:
- - entity: automation.radio_off_volume_alexa
- name: Volume Alexa - Radio OFF
- icon: 'mdi:restart'
- state_color: true
- - entity: input_number.volume_radiooffalexa
- name: Volume Alexa
- title: 'Volume Off:'
- - type: conditional
- conditions:
- - entity: input_boolean.impostazioni_radio_alexa
- state: 'on'
- - entity: input_boolean.impostazioni_radio_alexa
- state_not: 'off'
- card:
- type: markdown
- content: >-
- Alexa Web Radio
- -------------------
- ____
- Scarica Update:
- [Download](https://domhouse.it/alexa-webradio-su-home-assistant/)
- ___
- ##########################################################################################################################################
- ####################################################### C A R D ##################################################################
- ##########################################################################################################################################
- - type: custom:stack-in-card
- mode: vertical
- cards:
- - type: custom:button-card # Set Volume Alexa
- name: Volume
- entity: script.set_volume_speaker
- show_icon: false
- tap_action:
- action: call-service
- service: script.turn_on
- service_data:
- entity_id: script.set_volume_speaker
- styles:
- card:
- - background: none
- - type: horizontal-stack
- cards:
- - type: custom:button-card # Soggiorno
- icon: mdi:amazon-alexa
- entity: media_player.soggiorno
- aspect_ratio: 3/1
- name: Vol. Soggiorno
- styles:
- card:
- - background: none
- grid:
- - position: relative
- custom_fields:
- notification:
- - background-color: >
- [[[
- if (states['sensor.volume_alexa_soggiorno'].state == 0)
- return "green";
- return "red";
- ]]]
- - border-radius: 50%
- - position: absolute
- - left: 60%
- - top: 10%
- - height: 20px
- - width: 20px
- - font-size: 15px
- - line-height: 20px
- custom_fields:
- notification: >
- [[[ return Math.floor(states['sensor.volume_alexa_soggiorno'].state ) ]]]
- - type: custom:button-card # Cucina
- icon: mdi:amazon-alexa
- entity: media_player.echo_show_cucina
- aspect_ratio: 3/1
- name: Vol. Cucina
- styles:
- card:
- - background: none
- grid:
- - position: relative
- custom_fields:
- notification:
- - background-color: >
- [[[
- if (states['sensor.volume_alexa_show'].state == 0)
- return "green";
- return "red";
- ]]]
- - border-radius: 50%
- - position: absolute
- - left: 60%
- - top: 10%
- - height: 20px
- - width: 20px
- - font-size: 15px
- - line-height: 20px
- custom_fields:
- notification: >
- [[[ return Math.floor(states['sensor.volume_alexa_show'].state ) ]]]
- - type: horizontal-stack
- cards:
- - type: custom:button-card # Camera da letto
- icon: mdi:amazon-alexa
- aspect_ratio: 3/1
- name: Vol. Camera Letto
- styles:
- card:
- - background: none
- grid:
- - position: relative
- custom_fields:
- notification:
- - background-color: >
- [[[
- if (states['sensor.volume_alexa_camera_da_letto'].state == 0)
- return "green";
- return "red";
- ]]]
- - border-radius: 50%
- - position: absolute
- - left: 60%
- - top: 10%
- - height: 20px
- - width: 20px
- - font-size: 15px
- - line-height: 20px
- custom_fields:
- notification: >
- [[[ return Math.floor(states['sensor.volume_alexa_camera_da_letto'].state ) ]]]
- - type: custom:button-card # Cameretta
- icon: mdi:amazon-alexa
- entity: media_player.cameretta
- aspect_ratio: 3/1
- name: Vol. Cameretta
- styles:
- card:
- - background: none
- grid:
- - position: relative
- custom_fields:
- notification:
- - background-color: >
- [[[
- if (states['sensor.volume_alexa_cameretta'].state == 0)
- return "green";
- return "red";
- ]]]
- - border-radius: 50%
- - position: absolute
- - left: 60%
- - top: 10%
- - height: 20px
- - width: 20px
- - font-size: 15px
- - line-height: 20px
- custom_fields:
- notification: >
- [[[ return Math.floor(states['sensor.volume_alexa_cameretta'].state ) ]]]
- - type: horizontal-stack
- cards:
- - type: custom:button-card # Bagno
- entity: media_player.bagno
- icon: mdi:amazon-alexa
- aspect_ratio: 3/1
- name: Vol. Bagno
- styles:
- card:
- - background: none
- grid:
- - position: relative
- custom_fields:
- notification:
- - background-color: >
- [[[
- if (states['sensor.volume_alexa_bagno'].state == 0)
- return "green";
- return "red";
- ]]]
- - border-radius: 50%
- - position: absolute
- - left: 60%
- - top: 10%
- - height: 20px
- - width: 20px
- - font-size: 15px
- - line-height: 20px
- custom_fields:
- notification: >
- [[[ return Math.floor(states['sensor.volume_alexa_bagno'].state ) ]]]
- - type: custom:button-card # Studio
- icon: mdi:amazon-alexa
- entity: media_player.studio
- aspect_ratio: 3/1
- name: Vol. Studio
- styles:
- card:
- - background: none
- grid:
- - position: relative
- custom_fields:
- notification:
- - background-color: >
- [[[
- if (states['sensor.volume_alexa_studio'].state == 0)
- return "green";
- return "red";
- ]]]
- - border-radius: 50%
- - position: absolute
- - left: 60%
- - top: 10%
- - height: 20px
- - width: 20px
- - font-size: 15px
- - line-height: 20px
- custom_fields:
- notification: >
- [[[ return Math.floor(states['sensor.volume_alexa_studio'].state ) ]]]
- # - type: custom:button-card
- # name: ""
- # styles:
- # card:
- # - background: none
- - type: entities
- show_header_toggle: false
- entities:
- - entity: input_boolean.invio_volume_riavvio
- - entity: input_number.ritardo_invio_volume_riavvio
- - entity: timer.ritardo_invio_volume_riavvio
- - type: vertical-stack
- cards:
- - type: entities
- show_header_toggle: false
- entities:
- - type: section
- label: Interfono
- - entity: input_select.interfono_mittente
- - entity: input_text.interfono_message
- - entity: input_number.interfono_volume
- - entity: input_select.interfono_sorgente
- style: |
- ha-card {background-color: transparent;}
- - type: vertical-stack
- cards:
- - type: entities
- title: Impostazioni Assistente
- show_header_toggle: false
- entities:
- - type: section
- label: Impostazione orario modo silenzioso
- - entity: input_boolean.non_disturbare
- name: Non disturbare Automatico
- - entity: input_datetime.inizio_dnd
- - entity: input_datetime.fine_dnd
- style: |
- ha-card {background-color: transparent;}
Add Comment
Please, Sign In to add comment