| name | smart-home |
| description | Control smart home devices via USB camera + Nature Remo on WSL2. Capture room photos with ffmpeg, analyze with vision, operate lights/AC/TV via Nature Remo Cloud API. Use when asked to check the room, turn lights on/off, adjust AC temperature, or manage home appliances. Also handles the capture→analyze→operate→verify loop. Use when this capability is needed. |
| metadata | {"author":"furoku"} |
Smart Home (Camera + Nature Remo)
Prerequisites
- USB camera attached to WSL via usbipd (
/dev/video0)
- ffmpeg installed
- Nature Remo token at
~/.config/nature-remo/token
- Camera permissions:
sudo chmod 666 /dev/video0 /dev/video1
Check TOOLS.md for device IDs, camera position mapping, and appliance list.
Camera Capture
ffmpeg -f v4l2 -input_format mjpeg -video_size 1920x1080 \
-i /dev/video0 -frames:v 1 -update 1 /tmp/camera.jpg -y
- Use
-vf "vflip" only if camera is mounted upside-down
- If
/dev/video0 missing: camera disconnected, needs re-attach from Windows
- If permission denied:
sudo chmod 666 /dev/video0 /dev/video1
Nature Remo API
Token: TOKEN=$(cat ~/.config/nature-remo/token)
List appliances
curl -s -H "Authorization: Bearer $TOKEN" https://api.nature.global/1/appliances
Light control
curl -s -X POST "https://api.nature.global/1/appliances/{ID}/light" \
-H "Authorization: Bearer $TOKEN" -d "button={on|off|night|on-100}"
AC control
curl -s -X POST "https://api.nature.global/1/appliances/{ID}/aircon_settings" \
-H "Authorization: Bearer $TOKEN" \
-d "operation_mode={warm|cool|auto}&temperature={temp}"
TV control
curl -s -X POST "https://api.nature.global/1/appliances/{ID}/tv" \
-H "Authorization: Bearer $TOKEN" -d "button=power"
Operate→Verify Loop
After any operation, capture a photo to verify the result:
- Execute Nature Remo command
- Wait 1-2 seconds
- Capture photo
- Analyze: confirm the expected change (e.g., "left side darker" = bed light off)
Troubleshooting
| Symptom | Cause | Fix |
|---|
/dev/video0 not found | USB detached | Windows admin: usbipd attach --wsl --busid {ID} |
| Permission denied | Missing permissions | sudo chmod 666 /dev/video0 /dev/video1 |
| Purple/magenta noise | Wrong pixel format | Use -input_format mjpeg |
| Image upside down | Camera orientation | Add/remove -vf "vflip" |
| Nature Remo 404 | Wrong appliance ID | Re-fetch appliance list |
Periodic Observation (git-based state tracking)
For automated room monitoring, use the capture→analyze→diff→commit loop:
- Capture photo:
ffmpeg ... -update 1 /tmp/camera.jpg -y
- Analyze with vision model → generate
state.json (lights, AC, TV, people, room condition)
- Compare with previous
state.json → generate diff.md
git add -A && git commit -m "state: {summary of changes}"
- Report significant changes to Discord
state.json schema
{
"timestamp": "ISO-8601",
"lights": { "living_kitchen": "on|off", ... },
"ac": { "living": { "mode": "warm|cool|auto", "temp": 26 } },
"tv": "on|off",
"people": { "count": 0, "locations": [] },
"room": { "floor_clean": true, "bed_made": false,
Reporting rules
- Changes detected → report diff to Discord
- No changes → commit silently
- Late night (23:00-08:00) → only report urgent issues (all lights on + no people)
Setup Script
Run scripts/setup-check.sh to verify all prerequisites are met.
Converted and distributed by TomeVault — claim your Tome and manage your conversions.