Hi everyone,
I am encountering an issue with the Google Generative AI integration in Home Assistant. When executing scripts, I receive the following error:
text
Error generating content: 429 Quota exceeded for quota metric 'Generate Content API requests per minute' and limit 'GenerateContent request limit per minute for a region' of service 'generativelanguage.googleapis.com'.
Here’s what I’ve tried so far:
Verified my billing details and confirmed that I haven’t exceeded my quota.
Checked the Google Cloud Console for quota usage.
Attempted to manually rate-limit requests, but the issue persists.
Has anyone faced a similar problem or found a solution? Any guidance would be appreciated!
Here is my script
alias: Video Doorbell Snapshot, Generative AI & Notification
sequence:
- condition: template
value_template: >-
{{ ( as_timestamp(now()) -
as_timestamp(state_attr('automation.video_doorbell_motion_ai_snapshot_notification',
'last_triggered')) | int(0) > 59 )}}
- alias: 1st Snapshot
metadata: {}
data:
filename: ./www/snapshots/video_doorbell_snapshot1.jpg
enabled: true
action: camera.snapshot
target:
entity_id: camera.video_doorbell_fluent
- alias: 1st Delay
delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 500
enabled: true
- alias: 2nd Snapshot
metadata: {}
data:
filename: ./www/snapshots/video_doorbell_snapshot2.jpg
enabled: true
target:
entity_id:
- camera.video_doorbell_fluent
action: camera.snapshot
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 500
alias: 2nd Delay
enabled: true
- alias: 3rd Snapshot
metadata: {}
data:
filename: ./www/snapshots/video_doorbell_snapshot3.jpg
enabled: true
target:
entity_id:
- camera.video_doorbell_fluent
action: camera.snapshot
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 500
alias: 3rd Delay
enabled: true
- metadata: {}
data:
prompt: >-
Motion has been detected, compare and very briefly describe what you see
in the following sequence of images from my video doorbell. What do you
think caused the motion alarm? If a person or car is present, describe
them in detail. Do not describe stationary objects or buildings. If you
see no obvious causes of motion, reply with "Camera has detected motion
however no obvious motion observed comparing snapshots". Your message
needs to be short enough to fit in a phone notification
image_filename:
- ./www/snapshots/video_doorbell_snapshot1.jpg
- ./www/snapshots/video_doorbell_snapshot2.jpg
- ./www/snapshots/video_doorbell_snapshot3.jpg
response_variable: generated_content
action: google_generative_ai_conversation.generate_content
- if:
- condition: template
value_template: |-
{{ generated_content['text'] == ' Camera has detected motion however
no obvious motion observed comparing snapshots.' }}
then:
- stop: ""
else:
- metadata: {}
data:
title: Video Doorbell
message: "\"{{ generated_content['text'] }}\""
data:
image: /local/snapshots/video_doorbell_snapshot2.jpg
action: notify.mobile_app_brads_phone
- delay: 60
mode: single
fields: {}
icon: mdi:cctv
description: ""
max_exceeded: silent
Just as a follow up. I’ve noticed that Google have restricted my API for a possible breach of their standards, This is flagged up when you log into the google Cloud pages. this wont be down to the number of requests though as its way under (a few per hour). I wonder if they are starting to realise all these people are using it for home assistant and blocking it? have you turned anything up yet>
I’ve set up billing on a new API key and from what i can tell… it should cost me pennies per month based on my usage… I’m hoping this gets around what ever we’re meant to of breached.
Same issue out of nowhere - not sure what is causing it. I’ve never even been close to the quota never mind exceeding it.
Requested review from Google, but not holding my breath of hearing anything back, being a low usage free account. More interested what caused it to be suspended and how to prevent it.
Same here - it was reinstated this evening, around 6 hours after my appeal.
[EDIT - Even though the suspended status has disappeared the “Over Quota” error is still occurring despite not even being close to the requests, so no AI description is being generated]
To access the appeal link I logged into my Google Console where there was a banner at the top of the page with message warning me of the potential violation and a “Read More” link. I think it is client specific, but mine started with: https://console.cloud.google.com/appeal
The text of my appeal was:
Hello, I have read through all the documents, including the Gemini API Additional Terms of Service and all the Prohibitions and believe I am not in violation of any of these. I am submitting the footage from my external security cameras which only view publicly visible areas of my house with full consent, and not tracking any individuals. Please could you let me know which part of the policy I seem to be violating as I genuinely can’t determine this. If I am not in clear violation please could you unblock the suspended resources. Thankyou.
I found my notice by signing in at console.cloud.google.com. Click on the “read more” for the appeals page. I just asked “what did I do wrong.” Oddly, the error notice is still there after receiving my “your project has been reinstated” email. I’ll have to wait to see if things are actually working again.
I received another email today and the integration has now resumed working:
Dear Developer, Based on information you provided, and/or further analysis by Google, we have determined your Gemini API project ${project_id} does comply with our policies at this time. We sincerely apologize for any inconvenience this may have caused and thank you for your patience.
I reveved a reply from them in regards to my appeal.
Dear Developer,
Based on information you provided, and/or further analysis by Google, we have determined your Gemini API project ${project_id} does comply with our policies at this time.
We sincerely apologize for any inconvenience this may have caused and thank you for your patience.
I have received this same “violation” notice from Google eight times since I installed this integration. It happens weekly. Four of those violations I appealed and and was reinstated within a day. The other four times I did not appeal, but was still reinstated within a day.
After I first set this integration up, I realized a mistake in my automation and was hitting Google with too many images in a short period of time. I corrected my automation about four weeks ago so that I only send images three or four times a day. Well within quota. I have no idea what Google keeps sending a violation notice every week, almost like clockwork.