Frog Wizard

Put a Tapo camera in privacy mode when the router sees my phone

I have a Tapo C225 indoor camera that should record only when nobody is home. Tapo's own home/away switching was unreliable, so I built frogcam. It puts the camera into privacy mode when my router shows that my phone is present.

frogcam is one Docker container on the LAN. Every 30 seconds it asks the TP-Link router for its client list. If my phone's MAC is there, I am home and privacy mode goes on. If the phone has been gone for 5 minutes, privacy mode goes off. The router's client list has been highly reliable compared to Tapo home/away and other forms of detection. No cloud, no phone location, no Home Assistant.

The rest of this post is the specification. It is written so that an agent can rebuild the project from it.

Specification

Build a long-running service, packaged as one Docker container and configured only by environment variables. It watches a TP-Link router for my phone and sets privacy mode on a Tapo camera. Structure, naming, error handling and tests are your call.

Hardware

Behavior

Things you would not guess

Commands

frogcam run                 # the poll loop, default
frogcam devices             # list router clients, to find the MACs
frogcam camera              # show camera info and privacy state
frogcam privacy on|off      # set privacy mode once
frogcam cloud-check EMAIL   # verify the Tapo password without touching the camera

cloud-check exists because testing credentials against the camera spends lockout attempts. It makes one call to the TP-Link cloud instead, and error_code 0 in the response means the password is right:

requests.post("https://wap.tplinkcloud.com/", json={
    "method": "login",
    "params": {
        "appType": "Tapo_Android",
        "cloudUserName": email,
        "cloudPassword": password,
        "terminalUUID": str(uuid.uuid4()),
    },
})

#docker #homelab #python #spec #tapo