Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Unauthorized Entry into Shop
- - alias: 'Shop Unauthorized Entry'
- id: 'Shop Unauthorized Entry'
- trigger:
- - platform: state
- entity_id: binary_sensor.shop_door
- to: 'on'
- - platform: state # North East Window
- entity_id: binary_sensor.shop_north_east_window
- to: 'on'
- - platform: state # North Window
- entity_id: binary_sensor.shop_north_window
- to: 'on'
- - platform: state # South East Window
- entity_id: binary_sensor.shop_south_east_window
- to: 'on'
- - platform: state # South Window
- entity_id: binary_sensor.shop_south_window
- to: 'on'
- - platform: state # South Overhead Door
- entity_id: binary_sensor.shop_south_overhead_door
- to: 'on'
- - platform: state
- entity_id: input_select.shop_status
- to: 'Unauthorize'
- condition:
- - condition: state
- entity_id: "input_boolean.shop_stop_automation"
- state: "off"
- - condition: template
- value_template: "{{ not((states('input_select.shop_status')) == 'Unknown') }}"
- action:
- - service: input_select.select_option
- data:
- option: Unauthorize
- target:
- entity_id: input_select.shop_status
- - service: light.turn_on
- entity_id: light.shop_main_bench
- - service: notify.paul
- data:
- message: "Unauthorized entry into shop. Time: {{now().strftime('%I:%M:%S %p')}}"
- - service: media_player.turn_off
- data: {}
- target:
- entity_id: media_player.shop
- - service: media_player.volume_set
- data:
- volume_level: 1
- target:
- entity_id: media_player.shop
- - alias: "Repeat unauthorized entry into shop"
- repeat:
- while:
- - condition: state
- entity_id: input_boolean.shop_lock
- state: 'on'
- # Don't do it too many times
- - condition: template
- value_template: "{{ repeat.index <= 120 }}"
- sequence:
- - service: tts.cloud_say
- entity_id: media_player.shop
- data:
- message: Unauthorized entry. Police is being dispatch. Cameras are recording.
- - wait_template: "{{ is_state('input_boolean.shop_lock', 'off') }}"
- timeout: '00:00:05'
- continue_on_timeout: true
- - service: notify.paul
- data:
- message: "Unauthorized entry into shop (done). Time: {{now().strftime('%I:%M:%S %p')}}"
- - service: media_player.turn_off
- data: {}
- target:
- entity_id: media_player.shop
- - service: input_select.select_option
- data:
- option: Unknown
- target:
- entity_id: input_select.shop_status
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement