Untitled

 avatar
unknown
plain_text
3 months ago
1.6 kB
43
No Index
(automation File below)

alias: Doorbell_Motion_Notification
  sequence:
    - service: camera.snapshot
      data:
        entity_id: camera.front_door
        filename: /config/www/snapshots/ring_motion_latest.jpg
    - wait_for_trigger:
        - platform: time
          minutes: 0.5 # Wait half a second to ensure the file is written
    - service: google_generative_ai_conversation.generate_content
      data:
        model: models/text-bison-001 # Specify the model (if needed)
        prompt: >
          Very briefly describe what you see in this image: {{image_path}}.
          Your message needs to be short for a phone notification.  
          Ignore stationary objects and buildings.  Only describe moving subjects.
      variables:
        image_path: /config/www/snapshots/ring_motion_latest.jpg
    - service: notify.mobile_app_jerry 
      data:
        message: >
          Doorbell motion detected! {{generated_text}}
      response_variable:
        generated_text: "{{ result.data.response }}"

Configuration  File below

sensor:
  - platform: template
    sensors:
      generated_ai_response:
        value_template: "{{ states('sensor.last_ai_response') }}"

rest_command:
    generate_ai_insight:
    url: "https://generativeai.googleapis.com/v1/models/text-bison:generateText"
    method: POST
    headers:
      Authorization: "key removed"
      Content-Type: "application/json"
    payload: >
      {
        "prompt": {
          "text": "{{ prompt_text }}"
        },
        "temperature": 0.7,
        "candidate_count": 1
      }
    content_template: true
Editor is loading...
Leave a Comment