Yi Hack Camera 자동화

 


재실 카메라 끄기

- id: 재실-카메라_끄기
  alias: 재실-카메라_끄기
  trigger:
  - entity_id: device_tracker.a515f_ble
    platform: state
    to:
      - 'home'
      - 'not_home'
  action:
  - entity_id: switch.yi_camera_switch_status
    service_template: '{% if trigger.to_state.state == ''home'' %}
      switch.turn_off{% else %}switch.turn_on{% endif %}'
  mode: single


카메라 모션센서 감지시 HA에서 카메라 1분 레코딩

- id: 움직임-거실카메라
  alias: 움직임-거실카메라
  trigger:
  - entity_id: binary_sensor.yi_camera_movement
    from: 'off'
    platform: state
    to: 'on'
  condition:
  - condition: state
    entity_id: device_tracker.a515f_ble
    state: not_home
  action:
  - data:
      filename: '/config/www/snapshot/{{ now().strftime("%Y%m%d-%H%M%S") }}.mp4'
      duration: 60
    target:
      entity_id: camera.yi_hack
    service: camera.record
  mode: single