Advertisement
penright

Untitled

Apr 14th, 2022
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 7.99 KB | None | 0 0
  1. #      service: notify.family
  2. #      data:
  3. #        message: "Nancy has arrived at her parents. Time: {{now().strftime('%I:%M:%S %p')}}"
  4.  
  5. #Shop Sensors
  6. # binary_sensor.shop_door
  7. # binary_sensor.shop_north_east_window
  8. # binary_sensor.shop_north_window
  9. # binary_sensor.shop_south_east_window
  10. # binary_sensor.shop_south_overhead_door
  11. # binary_sensor.shop_south_window
  12. # input_boolean.open_shop
  13. # cover.shop_north_overhead_door
  14.  
  15. input_boolean:
  16.   shop_lock:
  17.     name: 'Shop is Lock'
  18.   shop_stop_automation:
  19.     name: 'Shop Stop All Automation'
  20.   shop_test_door_opening:
  21.     name: 'Test_door_open'
  22.  
  23. input_select:
  24.   shop_status:
  25.     name: 'Shop Status'
  26.     options:
  27.      - Open
  28.       - Opening
  29.       - Close
  30.       - Closing
  31.       - Unauthorize
  32.       - Unknown
  33.  
  34. automation:
  35. # Entering the shop
  36.   - alias: 'Shop 2 Opening'
  37.     id: 'Shop 2 Opening'
  38.     trigger:
  39.       - platform: state
  40.         entity_id: binary_sensor.shop_door
  41.         to: 'on'
  42.       - platform: state # North East Window
  43.         entity_id: binary_sensor.shop_north_east_window
  44.         to: 'on'
  45.       - platform: state # North Window
  46.         entity_id: binary_sensor.shop_north_window
  47.         to: 'on'
  48.       - platform: state # South East Window
  49.         entity_id: binary_sensor.shop_south_east_window
  50.         to: 'on'
  51.       - platform: state # South Window
  52.         entity_id: binary_sensor.shop_south_window
  53.         to: 'on'
  54.       - platform: state # South Overhead Door
  55.         entity_id: binary_sensor.shop_south_overhead_door
  56.         to: 'on'
  57.       - platform: state
  58.         entity_id: cover.shop_north_overhead_door
  59.         from: close
  60.       - platform: state
  61.         entity_id: input_boolean.shop_test_door_opening
  62.         to: 'on'
  63.     condition:
  64.       - condition: state
  65.         entity_id: "input_boolean.shop_stop_automation"
  66.         state: "off"      
  67.       - condition: template
  68.         value_template: "{{ not((states('input_select.shop_status')) == 'Unknown') }}"
  69.     action:
  70.       - service: input_select.select_option
  71.         data:
  72.           option: Opening
  73.         target:
  74.           entity_id: input_select.shop_status
  75.      
  76. # Shop Opening waiting for unlock
  77.   - alias: 'Shop Opening'
  78.     id: 'Shop Opening'
  79.     trigger:
  80.       - platform: state
  81.         entity_id: input_select.select_option
  82.         to: 'Opening'
  83.     condition:
  84.       - condition: state
  85.         entity_id: "input_boolean.shop_stop_automation"
  86.         state: "off"      
  87.       - condition: template
  88.         value_template: "{{ not((states('input_select.shop_status')) == 'Unknown') }}"
  89.     action:
  90.       - wait_for_trigger:
  91.         - platform: state
  92.           entity_id: input_boolean.shop_lock
  93.           to: 'off'
  94.         timeout:
  95.           seconds: 30
  96.       - choose:
  97.           - alias: "Is shop still lock?"
  98.             conditions:
  99.               - condition: state
  100.                 entity_id: input_boolean.shop_lock
  101.                 state: "on"
  102.             sequence:
  103.               - service: input_select.select_option
  104.                 data:
  105.                   option: Unauthorize
  106.                 target:
  107.                    entity_id: input_select.shop_status
  108.         default:
  109.           - service: light.turn_on
  110.             entity_id: light.shop_main_bench
  111.           - service: light.turn_on
  112.             entity_id: light.shop_bays
  113.           - service: media_player.volume_set
  114.             data:
  115.               volume_level: 1
  116.             target:
  117.               entity_id: media_player.shop
  118.           - service: media_player.play_media
  119.             entity_id: media_player.shop
  120.             data:
  121.               media_content_id: http://maestro.emfcdn.com/stream_for/k-love/web
  122.               media_content_type: music
  123.               extra:
  124.                 title: KLove
  125.                 thumb: https://cdn-profiles.tunein.com/s22561/images/bannerx.jpg?t=637102372250000000
  126.                 stream_type: live
  127.           - service: input_select.select_option
  128.             data:
  129.               option: Open
  130.             target:
  131.                entity_id: input_select.shop_status
  132.        
  133.  
  134. # Leaving the shop
  135.   - alias: 'Shop Close'
  136.     id: 'Shop Close'
  137.     trigger:
  138.       platform: state
  139.       entity_id: input_boolean.shop_lock
  140.       to: 'on'
  141.     condition:
  142.       - condition: state
  143.         entity_id: "input_boolean.shop_stop_automation"
  144.         state: "off"      
  145.       - condition: template
  146.         value_template: "{{ not((states('input_select.shop_status')) == 'Unknown') }}"
  147.     action:
  148.       - alias: "Repeat Paul phone if wireless charging"
  149.         repeat:
  150.           while:
  151.             - condition: state
  152.               entity_id: sensor.paul_mobile_charger_type
  153.               state: "wireless"
  154.             # Don't do it too many times
  155.             - condition: template
  156.               value_template: "{{ repeat.index <= 20 }}"
  157.           sequence:
  158.             - service: tts.cloud_say
  159.               entity_id: media_player.shop
  160.               data:
  161.                 message: Paul you are forgetting your phone!
  162.             - service: light.turn_off
  163.               entity_id: light.shop_bays
  164.             - delay: 1
  165.             - service: light.turn_on
  166.               entity_id: light.shop_bays
  167.             - delay: 1
  168.             - service: light.turn_off
  169.               entity_id: light.shop_bays
  170.             - delay: 1
  171.             - service: light.turn_on
  172.               entity_id: light.shop_bays
  173.             - delay: 1
  174.             - wait_template: "{{ not is_state('sensor.paul_mobile_charger_type', 'wireless') }}"
  175.               timeout: '00:00:10'
  176.               continue_on_timeout: true
  177.       - service: tts.cloud_say
  178.         entity_id: media_player.shop
  179.         data:
  180.           message: Ok, I will be shutting down for awhile.
  181.       - service: media_player.turn_off
  182.         data: {}
  183.         target:
  184.           entity_id: media_player.shop
  185.       - service: light.turn_on
  186.         entity_id: light.back_porch
  187.       - delay: 120
  188.       - service: light.turn_off
  189.         entity_id: light.shop_bays
  190.       - service: light.turn_off
  191.         entity_id: light.shop_main_bench
  192.       - service: light.turn_off
  193.         entity_id: light.back_porch
  194.       - service: switch.turn_off
  195.         entity_id: switch.shop_heater
  196.            
  197.  
  198.  
  199. # Unauthorized Entry into Shop
  200.   - alias: 'Shop Unauthorized Entry'
  201.     id: 'Shop Unauthorized Entry'
  202.     trigger:
  203.       - platform: state
  204.         entity_id: input_select.select_option
  205.         to: 'Unauthorize'
  206.     condition:
  207.       - condition: state
  208.         entity_id: "input_boolean.shop_stop_automation"
  209.         state: "off"      
  210.       - condition: template
  211.         value_template: "{{ not((states('input_select.shop_status')) == 'Unknown') }}"
  212.     action:
  213.     - service: light.turn_on
  214.       entity_id: light.shop_main_bench
  215.     - service: notify.paul
  216.       data:
  217.         message: "Unauthorized entry into shop. Time: {{now().strftime('%I:%M:%S %p')}}"
  218.     - service: media_player.volume_set
  219.       data:
  220.         volume_level: 1
  221.       target:
  222.         entity_id: media_player.shop
  223.     - alias: "Repeat unauthorized entry into shop"
  224.       repeat:
  225.         while:
  226.           - condition: state
  227.             entity_id: input_boolean.shop_lock
  228.             state: 'off'
  229.           # Don't do it too many times
  230.           - condition: template
  231.             value_template: "{{ repeat.index <= 120 }}"
  232.         sequence:
  233.           - service: tts.cloud_say
  234.             entity_id: media_player.shop
  235.             data:
  236.               message: Unauthorized entry. Police is being dispatch. Cameras are recording.
  237.           - wait_template: "{{ not is_state('input_boolean.shop_lock', 'off') }}"
  238.             timeout: '00:00:10'
  239.             continue_on_timeout: true
  240.     - service: notify.paul
  241.       data:
  242.         message: "Unauthorized entry into shop (done). Time: {{now().strftime('%I:%M:%S %p')}}"
  243.     - service: media_player.turn_off
  244.       data: {}
  245.       target:
  246.         entity_id: media_player.shop
  247.     - service: input_select.select_option
  248.       data:
  249.         option: Unknown
  250.       target:
  251.          entity_id: input_select.shop_status
  252.      
  253.   # nancy_need_help:
  254.     # - service: tts.cloud_say
  255.       # data:
  256.         # message: Nancy this is a test, can you here me?
  257.         # options:
  258.           # gender: Male
  259.           # language: en-US
  260.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement