Camera.snapshot with Nest cams write zero kb / low quality files

Hey all,

I’m a giant sucker for time-lapses, so I have two automation set up across my three outdoor nest cameras (two regular, one IQ). Both automations have the cameras take a snapshot and save the snapshot to the media folder. One automation tells the cameras to take the snapshot hourly, one tells it to take it daily at the sun’s zenith.

The IQ camera takes the lowest quality photos - they seem to be about 300x300px and around 36kb. All three cameras also seem to have a chance to just… not write the file at all, leaving a bunch of 0kb jpegs in the media folder.

Any ideas?? I’m really bummed out by this - I haven’t checked back in on them in a month so it’s a pretty big letdown to see that it’s not working.

Code for Hourly Snapshots:

- id: '1619107598390'
  alias: Camera - Snapshot  - Front Yard - Hourly
  description: ''
  trigger:
  - platform: time_pattern
    minutes: '29'
  condition: []
  action:
  - service: camera.snapshot
    target:
      entity_id: camera.front_yard_camera
    data:
      filename: /media/cameras/front_yard/hourly/frontyard_hourly_{{ now().strftime("%Y-%m-%d_%H%M")
        }}.jpg
  mode: single

Code for Daily Snapshots:

- id: '1619106744152'
  alias: Camera - Snapshot  - Front Yard - Daily
  description: ''
  trigger:
  - platform: template
    value_template: '{{ is_state_attr(''sun.sun'',''rising'',False) }}'
  condition: []
  action:
  - service: camera.snapshot
    target:
      entity_id: camera.front_yard_camera
    data:
      filename: /media/cameras/front_yard/daily/frontyard_daily_{{ now().strftime("%Y-%m-%d_%H%M")
        }}.jpg
  mode: single

Note: I have all the hourly automation offset by a minute to keep the air clear so not all the cameras are firing at once.

One thought I had: Would it be better to save them remotely instead? Not sure how to write that into the filename part.

Hello, check out the updated media capture APIs associated with events here which may be helpful: Nest - Home Assistant – it won’t let you capture at arbitrary times, compared to the live stream, but can help for specific events.