Skip to content
프로젝트

소개

Unofficial asynchronous Python library and command-line tools for Arlo cameras, doorbells, lights, and security systems. Powers the Aarlo Home Assistant integration.

보안 및 개인정보 보호

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

PyArlo

License: LGPL v3 Python 3.10+

An asynchronous Python library and command-line automation toolkit for Netgear/Arlo security cameras, doorbells, lights, sensors, and base stations.


⚠️ Beta Release Notice (v0.9.0-beta)

PyArlo v0.9 is a major rewrite transitioning the entire codebase from legacy synchronous threads to native Python asyncio.

This is an active beta release — please test, report issues, and verify hardware compatibility.

Note on Hardware Testing: The maintainer does not own or have access to every Arlo hardware model (such as all generations of cameras, floodlights, doorbells, chimes, and SmartHubs) and cannot test every permutation. Community testing and feedback are essential to stabilizing this release!

If you encounter issues, regressions, or unexpected behavior with your hardware, please open a GitHub issue. Please include your Python version, Arlo device models, and sanitized/encrypted debug logs generated with --debug-report.

If you need the legacy synchronous documentation for PyArlo v0.8, it is archived in docs/README_v8.md.


Table of Contents


Breaking Changes in v0.9

If you are upgrading from PyArlo 0.8.x, please note the following architectural changes:

  1. Native asyncio Core:
    • PyArlo must be initialized with the asynchronous factory await PyArlo.create(...). The synchronous PyArlo(...) constructor is deprecated.
    • All network and device actions are now coroutines and must be awaited (e.g. await light.turn_on(), await location.set_mode(), await arlo.stop()).
  2. synchronous_mode renamed to inline_mode:
    • inline_mode=True tells PyArlo to wait for an operation's response or event acknowledgment inline before returning.
    • Legacy synchronous_mode remains as a deprecated alias.
  3. Execution & Startup Optimizations:
    • start_background=False: Fast one-shot mode that skips connecting to persistent MQTT/SSE event streams and cron loops.
    • refresh_devices=False: Skips querying /users/devices and reuses locally cached device definitions.
    • Optimistic token reuse: Valid session tokens are reused directly without making redundant network calls to /api/validateAccessToken.
  4. CLI Reorganization:
    • The CLI has been split into three purpose-built tools: pyaarlo, pyaarlo-monitor, and pyaarlo-utils.

Installation

Requires Python >= 3.10.

# Install latest release from git
pip install git+https://github.com/twrecked/pyaarlo.git

# Or install locally in editable mode for development
git clone https://github.com/twrecked/pyaarlo.git
cd pyaarlo
pip install -e .

Command Line Interface (CLI)

PyArlo provides three command-line tools:

1. pyaarlo — Device Actions & Automations

Perform instant actions on your devices with sub-second response times:

# Check token status and expiration
pyaarlo login --status

# Interactive configuration wizard (creates or updates ~/.config/pyaarlo/config.json)
pyaarlo config create
pyaarlo config update
pyaarlo config show

# Authenticate or refresh tokens (supports push, email:imap, sms)
pyaarlo login --push

# Control lights by name or ID
pyaarlo light turn-on "Side Light"
pyaarlo light turn-on --brightness 128 "Side Light"
pyaarlo light turn-off "Side Light"

# Security modes
pyaarlo location list
pyaarlo location set-mode "armHome"

# Media library
pyaarlo media list --days 1 --compact
pyaarlo media list --object animal
pyaarlo media download --limit 5 -o ./media

# Local storage (RATLS direct USB/SD access on SmartHub / Base Station)
pyaarlo local-media status "Front Base"
pyaarlo local-media list --base "Front Base" --compact
pyaarlo local-media download --base "Front Base" --limit 5 -o ./local_media

# List devices and status
pyaarlo list devices --compact

2. pyaarlo-monitor — Real-Time Event Stream

Observe incoming live events (motion, doorbell rings, battery, mode changes):

# Stream live events
pyaarlo-monitor --compact

# Filter by camera and truncate long payloads
pyaarlo-monitor --filter-device "Front Door Bell" -l 60

