Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## configuration.yaml for creating a secondary cropped view off of a camera in home assistant
- camera:
- - platform: proxy
- entity_id: camera.YOUR_MAIN_CAMERA_NAME
- name: NAME OF NEW CAMERA CROPPED VIEW
- mode: crop
- image_top: 0
- image_left: 3200
- max_image_width: 1000
- max_image_height: 500
- max_stream_width: 1000
- max_stream_height: 500
- ## advanced automation YAML for saving time-based thumbnails of AI analysis images for notifications (look for ALL UPPERCASE items below for things to change for your own usage)
- description: "HITECHLIFE: AI Vision Mail Delivery Detection"
- mode: single
- triggers:
- - trigger: state
- entity_id:
- - binary_sensor.CAMERA_MOTION_TRIGGER
- from:
- - "off"
- to:
- - "on"
- conditions:
- - condition: time
- weekday:
- - mon
- - tue
- - wed
- - thu
- - fri
- - sat
- actions:
- - variables:
- snapshot_filename: "{{ now().strftime('%Y%m%d-%H%M%S') }}.jpg"
- - action: camera.snapshot
- metadata: {}
- target:
- entity_id:
- - camera.CROPPED_CAMERA_NAME
- data:
- filename: /config/www/mailbox/{{ snapshot_filename }}
- - action: ai_task.generate_data
- metadata: {}
- data:
- task_name: Identify postal vehicle
- entity_id: ai_task.google_ai_task
- attachments:
- media_content_id: media-source://camera/camera.CROPPED_CAMERA_NAME
- media_content_type: image/jpeg
- metadata:
- title: CROPPED CAMERA FRIENDLY NAME
- thumbnail: /api/camera_proxy/camera.CROPPED_CAMERA_NAME
- media_class: video
- children_media_class: null
- navigateIds:
- - {}
- - media_content_type: app
- media_content_id: media-source://camera
- instructions: >-
- Review this image and assess whether a United States Postal Service
- vehicle is seen in front of the mailbox. Provide a single word
- response, and no other text. Respond with 'true' if a postal vehicle is
- seen, otherwise with 'false' for any other conditions.
- response_variable: mailbox_assessment
- - if:
- - condition: template
- value_template: "{{ mailbox_assessment.data | lower == 'true' }}"
- then:
- - action: notify.DEVICE_TO_NOTIFY
- metadata: {}
- data:
- title: 📬 AI
- message: >-
- Mail delivery detected: {{ now().astimezone().strftime('%Y-%m-%d
- %I:%M %p %Z') }}
- data:
- image: /local/mailbox/{{ snapshot_filename }}
- url: /local/mailbox/{{ snapshot_filename }}
- push:
- sound: default
- - action: persistent_notification.create
- data:
- notification_id: mailbox_{{ snapshot_filename }}
- title: >-
- {% if mailbox_assessment.data | lower == 'true' %} 📬 MAIL DETECTED — {{
- now().strftime('%m/%d %I:%M %p') }} {% else %} 🚫 No Mail — {{
- now().strftime('%m/%d %I:%M %p') }} {% endif %}
- message: |-
- **Result:** {{ mailbox_assessment.data }}
- 
Advertisement
Add Comment
Please, Sign In to add comment