← ceesaxp.github.io

PiCam Bot

Wake your Pi camera when you need it. Photos, clips, and motion alerts in Telegram. One switch in Apple Home.

Go Raspberry Pi Telegram HomeKit

Off Until You Need It

A small Go service for Raspberry Pi 4 that controls the Motion camera daemon. Wake the camera, take a snapshot, record a timed clip, or enable motion alerts from Telegram.

In sleep mode, Motion is stopped and the camera device is released. When detection is enabled, completed photos and clips go to your Telegram chat. Audio hooks can capture a USB webcam microphone and pair the audio with motion clips.

Telegram access is restricted to configured sender IDs. The destination chat is saved across restarts, so you do not need to message the bot again before receiving alerts.

A Few Messages Away

Example Telegram conversation
You /run ✅ Camera online. Ready for commands. You /detect ✅ Motion detection enabled. Motion events arrive as photos and clips. You /stop ✅ Camera offline. System sleeping.

Telegram Commands

CommandWhat it does
/runWake the camera, ready for commands.
/snapshotCapture a still image and send it to Telegram.
/record <N>Record 1–300 seconds of video while monitoring.
/detectEnable motion detection and alerts.
/stopdetectPause detection while leaving the camera awake.
/stopStop the camera and cancel an active recording.
/statusShow the current state and uptime.
/helpList the available commands.

One Switch in Apple Home

The optional Camera monitoring switch pairs directly with Apple Home using native HomeKit. No Homebridge is required.

On starts the camera and enables detection, just like /run followed by /detect. Off stops the camera, including any timed recording.

The switch shows On only while detection is active and stays synchronized with Telegram commands. After /stopdetect, it shows Off even though the camera is awake; sending Off still stops it. Enabling detection during a timed recording returns an error.

This is a control switch. Photos and clips are delivered to Telegram; it does not expose a camera feed or HomeKit Secure Video in Apple Home.

Enable HomeKit with HOMEKIT_ENABLED=true and your own eight-digit HOMEKIT_PIN. Pair on the local network and preserve the pairing directory across deployments. Read the pairing instructions →

Run It on Your Pi

Use a Raspberry Pi 4 with a supported camera, Motion, and a Telegram bot token. The repository includes sample Motion configuration, systemd units, audio hook scripts, and deployment targets.

git clone https://github.com/Ceesaxp/picambot.git cd picambot make build-pi

Configure TELEGRAM_TOKEN and ALLOWED_USER_IDS, set up Motion and its service permissions, then deploy. FFmpeg is used for audio muxing. Motion access can use Tailscale; optional HomeKit discovery uses the local network.

Follow the complete setup guide →