calas

centro_multimedia.yaml

Sep 23rd, 2021 (edited)
436
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 50.19 KB | None | 0 0
  1. ##########################################################################################################################################
  2. #######################################################   P A C K A G E  #################################################################
  3. #########################################################################################################################################
  4.  
  5. homeassistant:
  6.   customize:
  7.     package.node_anchors:
  8.       customize: &customize
  9.         package: "cn_centro_messaggi"
  10.         version: "v1.1"
  11.         author: "Calas"
  12.  
  13.       expose: &expose
  14.         <<: *customize
  15.         haaska_hidden: false
  16.         homebridge_hidden: false
  17.  
  18.     ################################################
  19.     ## Input Text Customize
  20.     ################################################
  21.     input_text.cn_ultimo_messaggio:
  22.       <<: *customize
  23.  
  24.     ################################################
  25.     ## Input Boolean Customize
  26.     ################################################
  27.     input_boolean.ultimo_messaggio:
  28.       <<: *customize
  29.     input_boolean.messaggio_prioritario:
  30.       <<: *customize
  31.     input_boolean.modo_ospite:
  32.       <<: *customize
  33.     input_boolean.non_disturbare:
  34.       <<: *customize
  35.     input_boolean.invio_volume_riavvio:
  36.       <<: *customize
  37.  
  38.     ################################################
  39.     ## Input Datetime Customize
  40.     ################################################
  41.     input_datetime.inizio_dnd:
  42.       <<: *customize
  43.     input_datetime.fine_dnd:
  44.       <<: *customize
  45.     input_datetime.start_mattina:
  46.       <<: *customize
  47.     input_datetime.start_pomeriggio:
  48.       <<: *customize
  49.     input_datetime.start_sera:
  50.       <<: *customize
  51.     input_datetime.start_notte:
  52.       <<: *customize
  53.  
  54.     ################################################
  55.     ## Input Number Customize
  56.     ################################################
  57.     input_number.volume_mattina:
  58.       <<: *customize
  59.     input_number.volume_pomeriggio:
  60.       <<: *customize
  61.     input_number.volume_sera:
  62.       <<: *customize
  63.     input_number.volume_notte:
  64.       <<: *customize
  65.     input_number.volume_riascolto:
  66.       <<: *customize
  67.     input_number.salvataggio_volume:
  68.       <<: *customize
  69.     input_number.ritardo_invio_volume_riavvio:
  70.       <<: *customize
  71.     ################################################
  72.     ## Sensor Customize
  73.     ################################################
  74.     sensor.periodo:
  75.       <<: *customize
  76.     sensor.volume_periodo:
  77.       <<: *customize
  78.     sensor.volume_periodo_template:
  79.       <<: *customize
  80.  
  81.     ################################################
  82.     ## Binary Sensor Customize
  83.     ################################################
  84.     binary_sensor.dnd:
  85.       <<: *customize
  86.  
  87.     ################################################
  88.     ## Script Customize
  89.     ################################################
  90.     script.set_volume_speaker:
  91.       <<: *customize
  92.     script.set_volume_prioritario:
  93.       <<: *customize
  94.     script.set_volume_riascolto:
  95.       <<: *customize
  96.     script.salvataggio_volume:
  97.       <<: *customize
  98.  
  99.     ################################################
  100.     ## Automations Customize
  101.     ################################################
  102.     automation.crea_gruppo_notifiche_cnv:
  103.       <<: *customize
  104.     automation.crea_gruppo_notifiche_cnt:
  105.       <<: *customize
  106.     automation.ripeti_ultimo_messaggio:
  107.       <<: *customize
  108.     automation.settaggio_volume:
  109.       <<: *customize
  110.     automation.non_disturbare_start:
  111.       <<: *customize
  112.     automation.non_disturbare_fine:
  113.       <<: *customize
  114.     automation.dnd_on:
  115.       <<: *customize
  116.     automation.dnd_off:
  117.       <<: *customize
  118.     automation.messaggio_prioritario:
  119.       <<: *customize
  120.     automation.messaggio_prioritario_off:
  121.       <<: *customize
  122.  
  123.     input_text.interfono_message:
  124.       <<: *customize
  125.     input_select.interfono_mittente:
  126.       <<: *customize
  127.     input_number.interfono_volume:
  128.       <<: *customize
  129.     input_boolean.interfono_ripristino_volume:
  130.       <<: *customize
  131. #******************************************************************************#
  132. #                                   C O R P O                                  #
  133. #******************************************************************************#
  134.  
  135. ################################################################################
  136. #################################################### INPUT #####################
  137. ################################################################################
  138.  
  139. ################################################################################
  140. ## Input Text
  141. ################################################
  142. input_text:
  143.   cn_ultimo_messaggio:
  144.     initial: ""
  145.     name: Ultimo Messaggio
  146.     max: 255
  147.  
  148.   interfono_message:
  149.     name: Messaggio
  150.     max: 255
  151.     initial: ''
  152. ################################################################################
  153. ## Input Boolean
  154. ################################################
  155. input_boolean:
  156.   ultimo_messaggio:
  157.     name: Ultimo Messaggio
  158.     icon: mdi:repeat-once
  159.  
  160.   messaggio_prioritario:
  161.     name: Messaggio Prioritario
  162.     icon: mdi:message-alert
  163.  
  164.   modo_ospite:
  165.     name: Modalità Ospite
  166.     icon: mdi:account-check
  167.  
  168.   non_disturbare:
  169.     name: Non disturbare automatico
  170.     icon: mdi:volume-off
  171.  
  172.   non_disturbare_switch:
  173.     name: Non disturbare
  174.     icon: mdi:do-not-disturb-off
  175.  
  176.   invio_volume_riavvio:
  177.     name: Invio volume al riavvio
  178.     icon: mdi:leak-off
  179. ################################################################################
  180. ## Input Datetime
  181. ################################################
  182. input_datetime:
  183.   inizio_dnd:
  184.     name: Non disturbare inizio
  185.     has_date: false
  186.     has_time: true
  187.  
  188.   fine_dnd:
  189.     name: Non disturbare fine
  190.     has_date: false
  191.     has_time: true
  192.  
  193.   start_mattina:
  194.     name: Mattina
  195.     has_date: false
  196.     has_time: true
  197.  
  198.   start_pomeriggio:
  199.     name: Pomeriggio
  200.     has_date: false
  201.     has_time: true
  202.  
  203.   start_sera:
  204.     name: Sera
  205.     has_date: false
  206.     has_time: true
  207.  
  208.   start_notte:
  209.     name: Notte
  210.     has_date: false
  211.     has_time: true
  212.  
  213. ################################################################################
  214. ## Input Number
  215. ################################################
  216. input_number:
  217.   volume_mattina:
  218.     name: Vol Mattina
  219.     icon: mdi:volume-high
  220.     min: 0
  221.     max: 100
  222.     step: 10
  223.     unit_of_measurement: "%"
  224.  
  225.   volume_pomeriggio:
  226.     name: Vol Pomeriggio
  227.     icon: mdi:volume-high
  228.     min: 0
  229.     max: 100
  230.     step: 10
  231.     unit_of_measurement: "%"
  232.  
  233.   volume_sera:
  234.     name: Vol Sera
  235.     icon: mdi:volume-high
  236.     min: 0
  237.     max: 100
  238.     step: 10
  239.     unit_of_measurement: "%"
  240.  
  241.   volume_notte:
  242.     name: Vol Notte
  243.     icon: mdi:volume-high
  244.     min: 0
  245.     max: 100
  246.     step: 10
  247.     unit_of_measurement: "%"
  248.  
  249.   volume_riascolto:
  250.     name: Volune Riascolto
  251.     icon: mdi:volume-high
  252.     initial: 80
  253.     min: 0
  254.     max: 100
  255.     step: 10
  256.     unit_of_measurement: "%"
  257.  
  258.   salvataggio_volume:
  259.     name: Salvataggio Volume
  260.     icon: mdi:volume-high
  261.     min: 0
  262.     max: 100
  263.     step: 10
  264.     unit_of_measurement: "%"
  265.  
  266.   ritardo_invio_volume_riavvio:
  267.     name: 'Ritardo invio volume'
  268.     icon: mdi:timer-sand
  269.     min: 1
  270.     max: 360
  271.     step: 1
  272.     unit_of_measurement: 'minuti'
  273.  
  274.   # Input number di servizio usato per memorizzare il volume precedente quando viene modificato per una notifica, così da ripristinarlo al termine della notifica
  275.   alexa_prev_volume:
  276.     name: Volume precedente di Alexa
  277.     min: 0
  278.     max: 1
  279.     initial: 0.6
  280.     mode: slider
  281.     step: 0.1
  282.  
  283.   interfono_volume:
  284.     name: Volume
  285.     icon: mdi:volume-high
  286.     initial: 50
  287.     min: 0
  288.     max: 100
  289.     step: 10
  290.     unit_of_measurement: '%'
  291. ################################################################################
  292. ## Input Select
  293. ################################################
  294. input_select:
  295.   interfono_mittente:
  296.     name: Mittente
  297.     icon: mdi:account-arrow-right
  298.     options:
  299.      - Francesco
  300.       - Simona
  301.       - Generico
  302.     initial: Generico
  303.  
  304.   interfono_sorgente:
  305.     name: Sorgente
  306.     icon: mdi:speaker-wireless
  307.     options:
  308.      - Soggiorno
  309.       - Cucina
  310.       - Cameretta
  311.       - Camera
  312.       - Studio
  313.       - Bagno
  314.       - Tutti
  315.     initial: Tutti
  316.  
  317. ################################################################################
  318. ## Group
  319. ################################################
  320. group:
  321.   dot_non_distrubare:
  322.     name: Gruppo Alexa
  323.     entities:
  324.      - switch.soggiorno_do_not_disturb_switch
  325.       - switch.camera_da_letto_do_not_disturb_switch
  326.       - switch.echo_show_cucina_do_not_disturb_switch
  327.       - switch.cameretta_do_not_disturb_switch
  328.  
  329.   echos:
  330.     name: Dispositivi Alexa
  331.     entities:
  332.      - media_player.echo_show_cucina
  333.       - media_player.soggiorno
  334.       - media_player.camera_da_letto
  335.       - media_player.studio
  336.       - media_player.bagno
  337.       - media_player.fire_tv_cucina
  338.       - media_player.fire_tv_soggiorno
  339.  
  340. ################################################################################
  341. ## Sensor
  342. ################################################
  343. sensor:
  344.   - platform: template
  345.     sensors:
  346.       last_alexa:
  347.         value_template: >
  348.          {{ expand(states.group.echos) | selectattr('attributes.last_called','eq',True) | map(attribute='entity_id') | first }}
  349.  
  350.  
  351.   #- platform: template # ALEXA LAST CALL
  352.   #  sensors:
  353.   #    last_alexa:
  354.   #      friendly_name: 'Last Alexa'
  355.   #      value_template: >-
  356.   #        {% if is_state_attr('media_player.echo_show_cucina','last_called', true) %}
  357.   #          echo_show_cucina
  358.   #        {% elif is_state_attr('media_player.soggiorno','last_called', true) %}
  359.   #          soggiorno
  360.   #        {% elif is_state_attr('media_player.camera_da_letto','last_called', true) %}
  361.   #          camera_da_letto
  362.   #        {% elif is_state_attr('media_player.cameretta','last_called', true) %}
  363.   #          camera_da_letto
  364.   #        {% else %}
  365.   #          none
  366.   #        {% endif %}
  367.  
  368.   - platform: template # SENSORE VOLUME
  369.     sensors:
  370.       volume_alexa_soggiorno:
  371.         friendly_name: "Volume Alexa Soggiorno"
  372.         value_template: "{{ state_attr('media_player.soggiorno', 'volume_level') |float *10  }}"
  373.  
  374.       volume_alexa_show:
  375.         friendly_name: "Volume Alexa Show"
  376.         value_template: "{{ state_attr('media_player.echo_show_cucina', 'volume_level') |float *10  }}"
  377.  
  378.       volume_alexa_camera_da_letto:
  379.         friendly_name: "Volume Alexa Camera da letto"
  380.         value_template: "{{ state_attr('media_player.camera_da_letto', 'volume_level') |float *10  }}"
  381.  
  382.       volume_alexa_cameretta:
  383.         friendly_name: "Volume Alexa Cameretta"
  384.         value_template: "{{ state_attr('media_player.cameretta', 'volume_level') |float *10  }}"
  385.  
  386.       volume_alexa_studio:
  387.         friendly_name: "Volume Alexa Studio"
  388.         value_template: "{{ state_attr('media_player.studio', 'volume_level') |float *10  }}"
  389.  
  390.       volume_alexa_bagno:
  391.         friendly_name: "Volume Alexa Bagno"
  392.         value_template: "{{ state_attr('media_player.bagno', 'volume_level') |float *10  }}"
  393.  
  394.   - platform: template # Periodo del giorno
  395.     sensors:
  396.       periodo:
  397.         friendly_name: "Periodo del Giorno"
  398.         value_template: >
  399.          {% set x = states('sensor.time') %}
  400.           {% set nt = now().time() %}
  401.           {% set nt = (nt.hour*60+nt.minute)*60+nt.second %}
  402.           {% if state_attr('input_datetime.start_mattina', 'timestamp') <= nt < state_attr('input_datetime.start_pomeriggio', 'timestamp') %} Mattino
  403.           {% elif state_attr('input_datetime.start_pomeriggio', 'timestamp') <= nt < state_attr('input_datetime.start_sera', 'timestamp') %} Pomeriggio
  404.           {% elif state_attr('input_datetime.start_sera', 'timestamp') <= nt < state_attr('input_datetime.start_notte', 'timestamp') %} Sera
  405.           {% elif (state_attr('input_datetime.start_sera', 'timestamp') > state_attr('input_datetime.start_notte', 'timestamp'))
  406.           and (nt > state_attr('input_datetime.start_sera', 'timestamp') or nt < state_attr('input_datetime.start_notte', 'timestamp')) %} Sera
  407.           {% else %} Notte
  408.           {% endif %}
  409.         icon_template: >
  410.          {% if is_state('sensor.periodo', 'Mattino') %} mdi:weather-sunset-up
  411.           {% elif is_state('sensor.periodo', 'Pomeriggio') %} mdi:weather-sunny
  412.           {% elif is_state('sensor.periodo', 'Sera') %} mdi:weather-sunset-down
  413.           {% else %} mdi:weather-night
  414.           {% endif %}
  415.  
  416.       volume_periodo:
  417.         friendly_name: "Volume Attuale"
  418.         value_template: >
  419.          {% if is_state('sensor.periodo', 'Mattino') %} {{states('input_number.volume_mattina') | int / 100 }}
  420.           {% elif is_state('sensor.periodo', 'Pomeriggio') %} {{states('input_number.volume_pomeriggio') | int / 100 }}
  421.           {% elif is_state('sensor.periodo', 'Sera') %} {{states('input_number.volume_sera') | int / 100 }}
  422.           {% else %} {{states('input_number.volume_notte') | int / 100 }}
  423.           {% endif %}
  424.         icon_template: >
  425.          {% if is_state('sensor.volume_periodo', '0.0') %}mdi:volume-off
  426.           {% elif is_state('sensor.volume_periodo', '0.1') %}mdi:volume-low
  427.           {% elif is_state('sensor.volume_periodo', '0.2') %}mdi:volume-low
  428.           {% elif is_state('sensor.volume_periodo', '0.3') %}mdi:volume-low
  429.           {% elif is_state('sensor.volume_periodo', '0.4') %}mdi:volume-medium
  430.           {% elif is_state('sensor.volume_periodo', '0.5') %}mdi:volume-medium
  431.           {% elif is_state('sensor.volume_periodo', '0.6') %}mdi:volume-medium
  432.           {% else %}mdi:volume-high
  433.           {% endif %}
  434.  
  435.       volume_periodo_template:
  436.         friendly_name: "Volume Attuale"
  437.         value_template: >
  438.          {% if is_state('sensor.periodo', 'Mattino') %} {{states('input_number.volume_mattina') | int }}
  439.           {% elif is_state('sensor.periodo', 'Pomeriggio') %} {{states('input_number.volume_pomeriggio')  | int }}
  440.           {% elif is_state('sensor.periodo', 'Sera') %} {{states('input_number.volume_sera')  | int }}
  441.           {% else %} {{states('input_number.volume_notte')  | int }}
  442.           {% endif %}
  443.         icon_template: >
  444.          {% if is_state('sensor.volume_periodo', '0.0') %}mdi:volume-off
  445.           {% elif is_state('sensor.volume_periodo', '0.1') %}mdi:volume-low
  446.           {% elif is_state('sensor.volume_periodo', '0.2') %}mdi:volume-low
  447.           {% elif is_state('sensor.volume_periodo', '0.3') %}mdi:volume-low
  448.           {% elif is_state('sensor.volume_periodo', '0.4') %}mdi:volume-medium
  449.           {% elif is_state('sensor.volume_periodo', '0.5') %}mdi:volume-medium
  450.           {% elif is_state('sensor.volume_periodo', '0.6') %}mdi:volume-medium
  451.           {% else %}mdi:volume-high
  452.           {% endif %}
  453.  
  454.   - platform: template
  455.     sensors:
  456.       interfono_mittente:
  457.         friendly_name_template: "Mittente Interfono"
  458.         value_template: "{{ {
  459.            'Francesco' : 'Messaggio da Francesco',
  460.            'Simona' : 'Messaggio da Simona',
  461.            'Generico' : 'Nuovo messaggio',
  462.            } [states('input_select.interfono_mittente')] }}"
  463.  
  464.   - platform: template
  465.     sensors:
  466.       interfono_sorgente:
  467.         friendly_name_template: "Sorgente Interfono"
  468.         value_template: "{{ {
  469.            'Soggiorno' : 'media_player.soggiorno',
  470.            'Cucina' : 'media_player.echo_show_cucina',
  471.            'Studio' : 'media_player.studio',
  472.            'Cameretta' : 'media_player.cameretta',
  473.            'Camera' : 'media_player.camera_da_letto',
  474.            'Bagno' : 'media_player.bagno',
  475.            'Tutti' : 'media_player.ovunque',
  476.            } [states('input_select.interfono_sorgente')] }}"
  477.  
  478. ################################################################################
  479. ## Binary Sensor
  480. ################################################
  481. binary_sensor:
  482.   - platform: template
  483.     sensors:
  484.       dnd:
  485.         friendly_name: "Non Disturbare"
  486.         value_template: >
  487.          {% set x1 = states('sensor.time') %}
  488.           {% set t = now().time() %}
  489.           {% set t = (t.hour*60+t.minute)*60+t.second %}
  490.           {% set start = state_attr('input_datetime.inizio_dnd', 'timestamp') %}
  491.           {% set stop = state_attr('input_datetime.fine_dnd', 'timestamp') %}
  492.           {% if start < stop %}
  493.             {{ start < t < stop }}
  494.           {% else %}
  495.             {{ t > start or t < stop }}
  496.           {% endif %}
  497.         icon_template: >
  498.          {% if is_state('binary_sensor.dnd','off') %} mdi:do-not-disturb-off {% else %} mdi:do-not-disturb {% endif %}
  499.  
  500.   - platform: mqtt
  501.     name: "ripristino volume riascolto"
  502.     state_topic: "cn/ripristino_volume_interfono"
  503.     payload_on: "on"
  504.     payload_off: "off"
  505.     qos: 0
  506.  
  507. ################################################################################
  508. ##                  Timer
  509. ###################################################
  510. timer:
  511.   ritardo_invio_volume_riavvio:
  512.     name: 'Tempo Residuo invio volume'
  513.     icon: mdi:clock-alert-outline
  514.  
  515. ################################################################################
  516. ##                  Notify
  517. ###################################################
  518. notify:
  519.   - name: ALL_DEVICES
  520.     platform: group
  521.     services:
  522.       - service: mobile_app_iphone
  523.       - service: mobile_app_iphone_12
  524.  
  525. ################################################################################
  526. ## Script
  527. ################################################
  528. script:
  529.   set_volume_speaker:
  530.     sequence:
  531.       - service: media_player.volume_set
  532.         data_template:
  533.           entity_id: media_player.in_casa
  534.           volume_level: "{{ states('sensor.volume_periodo') }}"
  535.  
  536.       - delay: "00:00:05"
  537.       - service: media_player.volume_set
  538.         data_template:
  539.           entity_id: media_player.in_casa
  540.           volume_level: "{{ states('sensor.volume_periodo') }}"
  541.  
  542.   set_volume_prioritario:
  543.     sequence:
  544.       - service: media_player.volume_set
  545.         data_template:
  546.           entity_id: media_player.in_casa
  547.           volume_level: "{{ states('input_number.volume_messaggio_prioritario') | int / 100 }}"
  548.  
  549.   set_volume_riascolto:
  550.     sequence:
  551.       - service: media_player.volume_set
  552.         data_template:
  553.           entity_id: media_player.in_casa
  554.           volume_level: "{{ states('input_number.volume_riascolto') | int / 100 }}"
  555.  
  556.   salvataggio_volume:
  557.     sequence:
  558.       - service: input_number.set_value
  559.         data_template:
  560.           entity_id: input_number.salvataggio_volume
  561.           value: "{{ state_attr('media_player.soggiorno','volume_level') }}"
  562.  
  563.   invio_volume_riavvio:
  564.     alias: 'Stop temporaneo invio volume al riavvio'
  565.     icon: mdi:check-decagram
  566.     sequence:
  567.       - service: timer.start
  568.         data_template:
  569.           entity_id: timer.ritardo_invio_volume_riavvio
  570.           duration: '{{ states("input_number.ritardo_invio_volume_riavvio") | int * 60 }}'
  571.  
  572.   # Script di notifica centralizzato intelligente
  573.   multinotify:
  574.     alias: 'Notifica intelligente'
  575.     description: 'Invia una notifica parametrica alle app/Alexa, potendo selezionare il volume e vari parametri opzionali'
  576.     fields:
  577.       title:
  578.         description: 'Titolo della notifica'
  579.         example: 'Avviso importante'
  580.       message:
  581.         description: 'Testo da notificare che verrà letto ed inviato come corpo della notifica'
  582.         example: 'Un dispositivo non sta funzionando'
  583.       alexa_message:
  584.         description: 'Testo che Alexa dovrà pronunciare, se differente da message. Se non specificato verrà usato message.'
  585.         example: '<say-as interpret-as="interjection">yippii</say-as>. Questo verrebbe male nelle notifiche dell''app!'
  586.       alexa_target:
  587.         description: 'Dispositivo o dispositivi Alexa a cui inviare la notifica'
  588.         example: 'media_player.ovunque'
  589.       alexa_volume_target:
  590.         description: 'Singolo dispositivo Alexa a cui modificare il volume per la notifica'
  591.         example: 'media_player.mansarda'
  592.       alexa_volume:
  593.         description: "Volume che si desidera impostare per l'annuncio su alexa_volume_target"
  594.         example: "0.6"
  595.       alexa_volume_restore:
  596.         description: 'Se alexa_volume_target è impostato, se true o non specificato ripristina il volume precedente. Se false non ripristina il volume precedente'
  597.         example: 'false'
  598.       alexa_force:
  599.         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"
  600.         example: 'false'
  601.       notify_app:
  602.         description: "Il nome del servizio di notifica app o non compilare per non inviare notifiche all'app"
  603.         example: 'notify.ALL_DEVICES'
  604.       group:
  605.         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"'
  606.         example: 'alarm'
  607.       channel:
  608.         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"'
  609.         example: 'Generic'
  610.       icon:
  611.         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"'
  612.         example: 'warning'
  613.       tag:
  614.         description: "Campo tag della notifica ad app. Se impostato sul telefono l'eventuale notifica sarà sostituita alla seguente con tag uguale"
  615.         example: 'fulmini'
  616.       critical:
  617.         description: 'impostare a "true" per inviare una notifica immediata. Se "false" o non specificata la notifica sarà riprodotta quando verrà sbloccato il telefono'
  618.         example: 'true'
  619.       android:
  620.         description: "Adatta le notichie per la versione Android dell'app"
  621.         example: 'true'
  622.  
  623.     sequence:
  624.      # Sezione messaggio all'app
  625.       - choose:
  626.         - conditions:
  627.             - condition: template
  628.               value_template: "{{ notify_app is defined }}"
  629.             - condition: template
  630.               value_template: "{{critical}}"
  631.             - condition: template
  632.               value_template: "{{android}}"
  633.           sequence:
  634.             - service: '{{notify_app}}'
  635.               data:
  636.                 title: "{{title | default('Notifica da casa')}}"
  637.                 message: "{{message}}"
  638.                 data:
  639.                   group: "{{group | default(channel) | default('info')}}"
  640.                   channel: "{{channel | default(group) | default('info')}}"
  641.                   tag: "{{tag}}"
  642.                   icon_url: "/local/notify_{{icon | default(channel) | default(group) | default('info')}}.png"
  643.                   ttl: 0
  644.                   priority: high
  645.  
  646.         - conditions:
  647.             - condition: template
  648.               value_template: "{{ notify_app is defined }}"
  649.             - condition: template
  650.               value_template: "{{critical}}"
  651.           sequence:
  652.             - service: '{{notify_app}}'
  653.               data:
  654.                 title: "{{title | default('Notifica da casa')}}"
  655.                 message: "{{message}}"
  656.                 data:
  657.                   channel: "{{channel | default(group) | default('info')}}"
  658.                   group: "{{group | default(channel) | default('info')}}"
  659.                   tag: "{{tag}}"
  660.                   push:
  661.                     sound:
  662.                       name: "default"
  663.                       critical: 1
  664.                       volume: 1.0
  665.  
  666.  
  667.         - conditions:
  668.           - condition: template
  669.             value_template: "{{ notify_app is defined }}"
  670.           sequence:
  671.             - service: '{{notify_app}}'
  672.               data:
  673.                 title: "{{title | default('Notifica da casa')}}"
  674.                 message: "{{message}}"
  675.                 data:
  676.                   group: "{{group | default(channel) | default('info')}}"
  677.                   channel: "{{channel | default(group) | default('info')}}"
  678.                   tag: "{{tag}}"
  679.                   icon_url: "/local/notify_{{icon | default(channel) | default(group) | default('info')}}.png"
  680.  
  681.       # Sezione messaggio Alexa
  682.       - choose:
  683.           - conditions:
  684.               - condition: or
  685.                 conditions:
  686.                   - condition: template
  687.                     value_template: "{{ alexa_force | default(false) }}"
  688.                   - condition: time
  689.                     after: input_datetime.fine_dnd
  690.                     before: input_datetime.inizio_dnd
  691.             sequence:
  692.               - choose:
  693.                 - conditions:
  694.                     - condition: template
  695.                       value_template: "{{ alexa_volume_target is defined}}"
  696.                   sequence:
  697.                     - service: input_number.set_value
  698.                       data:
  699.                         entity_id: input_number.alexa_prev_volume
  700.                         value: "{{state_attr(alexa_volume_target, 'volume_level')}}"
  701.                     - service: media_player.volume_set
  702.                       data:
  703.                         entity_id: "{{alexa_volume_target}}"
  704.                         volume_level: "{{alexa_volume | default('0.6') | round(2)}}"
  705.               - choose:
  706.                   - conditions:
  707.                       - condition: template
  708.                         value_template: "{{ alexa_target is defined }}"
  709.                     sequence:
  710.                       - service: notify.alexa_media
  711.                         data:
  712.                           message: "{{alexa_message | default(alexa)}}"
  713.                           data:
  714.                             method: all
  715.                             type: announce
  716.                           target: "{{alexa_target}}"
  717.               - choose:
  718.                 - conditions:
  719.                     - condition: template
  720.                       value_template: "{{ alexa_volume_target is defined and (alexa_volume_restore is not defined or alexa_volume_restore == true)}}"
  721.                   sequence:
  722.                     - service: media_player.volume_set
  723.                       data:
  724.                         entity_id: "{{alexa_volume_target}}"
  725.                         volume_level: "{{states('input_number.alexa_prev_volume') | round(2)}}"
  726.  
  727.   volume_alexa_interfono:
  728.     sequence:
  729.       - service: media_player.volume_set
  730.         data_template:
  731.           entity_id: '{{ alexainterfono }}'
  732.           volume_level: '{{ volumelevel }}'
  733.  
  734.   ripristino_volume_interfono:
  735.     sequence:
  736.       - service: media_player.volume_set
  737.         data_template:
  738.           entity_id: media_player.ovunque
  739.           volume_level: "{{ states('sensor.volume_periodo') }}"
  740.       - delay: '00:00:05'
  741.       - service: media_player.volume_set
  742.         data_template:
  743.           entity_id: media_player.ovunque
  744.           volume_level: "{{ states('sensor.volume_periodo') }}"
  745.       - delay: '00:00:15'
  746.       - service: media_player.volume_set
  747.         data_template:
  748.           entity_id: media_player.ovunque
  749.           volume_level: "{{ states('sensor.volume_periodo') }}"
  750.  
  751.   annuncio:
  752.     sequence:
  753.       - service: notify.alexa_media
  754.         data_template:
  755.           target:
  756.            - "{{ states.sensor.interfono_sorgente.state }}"
  757.           data:
  758.             type: announce
  759.             method: speak
  760.           message: "{{ states('sensor.interfono_mittente') }}, {{ states('input_text.interfono_message') }}"
  761. ################################################################################
  762.  
  763. ################################################################################
  764. ## Automations
  765. ################################################
  766. automation:
  767.   - alias: Crea Gruppo Notifiche CNV
  768.     id: 97c2c84236a930ec04cfb5fa9ad37f8f
  769.     initial_state: true
  770.     trigger:
  771.       - platform: homeassistant
  772.         event: start
  773.       - platform: state
  774.         entity_id: automation.crea_gruppo_notifiche_cnv
  775.         to: "on"
  776.     action:
  777. #      - delay: "00:00:35"
  778.       - service: group.set
  779.         data_template:
  780.           object_id: "gruppo_cnv"
  781.           name: "Notifiche Vocali"
  782.           icon: mdi:group
  783.           #          visible: true
  784.           entities: >
  785.            {%- for item in states.automation if ((item.attributes.id | lower).endswith('cnv')) -%}
  786.             {{ item.entity_id }}{% if not loop.last %}, {% endif %}
  787.             {%- endfor -%}
  788.  
  789.   - alias: Crea Gruppo Notifiche CNT
  790.     id: 3fe38a1606f0009e6f4a9c8a4fee9036
  791.     initial_state: true
  792.     trigger:
  793.       - platform: homeassistant
  794.         event: start
  795.       - platform: state
  796.         entity_id: automation.crea_gruppo_notifiche_cnt
  797.         to: "on"
  798.     action:
  799. #      - delay: "00:00:30"
  800.       - service: group.set
  801.         data_template:
  802.           object_id: "gruppo_cnt"
  803.           name: "Notifiche di testo"
  804.           icon: mdi:group
  805.           #          visible: true
  806.           entities: >
  807.            {%- for item in states.automation if ((item.attributes.id | lower).endswith('cnt')) -%}
  808.             {{ item.entity_id }}{% if not loop.last %}, {% endif %}
  809.             {%- endfor -%}
  810.  
  811.   - alias: Ripeti Ultimo Messaggio
  812.     id: e2b6ecb56610d204aca0aa6a9fd32e3a
  813.     mode: single
  814.     trigger:
  815.       - platform: state
  816.         entity_id: input_boolean.ultimo_messaggio
  817.         to: "on"
  818.     action:
  819.       - service: input_boolean.turn_on
  820.         data:
  821.           entity_id: input_boolean.messaggio_prioritario
  822.       - service: script.salvataggio_volume
  823.       - service: script.set_volume_riascolto
  824.       - service: notify.alexa_media
  825.         data_template:
  826.           target: >-
  827.             {% if is_state('sensor.last_alexa', 'none') %}
  828.               media_player.in_casa
  829.             {% else %}
  830.               media_player.{{ states.sensor.last_alexa.state }}
  831.             {% endif %}
  832.           data:
  833.             type: announce
  834.             method: speak
  835.           message: "{{ states('sensor.ultimo_messaggio') }}"
  836.       - service: input_boolean.turn_off
  837.         data:
  838.           entity_id: input_boolean.ultimo_messaggio
  839.       - delay: "00:00:05"
  840.       - service: input_boolean.turn_off
  841.         data:
  842.           entity_id: input_boolean.messaggio_prioritario
  843.       - delay: "00:00:05"
  844.       - service: script.set_volume_speaker
  845.  
  846.   - alias: Settaggio Volume
  847.     id: ef51cea18df6676ca22ad2fc0b46f6f3
  848.     initial_state: true
  849.     trigger:
  850.       - platform: time # MATTINA
  851.         at: input_datetime.start_mattina
  852.       - platform: time # POMERIGGIO
  853.         at: input_datetime.start_pomeriggio
  854.       - platform: time # SERA
  855.         at: input_datetime.start_sera
  856.       - platform: time # NOTTE
  857.         at: input_datetime.start_notte
  858.     action:
  859.       - service: script.set_volume_speaker
  860.  
  861.   - alias: Non Disturbare start
  862.     id: 0efb52d4034dc699965c45e5b2ece1b7
  863.     initial_state: true
  864.     trigger:
  865.       - platform: template
  866.         value_template: "{{ states('sensor.time') == (states.input_datetime.inizio_dnd.attributes.timestamp | int | timestamp_custom('%H:%M', False)) }}"
  867.     condition:
  868.       - condition: state
  869.         entity_id: input_boolean.non_disturbare
  870.         state: "on"
  871.     action:
  872.       - service: switch.turn_on
  873.         data:
  874.           entity_id: switch.ovunque_do_not_disturb_switch
  875.  
  876.   - alias: Non Disturbare fine
  877.     id: 39de2fcf97af70bfad380bfad35dc584
  878.     initial_state: true
  879.     trigger:
  880.       - platform: template
  881.         value_template: "{{ states('sensor.time') == (states.input_datetime.fine_dnd.attributes.timestamp | int | timestamp_custom('%H:%M', False)) }}"
  882.     condition:
  883.       - condition: state
  884.         entity_id: input_boolean.non_disturbare
  885.         state: "on"
  886.     action:
  887.       - service: switch.turn_off
  888.         data:
  889.           entity_id: switch.ovunque_do_not_disturb_switch
  890.  
  891.   - alias: DND ON
  892.     id: 83b5b9909be71842c973592d3668eb1b
  893.     initial_state: true
  894.     trigger:
  895.       - platform: state
  896.         entity_id: switch.ovunque_do_not_disturb_switch
  897.         to: "on"
  898.     action:
  899.       - service: media_player.volume_mute
  900.         data:
  901.           entity_id: media_player.ovunque
  902.           is_volume_muted: true
  903.  
  904.   - alias: DND Off
  905.     id: 34a2a807638f7edfbaa7b5c42df46255
  906.     initial_state: true
  907.     trigger:
  908.       - platform: state
  909.         entity_id: switch.ovunque_do_not_disturb_switch
  910.         to: "off"
  911.     action:
  912.       - service: media_player.volume_mute
  913.         data:
  914.           entity_id: media_player.ovunque
  915.           is_volume_muted: false
  916.  
  917.   - id: messaggio_prioritario_cnv
  918.     alias: Messaggio Prioritario
  919.     trigger:
  920.       - platform: state
  921.         entity_id: input_boolean.messaggio_prioritario
  922.         to: "on"
  923.     condition:
  924.       - condition: state
  925.         entity_id: switch.ovunque_do_not_disturb_switch
  926.         state: "on"
  927.     action:
  928.       - service: switch.turn_off
  929.         data:
  930.           entity_id: switch.ovunque_do_not_disturb_switch
  931.  
  932.   - id: messaggio_prioritario_off
  933.     alias: Messaggio Prioritario off
  934.     trigger:
  935.       - platform: state
  936.         entity_id: input_boolean.messaggio_prioritario
  937.         to: "off"
  938.     condition:
  939.       - condition: state
  940.         entity_id: binary_sensor.dnd
  941.         state: "on"
  942.     action:
  943.       - service: switch.turn_on
  944.         data:
  945.           entity_id: switch.ovunque_do_not_disturb_switch
  946.  
  947.   - alias: 'Attivazione / Disattivazione ritardo'
  948.     id: 567332b3c1d55400c7337df898934574
  949.     initial_state: true
  950.     mode: single
  951.     max_exceeded: silent
  952.     trigger:
  953.     - platform: state
  954.       entity_id: input_boolean.invio_volume_riavvio
  955.       to: 'off'
  956.     action:
  957.       - service: timer.cancel
  958.         entity_id: timer.ritardo_invio_volume_riavvio
  959.  
  960.   - alias: 'Ripristino invio volume - cancella timer'
  961.     id: 857afbeb5ee38aed318af5237172ce04
  962.     initial_state: true
  963.     mode: single
  964.     max_exceeded: silent
  965.     trigger:
  966.     - platform: state
  967.       entity_id: input_boolean.invio_volume_riavvio
  968.       to: 'off'
  969.     action:
  970.       - service: timer.cancel
  971.         entity_id: timer.ritardo_invio_volume_riavvio
  972.  
  973.   - alias: 'Ripristino invio volume - ricarica timer'
  974.     id: a3616a76f464446921188ab26243e971
  975.     initial_state: true
  976.     mode: single
  977.     max_exceeded: silent
  978.     trigger:
  979.       - platform: state
  980.         entity_id: input_number.ritardo_invio_volume_riavvio
  981.     condition:
  982.       - condition: state
  983.         entity_id: input_boolean.invio_volume_riavvio
  984.         state: 'on'
  985.     action:
  986.       - service: timer.cancel
  987.         entity_id: timer.ritardo_invio_volume_riavvio
  988.       - service: script.invio_volume_riavvio
  989.  
  990.  
  991.   - alias: 'Start timer Invio volume al riavvio'
  992.     id: cb1a6d4c816560b17e8b9db35b348264
  993.     initial_state: true
  994.     trigger:
  995.       - platform: homeassistant
  996.         event: start
  997.     condition:
  998.       - condition: state
  999.         entity_id: input_boolean.invio_volume_riavvio
  1000.         state: 'on'
  1001.     action:
  1002.       - service: script.invio_volume_riavvio
  1003.  
  1004.   - alias: 'Invio volume - Fine timer'
  1005.     id: d7992818ba660ff9ad50c372488456d1
  1006.     initial_state: true
  1007.     mode: single
  1008.     max_exceeded: silent
  1009.     trigger:
  1010.     - platform: event
  1011.       event_type: timer.finished
  1012.       event_data:
  1013.         entity_id: timer.ritardo_invio_volume_riavvio
  1014.     action:
  1015.       - service: script.set_volume_speaker
  1016.  
  1017.   - alias: "Regolazione volume"
  1018.     id: 59c5bae742bb759fbb985797c9be169c
  1019.     trigger:
  1020.       - platform: state
  1021.         entity_id: input_text.interfono_message
  1022.     condition:
  1023.       condition: template
  1024.       value_template: >
  1025.        {{ states('input_text.interfono_message') | length > 0 }}
  1026.     action:
  1027.       - service: script.turn_on
  1028.         entity_id: script.volume_alexa_interfono
  1029.         data_template:
  1030.           variables:
  1031.             alexainterfono: "{{ states('sensor.interfono_sorgente') }}"
  1032.             volumelevel: "{{ states('input_number.interfono_volume') | int / 100 }}"
  1033.       - delay: '00:00:02'
  1034.       - service: script.turn_on
  1035.         entity_id: script.annuncio
  1036. #      - service: notify.alexa_media
  1037. #        data_template:
  1038. #          target:
  1039. #            - '{{ states.sensor.interfono_sorgente.state }}'
  1040. #          data:
  1041. #            type: announce
  1042. #            method: speak
  1043. #          message: "{{ states('sensor.interfono_mittente') }}, {{ states('input_text.interfono_message') }}"
  1044.  
  1045.       - service: input_text.set_value
  1046.         data_template:
  1047.           entity_id: input_text.cn_ultimo_messaggio
  1048.           value: "{{ states('sensor.interfono_mittente') }}, {{ states('input_text.interfono_message') }}"
  1049.  
  1050.       - service: input_text.set_value
  1051.         data:
  1052.           entity_id: input_text.interfono_message
  1053.           value: ''
  1054.  
  1055.       - service: mqtt.publish
  1056.         data_template:
  1057.           payload: "on"
  1058.           topic: cn/ripristino_volume_interfono
  1059.           retain: false
  1060.           qos: 1
  1061.  
  1062.   - alias: Ripristino Volume interfono
  1063.     id: b24fb02f2548cdf4d364d45565c17c46
  1064.     trigger:
  1065.       platform: state
  1066.       entity_id: binary_sensor.ripristino_volume_riascolto
  1067.       to: 'on'
  1068.     action:
  1069.       - delay: '00:00:08'
  1070.       - service: script.set_volume_speaker
  1071.  
  1072.       - service: mqtt.publish
  1073.         data_template:
  1074.           payload: "off"
  1075.           topic: cn/ripristino_volume_interfono
  1076.           retain: false
  1077.           qos: 1
  1078.  
  1079.  
  1080.  
  1081.  
  1082. ###################################################################
  1083.  
  1084. - type: vertical-stack
  1085.   cards:
  1086.     - type: entities
  1087.       title: Centro Notifiche
  1088.       show_header_toggle: false
  1089.       entities:
  1090.         - type: section
  1091.           label: Monitor
  1092.         - entity: sensor.time
  1093.           name: Ora attuale
  1094.         - type: custom:fold-entity-row
  1095.           head: sensor.periodo
  1096.           items:
  1097.            - input_datetime.start_mattina
  1098.             - input_datetime.start_pomeriggio
  1099.             - input_datetime.start_sera
  1100.             - input_datetime.start_notte
  1101.  
  1102.         - type: custom:fold-entity-row
  1103.           head: sensor.volume_periodo_template
  1104.           items:
  1105.            - input_number.volume_mattina
  1106.             - input_number.volume_pomeriggio
  1107.             - input_number.volume_sera
  1108.             - input_number.volume_notte
  1109.  
  1110.         - type: call-service
  1111.           icon: mdi:repeat
  1112.           name: Ultimo Messaggio
  1113.           action_name: Riascolta
  1114.           service: input_boolean.turn_on
  1115.           service_data:
  1116.             entity_id: input_boolean.ultimo_messaggio
  1117.         - entity: input_number.volume_riascolto
  1118.  
  1119.         - type: section
  1120.           label: Modalità
  1121.  
  1122.         - entity: input_boolean.non_disturbare_switch
  1123.           name: Non disturbare
  1124.           icon_state: true
  1125.         - entity: input_boolean.modo_ospite
  1126.           state_color: true
  1127.         - type: section
  1128.           label: " "
  1129.         - entity: input_boolean.messaggio_prioritario
  1130.           state_color: true
  1131.         - type: section
  1132.           label: "  "
  1133.         - type: custom:fold-entity-row
  1134.           head: group.gruppo_cnv
  1135.           name: Notifiche Vocali
  1136.           group_config:
  1137.             secondary_info: last-changed
  1138.         - type: custom:fold-entity-row
  1139.           head: group.gruppo_cnt
  1140.           name: Notifiche di testo
  1141.           group_config:
  1142.             icon: mdi:home-automation
  1143.  
  1144. ################################# PARTE RADIO PRESA DA HASSIOHELP
  1145. - type: vertical-stack
  1146.   cards:
  1147.     - type: picture-entity
  1148.       entity: camera.logo_stazionealexa
  1149.       camera_image: camera.logo_stazione
  1150.       show_name: false
  1151.       show_state: false
  1152.     - entities:
  1153.         - entity: input_select.stazioni_radioalexa
  1154.         - entity: input_select.alexa_speaker
  1155.         - entity: input_boolean.web_radioalexa
  1156.           name: Radio
  1157.           icon: 'mdi:power'
  1158.           state_color: true
  1159.         - entity: input_number.volume_radioalexa
  1160.           state_color: true
  1161.         - entity: script.alexa_meteo
  1162.           icon: 'mdi:white-balance-sunny'
  1163.           name: Info Meteo
  1164.           state_color: true
  1165.         - entity: script.alexa_ultime_notizie
  1166.           name: Info Notizie
  1167.           icon: 'mdi:newspaper'
  1168.           state_color: true
  1169.         - entity: script.alexa_traffico
  1170.           name: Info Traffico Lavoro
  1171.           icon: 'mdi:traffic-light'
  1172.           state_color: true
  1173.         - entity: input_boolean.impostazioni_radio_alexa
  1174.           name: Impostazioni
  1175.           state_color: true
  1176.       type: entities
  1177.       show_header_toggle: false
  1178.  
  1179.  
  1180.     - type: conditional
  1181.       conditions:
  1182.         - entity: input_boolean.impostazioni_radio_alexa
  1183.           state: 'on'
  1184.         - entity: input_boolean.impostazioni_radio_alexa
  1185.           state_not: 'off'
  1186.       card:
  1187.         type: entities
  1188.         entities:
  1189.           - entity: automation.notifica_aggiornamento_disponibile_alexa_web_radio
  1190.             name: Notifica Push Update
  1191.             icon: 'mdi:bell-ring'
  1192.             state_color: true
  1193.           - entity: sensor.sensore_versionealexa
  1194.             name: Versione Installata
  1195.             icon: 'mdi:google-circles-extended'
  1196.           - entity: sensor.ultima_versione_alexa_webradio
  1197.             name: Ultima Versione Disponibile
  1198.             icon: 'mdi:update'
  1199.         title: 'Update:'
  1200.     - type: conditional
  1201.       conditions:
  1202.         - entity: input_boolean.impostazioni_radio_alexa
  1203.           state: 'on'
  1204.         - entity: input_boolean.impostazioni_radio_alexa
  1205.           state_not: 'off'
  1206.       card:
  1207.         type: entities
  1208.         entities:
  1209.           - entity: automation.radio_off_volume_alexa
  1210.             name: Volume Alexa - Radio OFF
  1211.             icon: 'mdi:restart'
  1212.             state_color: true
  1213.           - entity: input_number.volume_radiooffalexa
  1214.             name: Volume Alexa
  1215.         title: 'Volume Off:'
  1216.     - type: conditional
  1217.       conditions:
  1218.         - entity: input_boolean.impostazioni_radio_alexa
  1219.           state: 'on'
  1220.         - entity: input_boolean.impostazioni_radio_alexa
  1221.           state_not: 'off'
  1222.       card:
  1223.         type: markdown
  1224.         content: >-
  1225.           Alexa Web Radio
  1226.  
  1227.           -------------------
  1228.  
  1229.           ____
  1230.  
  1231.           Scarica Update:
  1232.           [Download](https://domhouse.it/alexa-webradio-su-home-assistant/)
  1233.  
  1234.  
  1235.  
  1236.           ___
  1237.  
  1238.  
  1239. ##########################################################################################################################################
  1240. #######################################################    C A R D      ##################################################################
  1241. ##########################################################################################################################################
  1242. - type: custom:stack-in-card
  1243.   mode: vertical
  1244.   cards:
  1245.     - type: custom:button-card # Set Volume Alexa
  1246.       name: Volume
  1247.       entity: script.set_volume_speaker
  1248.       show_icon: false
  1249.       tap_action:
  1250.         action: call-service
  1251.         service: script.turn_on
  1252.         service_data:
  1253.           entity_id: script.set_volume_speaker
  1254.       styles:
  1255.         card:
  1256.           - background: none
  1257.  
  1258.     - type: horizontal-stack
  1259.       cards:
  1260.         - type: custom:button-card # Soggiorno
  1261.           icon: mdi:amazon-alexa
  1262.           entity: media_player.soggiorno
  1263.           aspect_ratio: 3/1
  1264.           name: Vol. Soggiorno
  1265.           styles:
  1266.             card:
  1267.               - background: none
  1268.             grid:
  1269.               - position: relative
  1270.             custom_fields:
  1271.               notification:
  1272.                 - background-color: >
  1273.                    [[[
  1274.                       if (states['sensor.volume_alexa_soggiorno'].state == 0)
  1275.                         return "green";
  1276.                       return "red";
  1277.                     ]]]
  1278.                 - border-radius: 50%
  1279.                 - position: absolute
  1280.                 - left: 60%
  1281.                 - top: 10%
  1282.                 - height: 20px
  1283.                 - width: 20px
  1284.                 - font-size: 15px
  1285.                 - line-height: 20px
  1286.           custom_fields:
  1287.             notification: >
  1288.              [[[ return Math.floor(states['sensor.volume_alexa_soggiorno'].state ) ]]]
  1289.  
  1290.         - type: custom:button-card # Cucina
  1291.           icon: mdi:amazon-alexa
  1292.           entity: media_player.echo_show_cucina
  1293.           aspect_ratio: 3/1
  1294.           name: Vol. Cucina
  1295.           styles:
  1296.             card:
  1297.               - background: none
  1298.             grid:
  1299.               - position: relative
  1300.             custom_fields:
  1301.               notification:
  1302.                 - background-color: >
  1303.                    [[[
  1304.                       if (states['sensor.volume_alexa_show'].state == 0)
  1305.                         return "green";
  1306.                       return "red";
  1307.                     ]]]
  1308.                 - border-radius: 50%
  1309.                 - position: absolute
  1310.                 - left: 60%
  1311.                 - top: 10%
  1312.                 - height: 20px
  1313.                 - width: 20px
  1314.                 - font-size: 15px
  1315.                 - line-height: 20px
  1316.           custom_fields:
  1317.             notification: >
  1318.              [[[ return Math.floor(states['sensor.volume_alexa_show'].state ) ]]]
  1319.  
  1320.     - type: horizontal-stack
  1321.       cards:
  1322.         - type: custom:button-card # Camera da letto
  1323.           icon: mdi:amazon-alexa
  1324.           aspect_ratio: 3/1
  1325.           name: Vol. Camera Letto
  1326.           styles:
  1327.             card:
  1328.               - background: none
  1329.             grid:
  1330.               - position: relative
  1331.             custom_fields:
  1332.               notification:
  1333.                 - background-color: >
  1334.                    [[[
  1335.                       if (states['sensor.volume_alexa_camera_da_letto'].state == 0)
  1336.                         return "green";
  1337.                       return "red";
  1338.                     ]]]
  1339.                 - border-radius: 50%
  1340.                 - position: absolute
  1341.                 - left: 60%
  1342.                 - top: 10%
  1343.                 - height: 20px
  1344.                 - width: 20px
  1345.                 - font-size: 15px
  1346.                 - line-height: 20px
  1347.           custom_fields:
  1348.             notification: >
  1349.              [[[ return Math.floor(states['sensor.volume_alexa_camera_da_letto'].state ) ]]]
  1350.  
  1351.         - type: custom:button-card # Cameretta
  1352.           icon: mdi:amazon-alexa
  1353.           entity: media_player.cameretta
  1354.           aspect_ratio: 3/1
  1355.           name: Vol. Cameretta
  1356.           styles:
  1357.             card:
  1358.               - background: none
  1359.             grid:
  1360.               - position: relative
  1361.             custom_fields:
  1362.               notification:
  1363.                 - background-color: >
  1364.                    [[[
  1365.                       if (states['sensor.volume_alexa_cameretta'].state == 0)
  1366.                         return "green";
  1367.                       return "red";
  1368.                     ]]]
  1369.                 - border-radius: 50%
  1370.                 - position: absolute
  1371.                 - left: 60%
  1372.                 - top: 10%
  1373.                 - height: 20px
  1374.                 - width: 20px
  1375.                 - font-size: 15px
  1376.                 - line-height: 20px
  1377.           custom_fields:
  1378.             notification: >
  1379.              [[[ return Math.floor(states['sensor.volume_alexa_cameretta'].state ) ]]]
  1380.  
  1381.     - type: horizontal-stack
  1382.       cards:
  1383.         - type: custom:button-card # Bagno
  1384.           entity: media_player.bagno
  1385.           icon: mdi:amazon-alexa
  1386.           aspect_ratio: 3/1
  1387.           name: Vol. Bagno
  1388.           styles:
  1389.             card:
  1390.               - background: none
  1391.             grid:
  1392.               - position: relative
  1393.             custom_fields:
  1394.               notification:
  1395.                 - background-color: >
  1396.                    [[[
  1397.                       if (states['sensor.volume_alexa_bagno'].state == 0)
  1398.                         return "green";
  1399.                       return "red";
  1400.                     ]]]
  1401.                 - border-radius: 50%
  1402.                 - position: absolute
  1403.                 - left: 60%
  1404.                 - top: 10%
  1405.                 - height: 20px
  1406.                 - width: 20px
  1407.                 - font-size: 15px
  1408.                 - line-height: 20px
  1409.           custom_fields:
  1410.             notification: >
  1411.              [[[ return Math.floor(states['sensor.volume_alexa_bagno'].state ) ]]]
  1412.  
  1413.         - type: custom:button-card # Studio
  1414.           icon: mdi:amazon-alexa
  1415.           entity: media_player.studio
  1416.           aspect_ratio: 3/1
  1417.           name: Vol. Studio
  1418.           styles:
  1419.             card:
  1420.               - background: none
  1421.             grid:
  1422.               - position: relative
  1423.             custom_fields:
  1424.               notification:
  1425.                 - background-color: >
  1426.                    [[[
  1427.                       if (states['sensor.volume_alexa_studio'].state == 0)
  1428.                         return "green";
  1429.                       return "red";
  1430.                     ]]]
  1431.                 - border-radius: 50%
  1432.                 - position: absolute
  1433.                 - left: 60%
  1434.                 - top: 10%
  1435.                 - height: 20px
  1436.                 - width: 20px
  1437.                 - font-size: 15px
  1438.                 - line-height: 20px
  1439.           custom_fields:
  1440.             notification: >
  1441.              [[[ return Math.floor(states['sensor.volume_alexa_studio'].state ) ]]]
  1442. #        - type: custom:button-card
  1443. #          name: ""
  1444. #          styles:
  1445. #            card:
  1446. #              - background: none
  1447.  
  1448.  
  1449.     - type: entities
  1450.       show_header_toggle: false
  1451.       entities:
  1452.         - entity: input_boolean.invio_volume_riavvio
  1453.         - entity: input_number.ritardo_invio_volume_riavvio
  1454.         - entity: timer.ritardo_invio_volume_riavvio
  1455.  
  1456.  
  1457.  
  1458.     - type: vertical-stack
  1459.       cards:
  1460.         - type: entities
  1461.           show_header_toggle: false
  1462.           entities:
  1463.             - type: section
  1464.               label: Interfono
  1465.             - entity: input_select.interfono_mittente
  1466.             - entity: input_text.interfono_message
  1467.             - entity: input_number.interfono_volume
  1468.             - entity: input_select.interfono_sorgente
  1469.           style: |
  1470.             ha-card {background-color: transparent;}
  1471.  
  1472.     - type: vertical-stack
  1473.       cards:
  1474.         - type: entities
  1475.           title: Impostazioni Assistente
  1476.           show_header_toggle: false
  1477.           entities:
  1478.             - type: section
  1479.               label: Impostazione orario modo silenzioso
  1480.             - entity: input_boolean.non_disturbare
  1481.               name: Non disturbare Automatico
  1482.             - entity: input_datetime.inizio_dnd
  1483.             - entity: input_datetime.fine_dnd
  1484.           style: |
  1485.             ha-card {background-color: transparent;}
  1486.  
Add Comment
Please, Sign In to add comment