Advertisement
Guest User

cameras.yaml

a guest
May 24th, 2019
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 5.24 KB | None | 0 0
  1. ################################################################
  2. ## Cameras
  3. ################################################################
  4.  
  5. ################################################
  6. ## Camera component
  7. ################################################
  8.  
  9. camera:
  10.   - platform: generic
  11.     still_image_url: !secret cam_backdoor
  12.     stream_source: !secret cam_backdoor_rtsp
  13.     name: BackDoor
  14.   - platform: generic
  15.     still_image_url: !secret cam_frontdoor
  16.     stream_source: !secret cam_frontdoor_rtsp
  17.     name: FrontDoor
  18.   - platform: generic
  19.     still_image_url: !secret cam_patio
  20.     stream_source: !secret cam_patio_rtsp
  21.     name: Patio
  22.  
  23. ################################################
  24. ## Image Processing
  25. ################################################
  26.  
  27. image_processing:
  28.   - platform: tensorflow
  29.     source:
  30.       - entity_id: camera.backdoor
  31.       - entity_id: camera.frontdoor
  32.       - entity_id: camera.patio
  33.     file_out:
  34.      - "/config/www/tensorflow/{{ camera_entity.split('.')[1] }}_latest.jpg"
  35.       - "/config/www/tensorflow/{{ camera_entity.split('.')[1] }}_{{ now().strftime('%Y%m%d_%H%M%S') }}.jpg"
  36.     scan_interval: 604800
  37.     model:
  38.       graph: /config/tensorflow/frozen_inference_graph.pb
  39.       categories:
  40.        - person
  41.  
  42. ################################################
  43. ## Input boolean
  44. ################################################
  45.  
  46. input_boolean:
  47.   camgrab_backdoor:
  48.     name: camgrab_backdoor
  49.     initial: off
  50.     icon: mdi:camera
  51.   camgrab_frontdoor:
  52.     name: camgrab_frontdoor
  53.     initial: off
  54.     icon: mdi:camera
  55.   camgrab_patio:
  56.     name: camgrab_patio
  57.     initial: off
  58.     icon: mdi:camera
  59.  
  60. ################################################
  61. ## Shell Command
  62. ## Captures a 5 sec video and toggles input_boolean.cameragrab off when done
  63. ################################################
  64.  
  65. shell_command:
  66.   backdoor_ipcam_mp4: bash -x /config/shell-scripts/backdoor_ipcam2mp4.sh >> /config/ffmpeg/ipcam2.log 2>&1
  67.   frontdoor_ipcam_mp4: bash -x /config/shell-scripts/frontdoor_ipcam2mp4.sh >> /config/ffmpeg/ipcam2.log 2>&1
  68.   camerafilechanged: bash -x /config/shell-scripts/camerafilechanged.sh
  69.  
  70. ################################################
  71. ## Binary Sensors
  72. ################################################
  73.  
  74. binary_sensor:
  75.   - platform: hikvision
  76.     host: 192.168.1.185
  77.     username: !secret cam_hikvision_usr
  78.     password: !secret cam_hikvision_pw
  79.     name: Backdoor_movement
  80.     ssl: false
  81.     customize:
  82.       motion:
  83.         delay: 30
  84.       line_crossing:
  85.         delay: 30
  86.       field_detection:
  87.         delay: 30
  88.   - platform: hikvision
  89.     host: 192.168.1.186
  90.     name: Frontdoor_movement
  91.     username: !secret cam_hikvision_usr
  92.     password: !secret cam_hikvision_pw
  93.     ssl: false
  94.     customize:
  95.       motion:
  96.         delay: 30
  97.       line_crossing:
  98.         delay: 30
  99.   - platform: hikvision
  100.     host: 192.168.1.187
  101.     name: Patio_movement
  102.     username: !secret cam_hikvision_usr
  103.     password: !secret cam_hikvision_pw
  104.     ssl: false
  105.     customize:
  106.       motion:
  107.         delay: 30
  108.       field_detection:
  109.         delay: 30
  110.  
  111. ################################################
  112. ## Automation
  113. ################################################
  114.  
  115. automation:
  116.   - id: movement_backdoor
  117.     alias: Movement backdoor
  118.     initial_state: false
  119.     hide_entity: False
  120.     trigger:
  121.       - platform: state
  122.         entity_id: binary_sensor.backdoor_movement_field_detection
  123.         from: 'off'
  124.         to: 'on'
  125.     condition:
  126.       - condition: state
  127.         entity_id: alarm_control_panel.home_alarm
  128.         state: armed
  129.     action:
  130.       - service: camera.snapshot
  131.         data:
  132.           entity_id: camera.backdoor
  133.           filename: '/config/www/backdoor.jpg'
  134.       - service: input_boolean.turn_on
  135.         data:
  136.           entity_id: input_boolean.camgrab_backdoor
  137.       - service: shell_command.backdoor_ipcam_mp4
  138.       - wait_template: "{{ is_state('input_boolean.camgrab_backdoor', 'off') }}"
  139.       - service: notify.telegram
  140.         data:
  141.           title: Movement Backdoor
  142.           message: "Movement Backdoor"
  143.           data:
  144.             video:
  145.               - file: /config/www/backdoor-output.mp4
  146.                 caption: Backdoor movement
  147.   - id: movement_frontdoor
  148.     alias: Movement frontdoor
  149.     initial_state: false
  150.     hide_entity: False
  151.     trigger:
  152.       - platform: state
  153.         entity_id: binary_sensor.frontdoor_movement_line_crossing
  154.         from: 'off'
  155.         to: 'on'
  156.     condition:
  157.       - condition: state
  158.         entity_id: alarm_control_panel.home_alarm
  159.         state: disarmed
  160.     action:
  161.       - service: camera.snapshot
  162.         data:
  163.           entity_id: camera.frontdoor
  164.           filename: '/config/www/frontdoor.jpg'
  165.       - service: input_boolean.turn_on
  166.         data:
  167.           entity_id: input_boolean.camgrab_frontdoor
  168.       - service: shell_command.frontdoor_ipcam_mp4
  169.       - wait_template: "{{ is_state('input_boolean.camgrab_frontdoor', 'off') }}"
  170.       - service: notify.telegram
  171.         data:
  172.           title: Movement Frontdoor
  173.           message: "Movement frontdoor"
  174.           data:
  175.             video:
  176.               - file: /config/www/frontdoor-output.mp4
  177.                 caption: Frontdoor movement
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement