Local Python client and CLI for Samsung SmartCam stw-cgi-rest cameras
Project description
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.
-
Update
versioninpyproject.toml. -
Commit the version change.
-
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, andstop - 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file smartcam_local-0.1.0.tar.gz.
File metadata
- Download URL: smartcam_local-0.1.0.tar.gz
- Upload date:
- Size: 19.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7625d79a1d21ea7a77e1f64cad05b4394cafbe22f157d9e1a9032bda3a893064
|
|
| MD5 |
836c8b48975bbff8aa0c4b790f6bb9fe
|
|
| BLAKE2b-256 |
cbf96b5c8bacd74b65a00a1ec4fc76869ab529ce049d0fc635add6859bb01420
|
Provenance
The following attestation bundles were made for smartcam_local-0.1.0.tar.gz:
Publisher:
publish.yml on aeonik/samsung-smartcam-local
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
smartcam_local-0.1.0.tar.gz -
Subject digest:
7625d79a1d21ea7a77e1f64cad05b4394cafbe22f157d9e1a9032bda3a893064 - Sigstore transparency entry: 1553573756
- Sigstore integration time:
-
Permalink:
aeonik/samsung-smartcam-local@089d11438604ec3f89f9269533e0522e9e4555f8 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/aeonik
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@089d11438604ec3f89f9269533e0522e9e4555f8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file smartcam_local-0.1.0-py3-none-any.whl.
File metadata
- Download URL: smartcam_local-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7094218744000c5478eeccc989237866603deb7e62d308d7c28fd76de764d12f
|
|
| MD5 |
abc24401bce003390abf24cfdfcbc2e2
|
|
| BLAKE2b-256 |
354fc00a43f9b8c46f630211e904890561e543980bc3a57b9ce8708dd1d04e44
|
Provenance
The following attestation bundles were made for smartcam_local-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on aeonik/samsung-smartcam-local
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
smartcam_local-0.1.0-py3-none-any.whl -
Subject digest:
7094218744000c5478eeccc989237866603deb7e62d308d7c28fd76de764d12f - Sigstore transparency entry: 1553573760
- Sigstore integration time:
-
Permalink:
aeonik/samsung-smartcam-local@089d11438604ec3f89f9269533e0522e9e4555f8 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/aeonik
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@089d11438604ec3f89f9269533e0522e9e4555f8 -
Trigger Event:
push
-
Statement type: