Advertisement
penright

Untitled

Apr 15th, 2022
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 2.66 KB | None | 0 0
  1. # Unauthorized Entry into Shop
  2.   - alias: 'Shop Unauthorized Entry'
  3.     id: 'Shop Unauthorized Entry'
  4.     trigger:
  5.       - platform: state
  6.         entity_id: binary_sensor.shop_door
  7.         to: 'on'
  8.       - platform: state # North East Window
  9.         entity_id: binary_sensor.shop_north_east_window
  10.         to: 'on'
  11.       - platform: state # North Window
  12.         entity_id: binary_sensor.shop_north_window
  13.         to: 'on'
  14.       - platform: state # South East Window
  15.         entity_id: binary_sensor.shop_south_east_window
  16.         to: 'on'
  17.       - platform: state # South Window
  18.         entity_id: binary_sensor.shop_south_window
  19.         to: 'on'
  20.       - platform: state # South Overhead Door
  21.         entity_id: binary_sensor.shop_south_overhead_door
  22.         to: 'on'
  23.       - platform: state
  24.         entity_id: input_select.shop_status
  25.         to: 'Unauthorize'
  26.     condition:
  27.       - condition: state
  28.         entity_id: "input_boolean.shop_stop_automation"
  29.         state: "off"      
  30.       - condition: template
  31.         value_template: "{{ not((states('input_select.shop_status')) == 'Unknown') }}"
  32.     action:
  33.     - service: input_select.select_option
  34.       data:
  35.         option: Unauthorize
  36.       target:
  37.         entity_id: input_select.shop_status
  38.     - service: light.turn_on
  39.       entity_id: light.shop_main_bench
  40.     - service: notify.paul
  41.       data:
  42.         message: "Unauthorized entry into shop. Time: {{now().strftime('%I:%M:%S %p')}}"
  43.     - service: media_player.turn_off
  44.       data: {}
  45.       target:
  46.         entity_id: media_player.shop
  47.     - service: media_player.volume_set
  48.       data:
  49.         volume_level: 1
  50.       target:
  51.         entity_id: media_player.shop
  52.     - alias: "Repeat unauthorized entry into shop"
  53.       repeat:
  54.         while:
  55.           - condition: state
  56.             entity_id: input_boolean.shop_lock
  57.             state: 'on'
  58.           # Don't do it too many times
  59.           - condition: template
  60.             value_template: "{{ repeat.index <= 120 }}"
  61.         sequence:
  62.           - service: tts.cloud_say
  63.             entity_id: media_player.shop
  64.             data:
  65.               message: Unauthorized entry. Police is being dispatch. Cameras are recording.
  66.           - wait_template: "{{ is_state('input_boolean.shop_lock', 'off') }}"
  67.             timeout: '00:00:05'
  68.             continue_on_timeout: true
  69.     - service: notify.paul
  70.       data:
  71.         message: "Unauthorized entry into shop (done). Time: {{now().strftime('%I:%M:%S %p')}}"
  72.     - service: media_player.turn_off
  73.       data: {}
  74.       target:
  75.         entity_id: media_player.shop
  76.     - service: input_select.select_option
  77.       data:
  78.         option: Unknown
  79.       target:
  80.          entity_id: input_select.shop_status
  81.      
  82.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement