---
name: garden-camera
description: "Use when the user asks about 菜园情况, 院子情况, 花园, 偷菜, garden status, yard status. Capture a photo via rpicam-still, save with timestamp, and return the photo with an AI analysis of plant health and garden conditions."
version: 1.0.0
author: Hermes Agent
license: MIT
metadata:
  hermes:
    tags: [garden, camera, rpicam, raspberry-pi, vision, smart-home]
    related_skills: []
---

# Garden Camera — 菜园/院子摄像头

## Overview

Captures a photo from the Raspberry Pi camera using `rpicam-still`, saves it with a timestamp, analyzes the image with vision AI, and returns the photo along with a summary. When triggered via a messaging platform (Telegram, Discord, WeChat via gateway), the photo is automatically delivered as a media attachment.

## When to Use

- User asks: 菜园怎么样 / 院子情况如何 / 花园现在什么状态 / 是否有人偷菜
- User asks: how's the garden / what's the yard look like
- User asks: 拍张院子的照片 / 看看菜地 / 查看花园

## Workflow

### Step 1: Capture the Photo

Run rpicam-still to take a photo. Use a timestamped filename so photos are never overwritten.

```bash
PHOTO_DIR="$HOME/resources/camera-photos"
mkdir -p "$PHOTO_DIR"
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
PHOTO_PATH="$PHOTO_DIR/${TIMESTAMP}.jpg"
rpicam-still -o "$PHOTO_PATH"
```

### Step 2: Verify the Photo

```bash
ls -la "$PHOTO_PATH"
file "$PHOTO_PATH"
```

Confirm the file exists and is a valid JPEG image. If `rpicam-still` fails, report the error to the user and do not proceed.

### Step 3: Analyze with Vision AI

Use the `vision_analyze` tool with the photo path and this prompt:

> "Describe this garden/yard photo in detail. Focus on: Has anyone stolen the vegetables? plant health (any wilting, yellowing, pests?), growth stage, soil moisture appearance, any visible issues or things needing attention, and overall garden condition. Respond in Chinese if the user asked in Chinese."

### Step 4: Report to the User

Combine the vision analysis into a friendly summary. Include:

- Has anyone stolen the vegetable
- Overall garden/yard condition
- Notable observations about plant health
- Any issues that need attention
- The photo path for reference

If the agent is running on a messaging platform (Telegram, Discord, etc.), include `MEDIA:<photo_path>` in the response so the platform delivers the actual photo as an attachment. The gateway will automatically send the image to the user.

Format:
```
📷 菜园快照 — 20260506_143522.jpg

[vision analysis summary...]

MEDIA:/home/ff/resources/camera-photos/20260506_143522.jpg
```

## Alternative: Silent Capture Only

If the user says "just take a photo" or "拍张照就行" without asking for analysis, skip the vision step and just report the file path.

## Common Pitfalls

1. **Using a fixed filename like `test.jpg`** — this overwrites every time. Always timestamp.
2. **Not creating `~/garden-photos/` directory** — rpicam-still will fail if the output dir doesn't exist. Always `mkdir -p` first.
3. **rpicam-still not installed** — if the command is not found, tell the user to install it: `sudo apt install rpicam-apps` (on Raspberry Pi OS Bookworm+).
4. **Camera not detected** — if rpicam-still outputs "no camera found", remind the user to check the ribbon cable connection and enable the camera via `raspi-config`.
5. **Forgetting to include MEDIA: tag** — when triggered from a messaging platform, include `MEDIA:<path>` so the photo is delivered. Without this, the user only gets text.
6. **Low light** — if vision analysis reports a very dark image, mention that lighting may be insufficient and suggest taking another photo during daylight.

## Verification Checklist

- [ ] `rpicam-still` ran without error and produced a valid JPEG
- [ ] Photo saved to `~/garden-photos/garden_<timestamp>.jpg`
- [ ] Vision analysis completed with meaningful observations
- [ ] `MEDIA:` tag included in response for messaging platforms
- [ ] Analysis language matches the user's language (Chinese for 菜园, English for garden)

