Skip to main content

Samsung SmartCam Local

Local Python client and CLI for Samsung SmartCam cameras that expose the stw-cgi-rest API.

This project is for people keeping older SmartCam hardware useful after cloud app support changed or disappeared. It talks directly to the camera on your LAN with HTTP Digest authentication. It does not use Samsung cloud services and does not include proprietary vendor materials, firmware, or private infrastructure details.

Status

Early but usable. PTZ has been tested against:

  • SNH-V6410PN
  • firmware 1.18_180413

Other Samsung SmartCam models may work if they expose the same local /stw-cgi-rest/... endpoints. Please open issues with model, firmware, and which commands work or fail.

Features

  • Zero runtime dependencies.
  • HTTP Digest auth implemented with the Python standard library.
  • CLI for one-off control and scripting.
  • Python API for Home Assistant custom integrations, HACS projects, Scrypted helpers, or local automation.
  • PTZ continuous move, timed nudge, stop, relative move, and preset recall.
  • Read-only device, network, image, and flip status calls.

Install

From PyPI:

python3 -m pip install smartcam-local

From a checkout:

python3 -m pip install -e .

Release

Releases publish to PyPI through GitHub Actions and PyPI Trusted Publishing.

  1. Update version in pyproject.toml.

  2. Commit the version change.

  3. Push a matching tag:

    git tag v0.1.0
    git push origin v0.1.0
    

The publish workflow builds the source distribution and wheel, checks package metadata, then publishes to PyPI from the protected pypi environment.

CLI Quick Start

The camera username is usually admin.

Prompt for the password:

smartcam-local --host 192.168.1.50 ptz down --duration 0.5

Use an environment variable:

export SMARTCAM_PASSWORD='your camera password'
smartcam-local --host 192.168.1.50 info

Use a local password manager command without invoking a shell:

smartcam-local --host 192.168.1.50 --password-command 'pass show home/camera' ptz stop

PTZ examples:

smartcam-local --host 192.168.1.50 ptz up --duration 0.4
smartcam-local --host 192.168.1.50 ptz left --duration 0.8
smartcam-local --host 192.168.1.50 ptz stop
smartcam-local --host 192.168.1.50 move --pan 0 --tilt -1 --duration 0.6
smartcam-local --host 192.168.1.50 relative down
smartcam-local --host 192.168.1.50 preset 1

Read-only examples:

smartcam-local --host 192.168.1.50 info
smartcam-local --host 192.168.1.50 network
smartcam-local --host 192.168.1.50 image
smartcam-local --host 192.168.1.50 flip

Python API

from smartcam_local import SmartCamClient

camera = SmartCamClient(
    host="192.168.1.50",
    username="admin",
    password="camera-password",
)

print(camera.device_info())

# Timed continuous movement: move, sleep, stop.
camera.nudge("down", duration=0.5)

# Low-level PTZ calls are available too.
camera.continuous_move(pan=0, tilt=-1)
camera.stop()
camera.relative_move(pan=0, tilt=1)
camera.goto_preset(1)

Supported Local Endpoints

The following routes are implemented:

GET /stw-cgi-rest/system/deviceinfo
GET /stw-cgi-rest/network/interface
GET /stw-cgi-rest/image/camera
GET /stw-cgi-rest/image/flip

PUT /stw-cgi-rest/ptzcontrol/continuous
PUT /stw-cgi-rest/ptzcontrol/relative
PUT /stw-cgi-rest/ptzcontrol/preset

Continuous PTZ payloads use:

{"Channel":0,"Pan":0,"Tilt":-1}

Observed movement values:

Direction Pan Tilt
stop 0 0
left -1 0
right 1 0
up 0 1
down 0 -1

Continuous movement behaves like press-and-hold: send a direction, wait briefly, then send stop. The CLI and SmartCamClient.nudge() do this for you.

Password Safety

Avoid putting camera passwords in RTSP URLs, shell history, scripts, or issue reports. Prefer one of:

  • interactive prompt
  • SMARTCAM_PASSWORD
  • --password-file
  • --password-command, such as a password manager command

The CLI runs --password-command with shlex.split() and subprocess, not through a shell.

Home Assistant Integration Notes

This package is intentionally small so a Home Assistant integration can depend on it or vendor it. A useful first integration surface would be:

  • camera entity using the existing RTSP stream URL configured by the user
  • PTZ actions for up, down, left, right, and stop
  • preset recall actions
  • sensors for model, firmware, network, day/night, and flip state

The API is synchronous today. A future Home Assistant integration may want an async wrapper or native async client.

Clean-Room Boundary

This repository contains original code and compatibility notes derived from observed device behavior. Do not commit proprietary vendor materials, camera credentials, private network hostnames, private IPs, jump boxes, or infrastructure details.

Development

Run tests:

PYTHONPATH=src python3 -m unittest discover -s tests

Run the CLI from source:

PYTHONPATH=src python3 -m smartcam_local --host 192.168.1.50 info

License

Original code in this repository is licensed under the Apache License 2.0.

This project is independent and is not affiliated with Samsung, Hanwha Vision, or Wisenet. Product names and trademarks belong to their respective owners.

Metadata

Release files for smartcam-local 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for smartcam-local 0.1.0
File Size Uploaded Provenance Actions
smartcam_local-0.1.0.tar.gz 19.4 kB With provenance Details for smartcam_local-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for smartcam-local 0.1.0
File Interpreter ABI Platform Actions
smartcam_local-0.1.0-py3-none-any.whl Python 3 none any Details for smartcam_local-0.1.0-py3-none-any.whl

Total release size: 37.6 kB

Release files / smartcam_local-0.1.0.tar.gz

Download URL smartcam_local-0.1.0.tar.gz
Size 19.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7625d79a1d21ea7a77e1f64cad05b4394cafbe22f157d9e1a9032bda3a893064
BLAKE2b-256 checksum
How to use checksums
cbf96b5c8bacd74b65a00a1ec4fc76869ab529ce049d0fc635add6859bb01420
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 16, 2026.

Transparency log

Release files / smartcam_local-0.1.0-py3-none-any.whl

Download URL smartcam_local-0.1.0-py3-none-any.whl
Size 18.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7094218744000c5478eeccc989237866603deb7e62d308d7c28fd76de764d12f
BLAKE2b-256 checksum
How to use checksums
354fc00a43f9b8c46f630211e904890561e543980bc3a57b9ce8708dd1d04e44
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 16, 2026.

Transparency log

Security for smartcam-local 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for smartcam_local-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page