calas

PK ALLARME

Feb 8th, 2020
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 22.45 KB | None | 0 0
  1. homeassistant:
  2.   customize:
  3.     package.node_anchors:
  4.       customize: &customize
  5.         package: 'Package Allarme'
  6.         version: 'v1.1'
  7.         author: 'Calas'
  8.  
  9.       expose: &expose
  10.         <<: *customize
  11.         haaska_hidden: false
  12.         homebridge_hidden: false
  13.  
  14.     ################################################
  15.     ## Input Boolean Customize
  16.     ################################################
  17.     input_boolean.allamre_manuale:
  18.       <<: *customize
  19.     input_boolean.allamre_automatico_in_casa:
  20.       <<: *customize
  21.     input_boolean.allamre_automatico_notte:
  22.       <<: *customize
  23.     input_boolean.allamre_automatico_away:
  24.       <<: *customize
  25.     input_boolean.allarme_telefonata:
  26.       <<: *customize
  27.     input_boolean.allarme_invio_foto:
  28.       <<: *customize
  29.     input_boolean.sensore_finestra_camera_in_casa:
  30.       <<: *customize
  31.     input_boolean.sensore_finestra_camera_notte:
  32.       <<: *customize
  33.     input_boolean.sensore_finestra_camera_away:
  34.       <<: *customize
  35.     input_boolean.sensore_finestra_camera_manuale:
  36.       <<: *customize
  37.  
  38.     input_boolean.sensore_porta_ingresso_in_casa:
  39.       <<: *customize
  40.     input_boolean.sensore_porta_ingresso_notte:
  41.       <<: *customize
  42.     input_boolean.sensore_porta_ingresso_away:
  43.       <<: *customize
  44.     input_boolean.sensore_porta_ingresso_manuale:
  45.       <<: *customize
  46.  
  47.     input_boolean.sensore_pir_corridoio_in_casa:
  48.       <<: *customize
  49.     input_boolean.sensore_pir_corridoio_notte:
  50.       <<: *customize
  51.     input_boolean.sensore_pir_corridoio_away:
  52.       <<: *customize
  53.     input_boolean.sensore_pir_corridoio_manuale:
  54.       <<: *customize
  55.  
  56.     input_boolean.cam1:
  57.       <<: *customize
  58.     ################################################
  59.     ## Input Binary Sensor Customize
  60.     ################################################
  61.     binary_sensor.allarme_in_casa:
  62.       <<: *customize
  63.     binary_sensor.allarme_away:
  64.       <<: *customize
  65.     binary_sensor.allarme_notte:
  66.       <<: *customize
  67.     ################################################
  68.     ## Input Datetime Customize
  69.     ################################################
  70.     input_datetime.allarme_notte_start:
  71.       <<: *customize
  72.     input_datetime.allarme_notte_end:
  73.       <<: *customize
  74.  
  75. #******************************************************************************#
  76. #                                   C O R P O                                  #
  77. #******************************************************************************#
  78.  
  79. ################################################
  80. ## Integrazioni
  81. ################################################
  82. twilio:
  83.   account_sid: !secret twilio_account_sid
  84.   auth_token: !secret twilio_auth_token
  85.  
  86.  
  87. ################################################
  88. ## Input Datetime
  89. ################################################
  90. input_datetime:
  91.   allarme_notte_start:
  92.     name: Inizio Allarme Notturno
  93.     has_date: false
  94.     has_time: true
  95.   allarme_notte_end:
  96.     name: Fine Allarme Notturno
  97.     has_date: false
  98.     has_time: true
  99.  
  100. ################################################
  101. ## Input Boolean
  102. ################################################
  103. input_boolean:
  104.   allamre_manuale:
  105.     name: Manuale
  106.     icon: mdi:cursor-pointer
  107.  
  108.   allamre_automatico_in_casa:
  109.     name: Auto in casa
  110.     icon: mdi:shield-home
  111.  
  112.   allamre_automatico_notte:
  113.     name: Auto Notte
  114.     icon: mdi:weather-night
  115.  
  116.   allamre_automatico_away:
  117.     name: Auto fuori casa
  118.     icon: mdi:alarm-light
  119.  
  120.   allarme_telefonata:
  121.     name: Invio telefonata
  122.     icon: mdi:phone-alert
  123.  
  124.   allarme_invio_foto:
  125.     name: Invio foto
  126.     icon: mdi:camera
  127.  
  128.   controllo_stato_cam:
  129.     name: Controllo CAM
  130.     icon: mdi:motion-sensor
  131.  
  132.  
  133.   sensore_finestra_camera_in_casa:
  134.     name: Finestra Camera
  135.     icon: mdi:window-open-variant
  136.   sensore_finestra_camera_notte:
  137.     name: Finestra Camera
  138.     icon: mdi:window-open-variant
  139.   sensore_finestra_camera_away:
  140.     name: Finestra Camera
  141.     icon: mdi:window-open-variant
  142.   sensore_finestra_camera_manuale:
  143.     name: Finestra Camera
  144.     icon: mdi:window-open-variant
  145.  
  146.   sensore_porta_ingresso_in_casa:
  147.     name: Porta Ingresso
  148.     icon: mdi:door-closed-lock
  149.   sensore_porta_ingresso_notte:
  150.     name: Porta Ingresso
  151.     icon: mdi:door-closed-lock
  152.   sensore_porta_ingresso_away:
  153.     name: Porta Ingresso
  154.     icon: mdi:door-closed-lock
  155.   sensore_porta_ingresso_manuale:
  156.     name: Porta Ingresso
  157.     icon: mdi:door-closed-lock
  158.  
  159.   sensore_pir_corridoio_in_casa:
  160.     name: PIR Corridoio
  161.     icon: mdi:motion-sensor
  162.   sensore_pir_corridoio_notte:
  163.     name: PIR Corridoio
  164.     icon: mdi:motion-sensor
  165.   sensore_pir_corridoio_away:
  166.     name: PIR Corridoio
  167.     icon: mdi:motion-sensor
  168.   sensore_pir_corridoio_manuale:
  169.     name: PIR Corridoio
  170.     icon: mdi:motion-sensor
  171.  
  172.   cam1:
  173.     name: Cam1
  174. ################################################
  175. ## Sensor
  176. ################################################
  177. sensor:
  178. - platform: template
  179.   sensors:
  180.     allarme:
  181.       friendly_name_template: "Allarme"
  182.       entity_id: alarm_control_panel.allarme
  183.       value_template: "{{ {
  184.          'disarmed' : 'Disattivato',
  185.          'armed_home' : 'In Casa',
  186.          'armed_away' : 'Attivo',
  187.          'armed_night' : 'Notte',
  188.          } [states('alarm_control_panel.allarme')] }}"
  189.  
  190.     stato_allarme:
  191.       friendly_name: 'stato allarme'
  192.       value_template: >-
  193.         {%- if states.alarm_control_panel.allarme.state != "disarmed" -%}
  194.           Armato
  195.         {%- elif states.alarm_control_panel.allarme.state == "disarmed" -%}
  196.           Disarmato
  197.         {% else %}
  198.           Sconosciuto
  199.         {% endif %}
  200.  
  201. ################################################
  202. ## Binary Sensor
  203. ################################################
  204. binary_sensor:
  205.   - platform: template # ALLARME
  206.     sensors:
  207.       allarme_in_casa:
  208.         value_template: "{{ is_state('sensor.allarme', 'In Casa') }}"
  209.       allarme_away:
  210.         value_template: "{{ is_state('sensor.allarme', 'Attivo') }}"
  211.       allarme_notte:
  212.         value_template: "{{ is_state('sensor.allarme', 'Notte') }}"
  213.       allarme_disattivato:
  214.         value_template: "{{ is_state('sensor.allarme', 'Disattivato') }}"
  215.       cam1_stato:
  216.         friendly_name: WebCam 1
  217.         device_class: power
  218.         entity_id: switch.cam1
  219.         value_template: "{{ is_state('switch.cam1', 'on') }}"
  220.         icon_template: >-
  221.           {% if is_state('switch.cam1', 'on') %}
  222.             mdi:video
  223.           {% elif is_state('switch.cam1', 'off') %}
  224.             mdi:video-off-outline
  225.           {% else %}
  226.             mdi:video-off-outline
  227.           {% endif %}
  228.  
  229.   - platform: ping # Ping WEBCAM
  230.     name: 'Cam1'
  231.     host: !secret ip_cam1
  232.     scan_interval: 300
  233.  
  234. ################################################
  235. ## Automations
  236. ################################################
  237. automation:
  238. ################################################### ATTIVAZIONE ALLARMI ########
  239.   - alias: Allarme auto away ON
  240.     initial_state: true
  241.     trigger:
  242.     - entity_id: group.XXXXXXXXX
  243.       from: 'home'
  244.       platform: state
  245.       to: 'not_home'
  246.     condition:
  247.       - condition: state
  248.         entity_id: input_boolean.allamre_automatico_away
  249.         state: 'on'
  250.       - condition: state
  251.         entity_id: input_boolean.modo_ospite
  252.         state: 'off'
  253.     action:
  254.       - service: alarm_control_panel.alarm_arm_away
  255.         data: {"entity_id":"alarm_control_panel.allarme","code":"XXXXXX"}
  256.       - service: mqtt.publish
  257.         data_template:
  258.           payload: "away"
  259.           topic: allarme/attivazione
  260.           retain: false
  261.           qos: 1
  262.  
  263.   - alias: Allarme auto notte ON
  264.     initial_state: true
  265.     trigger:
  266.       - platform: template
  267.         value_template: "{{ states('sensor.time') == (states.input_datetime.allarme_notte_start.attributes.timestamp | int | timestamp_custom('%H:%M', False)) }}"
  268.     condition:
  269.       - condition: state
  270.         entity_id: input_boolean.allamre_automatico_notte
  271.         state: 'on'
  272.       - condition: state
  273.         entity_id: input_boolean.modo_ospite
  274.         state: 'off'
  275.     action:
  276.       - service: alarm_control_panel.alarm_arm_night
  277.         data: {"entity_id":"alarm_control_panel.allarme","code":"XXXXXX"}
  278.       - service: switch.turn_on
  279.         data:
  280.           entity_id: switch.cam1
  281.       - service: mqtt.publish
  282.         data_template:
  283.           payload: "notte"
  284.           topic: allarme/attivazione
  285.           retain: false
  286.           qos: 1
  287.  
  288.   - alias: Allarme Armato Away
  289.     initial_state: true
  290.     trigger:
  291.       platform: state
  292.       entity_id: alarm_control_panel.allarme
  293.       to: 'armed_away'
  294.     action:
  295.       - service: switch.turn_on
  296.         data:
  297.           entity_id: switch.cam1
  298.       - service: notify.alexa_media
  299.         data:
  300.           target:
  301.            - media_player.in_casa
  302.           data:
  303.             type: announce
  304.             method: speak
  305.           message: "Allarme Attivo"
  306.  
  307. ################################################### ALLARMI OFF ################
  308.   - alias: "Allarme Away OFF"
  309.     initial_state: true
  310.     trigger:
  311.       - entity_id: group.XXXXXXXXX
  312.         platform: state
  313.         to: 'home'
  314.     condition:
  315.       - condition: state
  316.         entity_id: sensor.stato_allarme
  317.         state: 'Armato'
  318.     action:
  319.       - service: alarm_control_panel.alarm_disarm
  320.         data: {"entity_id":"alarm_control_panel.allarme","code":"XXXXXX"}
  321.  
  322.   - alias: "Allarme Notte OFF"
  323.     initial_state: true
  324.     trigger:
  325.       - platform: template
  326.         value_template: "{{ states('sensor.time') == (states.input_datetime.allarme_notte_end.attributes.timestamp | int | timestamp_custom('%H:%M', False)) }}"
  327.     action:
  328.       - service: alarm_control_panel.alarm_disarm
  329.         data: {"entity_id":"alarm_control_panel.allarme","code":"XXXXXX"}
  330.       - service: mqtt.publish
  331.         data_template:
  332.           payload: "notte"
  333.           topic: allarme/disattivazione
  334.           retain: false
  335.           qos: 1
  336.  
  337.   - alias: "Allarmi OFF tasto"
  338.     initial_state: true
  339.     trigger:
  340.       - platform: event
  341.         event_type: xiaomi_aqara.click
  342.         event_data:
  343.           entity_id: binary_sensor.switch_158d0001e85517
  344.           click_type: long_click_press
  345.     action:
  346.       - service: alarm_control_panel.alarm_disarm
  347.         data: {"entity_id":"alarm_control_panel.allarme","code":"XXXXXX"}
  348.       - service: notify.XXXXXXXXX
  349.         data:
  350.           title: '*Allarme OFF*'
  351.           message: L'allarme disinserito con tasto.
  352.       - service: notify.alexa_media
  353.         data:
  354.           target:
  355.            - media_player.in_casa
  356.           data:
  357.             type: announce
  358.             method: speak
  359.           message: "Allarme disattivato con tasto"
  360.  
  361.   - alias: "Disattivazione Allarme"
  362.     initial_state: true
  363.     trigger:
  364.       - platform: state
  365.         entity_id: sensor.stato_allarme
  366.         to: 'Disarmato'
  367.     action:
  368.       - service: switch.turn_off
  369.         data:
  370.           entity_id: switch.cam1
  371.  
  372. ################################################### NOTIFICHE STATO ALLARME ####
  373.   - alias: Notifiche stato allarme
  374.     initial_state: true
  375.     trigger:
  376.       - platform: state
  377.         entity_id: alarm_control_panel.allarme
  378.     condition:
  379.       - condition: template
  380.         value_template: "{{ states.sensor.allarme.state != ''}}"
  381.     action:
  382.       - service: notify.XXXXXXXXX
  383.         data:
  384.           title: '*ALLARME*'
  385.           message: 'Allarme: {{ states.sensor.allarme.state }}'
  386.  
  387. ################################################### CONTROLLO STATI CAM ########
  388.   - id: notifica_controllo_accensione_cam_cnt
  389.     alias: Controllo Accensione Cam
  390.     initial_state: true
  391.     trigger:
  392.       platform: state
  393.       entity_id: alarm_control_panel.allarme
  394.       to: 'armed_away'
  395.       for:
  396.         minutes: 6
  397.     condition:
  398.       condition: state
  399.       entity_id: binary_sensor.cam1
  400.       state: 'off'
  401.     action:
  402.       service: notify.XXXXXXXXX
  403.       data:
  404.         message: La webcam non si รจ accesa
  405.  
  406.   - id: notifica_controllo_se_cam_viene_spenta_cnt
  407.     alias: Controllo se Cam viene spenta
  408.     initial_state: true
  409.     trigger:
  410.       platform: state
  411.       entity_id: binary_sensor.cam1
  412.       to: 'off'
  413.       for:
  414.         minutes: 6
  415.     condition:
  416.       condition: state
  417.       entity_id: binput_boolean.allarme
  418.       state: 'on'
  419.     action:
  420.       service: notify.XXXXXXXXX
  421.       data:
  422.         message: La webcam รจ stata spenta!
  423.  
  424. ################################################################################
  425. ##############################   TRIGGER ALLARME   #############################
  426. ################################################################################
  427.  
  428. ##############################   TRIGGER ALLARME  IN CASA  #####################
  429.   - alias: 'Allarme In Casa tirgger porta ingresso'
  430.     trigger:
  431.       - platform: state
  432.         entity_id: binary_sensor.door_window_sensor_158d000276e059
  433.         to: 'on'
  434.     condition:
  435.       - condition: state
  436.         entity_id: input_boolean.sensore_porta_ingresso_in_casa
  437.         state: 'on'
  438.       - condition: state
  439.         entity_id: alarm_control_panel.allarme
  440.         state: armed_home
  441.     action:
  442.       service: alarm_control_panel.alarm_trigger
  443.       entity_id: alarm_control_panel.allarme
  444.  
  445.   - alias: 'Allarme In Casa tirgger finestra cameretta'
  446.     trigger:
  447.       - platform: state
  448.         entity_id: binary_sensor.finestra_cameretta
  449.         to: 'on'
  450.     condition:
  451.       - condition: state
  452.         entity_id: input_boolean.sensore_finestra_camera_in_casa
  453.         state: 'on'
  454.       - condition: state
  455.         entity_id: alarm_control_panel.allarme
  456.         state: armed_home
  457.     action:
  458.       service: alarm_control_panel.alarm_trigger
  459.       entity_id: alarm_control_panel.allarme
  460.  
  461.   - alias: 'Allarme In Casa tirgger Corridoio'
  462.     trigger:
  463.       - platform: state
  464.         entity_id: binary_sensor.motion_sensor_158d0002b488d7
  465.         to: 'on'
  466.     condition:
  467.       - condition: state
  468.         entity_id: input_boolean.sensore_pir_corridoio_in_casa
  469.         state: 'on'
  470.       - condition: state
  471.         entity_id: alarm_control_panel.allarme
  472.         state: armed_home
  473.     action:
  474.       service: alarm_control_panel.alarm_trigger
  475.       entity_id: alarm_control_panel.allarme
  476.  
  477. ##############################   TRIGGER ALLARME  NOTTE  #######################
  478.   - alias: 'Allarme Notte tirgger porta ingresso'
  479.     trigger:
  480.       - platform: state
  481.         entity_id: binary_sensor.door_window_sensor_158d000276e059
  482.         to: 'on'
  483.     condition:
  484.       - condition: state
  485.         entity_id: input_boolean.sensore_porta_ingresso_notte
  486.         state: 'on'
  487.       - condition: state
  488.         entity_id: alarm_control_panel.allarme
  489.         state: armed_night
  490.     action:
  491.       service: alarm_control_panel.alarm_trigger
  492.       entity_id: alarm_control_panel.allarme
  493.  
  494.   - alias: 'Allarme Notte tirgger finestra cameretta'
  495.     trigger:
  496.       - platform: state
  497.         entity_id: binary_sensor.finestra_cameretta
  498.         to: 'on'
  499.     condition:
  500.       - condition: state
  501.         entity_id: input_boolean.sensore_finestra_camera_notte
  502.         state: 'on'
  503.       - condition: state
  504.         entity_id: alarm_control_panel.allarme
  505.         state: armed_night
  506.     action:
  507.       service: alarm_control_panel.alarm_trigger
  508.       entity_id: alarm_control_panel.allarme
  509.  
  510.   - alias: 'Allarme Notte tirgger Corridoio'
  511.     trigger:
  512.       - platform: state
  513.         entity_id: binary_sensor.motion_sensor_158d0002b488d7
  514.         to: 'on'
  515.     condition:
  516.       - condition: state
  517.         entity_id: input_boolean.sensore_pir_corridoio_notte
  518.         state: 'on'
  519.       - condition: state
  520.         entity_id: alarm_control_panel.allarme
  521.         state: armed_night
  522.     action:
  523.       service: alarm_control_panel.alarm_trigger
  524.       entity_id: alarm_control_panel.allarme
  525.  
  526. ##############################   TRIGGER ALLARME  NOTTE  #######################
  527.   - alias: 'Allarme Away tirgger porta ingresso'
  528.     trigger:
  529.       - platform: state
  530.         entity_id: binary_sensor.door_window_sensor_158d000276e059
  531.         to: 'on'
  532.     condition:
  533.       - condition: state
  534.         entity_id: input_boolean.sensore_porta_ingresso_away
  535.         state: 'on'
  536.       - condition: state
  537.         entity_id: alarm_control_panel.allarme
  538.         state: armed_away
  539.     action:
  540.       service: alarm_control_panel.alarm_trigger
  541.       entity_id: alarm_control_panel.allarme
  542.  
  543.   - alias: 'Allarme Away tirgger finestra cameretta'
  544.     trigger:
  545.       - platform: state
  546.         entity_id: binary_sensor.finestra_cameretta
  547.         to: 'on'
  548.     condition:
  549.       - condition: state
  550.         entity_id: input_boolean.sensore_finestra_camera_away
  551.         state: 'on'
  552.       - condition: state
  553.         entity_id: alarm_control_panel.allarme
  554.         state: armed_away
  555.     action:
  556.       service: alarm_control_panel.alarm_trigger
  557.       entity_id: alarm_control_panel.allarme
  558.  
  559.   - alias: 'Allarme Away tirgger Corridoio'
  560.     trigger:
  561.       - platform: state
  562.         entity_id: binary_sensor.motion_sensor_158d0002b488d7
  563.         to: 'on'
  564.     condition:
  565.       - condition: state
  566.         entity_id: input_boolean.sensore_pir_corridoio_away
  567.         state: 'on'
  568.       - condition: state
  569.         entity_id: alarm_control_panel.allarme
  570.         state: armed_away
  571.     action:
  572.       service: alarm_control_panel.alarm_trigger
  573.       entity_id: alarm_control_panel.allarme
  574.  
  575. ################################################################################
  576. ##############################   AZIONI  ALLARME   #############################
  577. ################################################################################
  578.  
  579. ##############################   SIRENA  #######################################
  580.   - alias: Sirena ON
  581.     initial_state: true
  582.     trigger:
  583.       - platform: state
  584.         entity_id: alarm_control_panel.allarme
  585.         to: 'triggered'
  586.     action:
  587.       - service: xiaomi_aqara.play_ringtone
  588.         data:
  589.           gw_mac: !secret xiaomi_mac
  590.           ringtone_id: 1
  591.           ringtone_vol: 100
  592.       - service: switch.turn_on
  593.         entity_id: switch.sirena
  594.       - service: notify.XXXXXXXXX
  595.         data:
  596.           title: '*ALLARME*'
  597.           message: La sirenza sta suonando.
  598.  
  599.   - alias: Sirena OFF
  600.     initial_state: true
  601.     trigger:
  602.       - platform: state
  603.         entity_id: alarm_control_panel.allarme
  604.         to: 'disarmed'
  605.     action:
  606.       - service: xiaomi_aqara.stop_ringtone
  607.         data:
  608.           gw_mac: !secret xiaomi_mac
  609.       - service: switch.turn_off
  610.         entity_id: switch.sirena
  611.  
  612. ##############################   FOTO  #########################################
  613.   - alias: Invio Foto Allarme
  614.     initial_state: true
  615.     trigger:
  616.       - platform: state
  617.         entity_id: alarm_control_panel.allarme
  618.         to: 'triggered'
  619.     condition:
  620.       - condition: state
  621.         entity_id: input_boolean.allarme_invio_foto
  622.         state: 'on'
  623.     action:
  624.        - delay: '00:00:01'
  625.        - service: notify.XXXXXXXXX
  626.          data_template:
  627.            message: "Immagine Intrusione"
  628.            data:
  629.              photo:
  630.                - url: 'https://XXXXXXXXX.duckdns.org:8123{{states.camera.soggiorno.attributes.entity_picture}}'
  631.                  caption: 'Movimeto rilevato il {{now().strftime("%d.%m.%Y - %H:%M:%S")}}'
  632.        - delay: '00:00:01'
  633.        - service: notify.XXXXXXXXX
  634.          data_template:
  635.            message: "Immagine Intrusione"
  636.            data:
  637.              photo:
  638.                - url: 'https://XXXXXXXXX.duckdns.org:8123{{states.camera.soggiorno.attributes.entity_picture}}'
  639.                  caption: 'Immagine 2 {{now().strftime("%d.%m.%Y - %H:%M:%S")}}'
  640.        - delay: '00:00:01'
  641.        - service: notify.XXXXXXXXX
  642.          data_template:
  643.            message: "Immagine Intrusione"
  644.            data:
  645.              photo:
  646.                - url: 'https://XXXXXXXXX.duckdns.org:8123{{states.camera.soggiorno.attributes.entity_picture}}'
  647.                  caption: 'Immagine 3 {{now().strftime("%d.%m.%Y - %H:%M:%S")}}'
  648.        - delay: '00:00:02'
  649.        - service: notify.XXXXXXXXX
  650.          data_template:
  651.            message: "Immagine Intrusione"
  652.            data:
  653.              photo:
  654.                - url: 'https://XXXXXXXXX.duckdns.org:8123{{states.camera.soggiorno.attributes.entity_picture}}'
  655.                  caption: 'Immagine 3 {{now().strftime("%d.%m.%Y - %H:%M:%S")}}'
  656.  
  657. ##############################   TELEFONATA  ###################################
  658.   - alias: Chiamata Allarme
  659.     initial_state: true
  660.     trigger:
  661.       - platform: state
  662.         entity_id: alarm_control_panel.allarme
  663.         to: 'triggered'
  664.     condition:
  665.       - condition: state
  666.         entity_id: input_boolean.allarme_telefonata
  667.         state: 'on'
  668.     action:
  669.       service: notify.allarme
  670.       data:
  671.         message: 'Allarm On'
  672.         target:
  673.          - +393921220821
  674.           - +393285518849โ€ฌ
  675.  
  676. ##############################   LUCI  #########################################
  677.   - alias: luci Allarme
  678.     initial_state: true
  679.     trigger:
  680.       - platform: state
  681.         entity_id: alarm_control_panel.allarme
  682.         to: 'triggered'
  683.     action:
  684.       - service: light.turn_on
  685.         entity_id: light.luce_cucina
  686.       - service: light.turn_on
  687.         entity_id: light.abat_jour
  688.       - service: light.turn_on
  689.         entity_id: light.luce_ingresso
  690.       - service: switch.turn_on
  691.         entity_id: switch.luce_grande
  692.       - service: switch.turn_on
  693.         entity_id: switch.luce_piccola
  694.       - service: light.turn_on
  695.         entity_id: light.gateway_light_7c49ebb1884a
  696.  
  697. ##############################   Tasto Cam1  ###################################
  698.   - alias: tasto cam1
  699.     initial_state: true
  700.     trigger:
  701.       - platform: state
  702.         entity_id: input_boolean.cam1
  703.     action:
  704.       service_template: >
  705.        {% if is_state('input_boolean.cam1', 'on') %}
  706.           switch.turn_on
  707.         {% else %}
  708.           switch.turn_off
  709.         {% endif %}
  710.       entity_id: switch.cam1
  711. ################## DiSATTIVAZIONE ALLARMI #####
  712. #  - alias: MQTT allarme notte off
  713. #    initial_state: true
  714. #    trigger:
  715. #      - platform: mqtt
  716. #        topic: "allarme/disattivazione"
  717. #    condition:
  718. #      condition: template
  719. #      value_template: '{{ "notte" in trigger.payload }}'
  720. #    action:
  721. #    - service: persistent_notification.create
  722. #      data_template:
  723. #        title: "Hassio Snapshot"
  724. #        message: >
  725. #          "Your message goes here "  {{ now().strftime('%H:%M') }} -
  726. #          title: "Custom subject"
Add Comment
Please, Sign In to add comment