# Stream events formatted as JSON lines
pyaarlo-monitor --json

3. pyaarlo-utils — Diagnostic Tools

# Dump raw device dictionaries
pyaarlo-utils dump lights

# Anonymize logs and encrypt for GitHub issue reporting
cat error.log | pyaarlo-utils anonymize | pyaarlo-utils encrypt > error.log.enc

👉 See docs/cli.md for full configuration, arguments, and options.


Using the Python Module

import asyncio
from pyaarlo import PyArlo

async def main():
    # Initialize the PyArlo controller
    arlo = await PyArlo.create(
        username="[email protected]",
        password="your-password",
        tfa="push",
    )

    try:
        # Access devices
        for cam in arlo.cameras:
            print(f"Camera: {cam.name} (Battery: {cam.battery_level}%)")

        for light in arlo.lights:
            if not light.is_on:
                await light.turn_on(brightness=200)

        # Set location mode
        if arlo.locations:
            await arlo.locations[0].set_mode("armHome")

    finally:
        # Cleanly stop background tasks and connections
        await arlo.stop(logout=False)

if __name__ == "__main__":
    asyncio.run(main())

Subscribing to Live Events

def on_event(device, attr, value):
    print(f"[{device.name}] {attr} -> {value}")

# Subscribe to motion on a camera
camera.add_attr_callback("motionDetected", on_event)

# Subscribe to doorbell presses
doorbell.add_attr_callback("ding", on_event)

# Subscribe to all events on a device
camera.add_attr_callback("*", on_event)

👉 See docs/api.md for detailed API documentation and one-shot execution patterns.


Two-Factor Authentication (2FA)

PyArlo supports three primary 2FA methods:

1. Push Notification (push) — Recommended

When logging in, Arlo sends a push notification to your trusted mobile device. PyArlo waits for you to tap "Approve".

  • CLI: pyaarlo login --push or export ARLO_TFA="push"
  • Python:
    arlo = await PyArlo.create(username="...", password="...", tfa="push")
    

2. Email via IMAP (email:imap) — Automated

PyArlo connects to your email account over IMAP and automatically reads the verification code from the email sent by Arlo.

  • CLI:
    pyaarlo login --tfa email:imap --tfa-host imap.gmail.com --tfa-user [email protected] --tfa-pass "app-password"
    
  • Python:
    arlo = await PyArlo.create(
        username="...", password="...",
        tfa="email:imap",
        tfa_host="imap.gmail.com", tfa_username="...", tfa_password="..."
    )
    

3. Interactive Console (email:console or sms)

PyArlo requests Arlo to send a code via email or SMS, and prompts you to type the code into the terminal.

  • CLI: pyaarlo login --tfa sms or pyaarlo login --tfa email:console
  • Python:
    arlo = await PyArlo.create(username="...", password="...", tfa="sms")
    

Choosing the factor

Arlo calls each 2FA destination a factor: an email address, a phone number, or a phone running the Arlo app. By default PyArlo picks one by matching the tfa type and then tfa_nickname. When the account has several factors of the same type, two phones for example, name the one you want with tfa_factor_id; it wins over both.

  • CLI: pyaarlo tfa-factors lists the ids, then pyaarlo login --factor-id <id> or export ARLO_TFA_FACTOR_ID="<id>"
  • Python:
    for factor in await arlo.tfa_factors():
        print(factor["factorType"], factor["factorNickname"], factor["factorId"])
    
    arlo = await PyArlo.create(username="...", password="...", tfa_factor_id="<id>")
    

The flow follows the factor: a PUSH factor always waits for the approval on the phone, whatever tfa says. PyArlo waits up to 5 minutes for the approval, like the Arlo web app, and stops straight away if you tap deny. Tune it with tfa_push_timeout and tfa_push_poll.

Step by step login for setup screens (ArloLogin)

A setup UI can show the user their real factors and let them choose, instead of asking which 2FA method to use up front. ArloLogin only logs in; it doesn't read devices or start the event stream.

from pyaarlo import ArloLogin, LoginStep

login = ArloLogin(username="...", password="...", storage_dir=STORAGE_DIR)
step = await login.start()
if step == LoginStep.NEEDS_FACTOR:
    step = await login.choose_factor(pick_one(login.factors)["factorId"])
while step == LoginStep.AWAITING_PUSH:
    await asyncio.sleep(login.push_poll)
    step = await login.poll_push()
if step == LoginStep.AWAITING_CODE:
    step = await login.submit_code(input("Code: "))
await login.close()

On SUCCESS the session and cookies are saved in storage_dir and Arlo trusts this "browser". A later PyArlo.create() with the same username, storage_dir and user_agent reuses them and doesn't need 2FA again until the trust expires.

PyArlo keeps presenting the user agent a browser was paired with, as long as the user_agent setting doesn't change, so random no longer throws the trust away on every login.


Operational Notes & Recommendations

Choosing an Event Stream Backend (MQTT vs. SSE)

PyArlo supports two streaming backends for real-time device updates:

  1. MQTT (mqtt) — Default:
    • Modern, lightweight WebSocket protocol used by Arlo's official mobile apps.
    • Supports multiple concurrent connections: you can run pyaarlo-monitor in one terminal while running action commands or scripts in another without interrupting your session.
    • Limitation: Arlo does not publish every legacy event type (such as stream snapshot notifications) over MQTT.
  2. SSE (sse) — Legacy:
    • HTTP Server-Sent Events stream (/subscribe).
    • Emits a broader range of legacy event types (like stream snapshots).
    • Limitation: Arlo restricts SSE to a single active connection per account. Opening a second stream will disconnect the first. You can select it with --backend sse or --sse on pyaarlo-monitor.

Dedicated Arlo Account Recommendation

Even though MQTT allows concurrent event streams with your primary mobile app without immediately logging you out, we strongly recommend creating a separate, dedicated Arlo account and sharing your cameras/devices to it:

  • Security & Least Privilege: Protects your primary account credentials and limits access strictly to the shared devices.
  • Session Stability: Prevents token refresh races and conflicting login state between automation scripts, Home Assistant, and your mobile phone app.

Diagnostics & Error Reporting

Automated Debug Report (--debug-report)

You can append --debug-report to any pyaarlo command. It automatically records all debug logs, anonymizes sensitive tokens/passwords, and encrypts the diagnostic package using PyArlo's public key:

pyaarlo --debug-report light turn-on "Side Light"
pyaarlo --debug-report login

This writes pyaarlo-debug-report.enc, which you can safely attach directly to a GitHub Issue.

Enabling Verbose Logs

Pass -v (INFO) or -vv (DEBUG) to any CLI tool, or enable debug logging in Python:

import logging
logging.basicConfig(level=logging.DEBUG)

Anonymizing & Encrypting Diagnostics for Issues

To safely report bugs without exposing personal credentials, device IDs, or tokens:

# Anonymize account identifiers and encrypt using PyArlo's public key
cat trace.log | pyaarlo-utils anonymize | pyaarlo-utils encrypt > trace.log.enc

You can paste the resulting -----BEGIN PYAARLO DUMP----- block directly into a GitHub Issue. Only the repository maintainers holding the private key can decrypt it.

Recording Browser Traffic (.har)

If troubleshooting unexpected Arlo web changes:

  1. Open my.arlo.com in Chrome/Firefox.
  2. Open Developer Tools (F12), switch to the Network tab, and check Preserve log.
  3. Perform the action (e.g. view stream, arm device, toggle light).
  4. Right-click any network request and select Save all as HAR with content.
  5. Anonymize and encrypt the .har file using pyaarlo-utils before sharing.

Documentation Links


Credits

Special thanks to:

  • Edwin Anne for reverse-engineering the SIP/WebRTC signaling protocol and contributing the foundational SDP repairs and SIP client (PR #210).
  • Pyarlo and Arlo for the original foundational reverse-engineering work.
  • JetBrains for their past support providing open source development licenses throughout most of the v0.8 releases.

관련 프로젝트 살펴보기

불러오는 중…