Skip to content

Commit 8528ea7

Browse files
committed
docs: Bump version 0.1.1 → 0.1.2
1 parent 30d00c0 commit 8528ea7

3 files changed

Lines changed: 151 additions & 9 deletions

File tree

README.md

Lines changed: 75 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![License](https://img.shields.io/badge/License-MIT-blue)](https://github.com/nirsimetri/onvif-python?tab=MIT-1-ov-file)
44
[![DeepWiki](https://img.shields.io/badge/DeepWiki-AI%20Wiki-orange)](https://deepwiki.com/nirsimetri/onvif-python)
5-
[![PyPI](https://img.shields.io/badge/PyPI-0.1.1-yellow?logo=archive)](https://pypi.org/project/onvif-python/)
5+
[![PyPI](https://img.shields.io/badge/PyPI-0.1.2-yellow?logo=archive)](https://pypi.org/project/onvif-python/)
66
[![Downloads](https://img.shields.io/pypi/dm/onvif-python?label=PyPI%20Downloads)](https://clickpy.clickhouse.com/dashboard/onvif-python)
77
<br>
88
[![Build](https://github.com/nirsimetri/onvif-python/actions/workflows/python-app.yml/badge.svg?branch=main)](https://github.com/nirsimetri/onvif-python/actions/workflows/python-app.yml)
@@ -173,8 +173,8 @@ This library includes a powerful command-line interface (CLI) for interacting wi
173173
<summary><b>1. Direct CLI</b></summary>
174174

175175
```bash
176-
usage: onvif [-h] --host HOST --port PORT [--username USERNAME] [--password PASSWORD] [--timeout TIMEOUT] [--https] [--no-verify] [--no-patch]
177-
[--interactive] [--debug] [--wsdl WSDL] [--cache {all,db,mem,none}]
176+
usage: onvif [-h] [--host HOST] [--port PORT] [--username USERNAME] [--password PASSWORD] [--discover] [--timeout TIMEOUT] [--https] [--no-verify]
177+
[--no-patch] [--interactive] [--debug] [--wsdl WSDL] [--cache {all,db,mem,none}]
178178
[service] [method] [params ...]
179179

180180
ONVIF Terminal Client —
@@ -193,6 +193,7 @@ options:
193193
Username for authentication
194194
--password PASSWORD, -p PASSWORD
195195
Password for authentication
196+
--discover, -d Discover ONVIF devices on the network using WS-Discovery
196197
--timeout TIMEOUT Connection timeout in seconds (default: 10)
197198
--https Use HTTPS instead of HTTP
198199
--no-verify Disable SSL certificate verification
@@ -204,6 +205,11 @@ options:
204205
Caching mode for ONVIFClient (default: all). 'all': memory+disk, 'db': disk-only, 'mem': memory-only, 'none': disabled.
205206

206207
Examples:
208+
# Discover ONVIF devices on network
209+
onvif --discover --username admin --password admin123 --interactive
210+
onvif media GetProfiles --discover --username admin
211+
onvif -d -i
212+
207213
# Direct command execution
208214
onvif devicemgmt GetCapabilities Category=All --host 192.168.1.17 --port 8000 --username admin --password admin123
209215
onvif ptz ContinuousMove ProfileToken=Profile_1 Velocity={"PanTilt": {"x": -0.1, "y": 0}} --host 192.168.1.17 --port 8000 --username admin --password admin123
@@ -319,7 +325,72 @@ If you omit the username or password, you will be prompted to enter them securel
319325
> [!IMPORTANT]
320326
> You can see all the other commands available in the interactive shell by trying it out directly. The interactive shell runs periodic background health checks to detect connection loss. It uses silent TCP pings to avoid interrupting your work and will automatically exit if the device is unreachable, similar to an SSH session.
321327
322-
**2. Direct Command Execution**
328+
**2. Device Discovery (WS-Discovery)**
329+
330+
The CLI includes automatic ONVIF device discovery using the WS-Discovery protocol. This feature allows you to find all ONVIF-compliant devices on your local network without knowing their IP addresses beforehand.
331+
332+
**Discover and Connect Interactively:**
333+
```bash
334+
# Discover devices and enter interactive mode
335+
onvif --discover --username admin --password admin123 --interactive
336+
337+
# Short form
338+
onvif -d -u admin -p admin123 -i
339+
```
340+
341+
**Discover and Execute Command:**
342+
```bash
343+
# Discover devices and execute a command on the selected device
344+
onvif media GetProfiles --discover --username admin --password admin123
345+
346+
# Short form
347+
onvif media GetProfiles -d -u admin -p admin123
348+
```
349+
350+
**How Device Discovery Works:**
351+
352+
1. **Automatic Network Scanning**: Sends a WS-Discovery Probe message to the multicast address `239.255.255.250:3702`
353+
2. **Device Detection**: Listens for ProbeMatch responses from ONVIF devices (default timeout: 4 seconds)
354+
3. **Interactive Selection**: Displays a numbered list of discovered devices with their details:
355+
- Device UUID (Endpoint Reference)
356+
- XAddrs (ONVIF service URLs)
357+
- Device Types (e.g., NetworkVideoTransmitter)
358+
- Scopes (name, location, hardware, profile information)
359+
4. **Connection**: Once you select a device, the CLI automatically connects using the discovered host and port
360+
361+
**Example Discovery Output:**
362+
```
363+
Discovering ONVIF devices on network...
364+
Network interface: 192.168.1.100
365+
Timeout: 4s
366+
367+
Found 2 ONVIF device(s):
368+
369+
[1] 192.168.1.14:2020
370+
[id] uuid:3fa1fe68-b915-4053-a3e1-a8294833fe3c
371+
[xaddrs] http://192.168.1.14:2020/onvif/device_service
372+
[types] tdn:NetworkVideoTransmitter
373+
[scopes] [name/C210] [hardware/C210] [Profile/Streaming] [location/Hong Kong]
374+
375+
[2] 192.168.1.17:8000
376+
[id] urn:uuid:7d04ff31-61e6-11f0-a00c-6056eef47207
377+
[xaddrs] http://192.168.1.17:8000/onvif/device_service
378+
[types] dn:NetworkVideoTransmitter tds:Device
379+
[scopes] [type/NetworkVideoTransmitter] [location/unknown] [name/IPC_123465959]
380+
381+
Select device number 1-2 or q to quit: 1
382+
383+
Selected: 192.168.1.14:2020
384+
```
385+
386+
**Notes:**
387+
388+
- Discovery only works on the local network (same subnet)
389+
- Some networks may block multicast traffic (check firewall settings)
390+
- The `--host` and `--port` arguments are not required when using `--discover`
391+
- You can still provide `--username` and `--password` upfront to avoid prompts
392+
393+
**3. Direct Command Execution**
323394

324395
You can also execute a single ONVIF command directly. This is useful for scripting or quick checks.
325396

README_ID.md

Lines changed: 75 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![License](https://img.shields.io/badge/License-MIT-blue)](https://github.com/nirsimetri/onvif-python?tab=MIT-1-ov-file)
44
[![DeepWiki](https://img.shields.io/badge/DeepWiki-AI%20Wiki-orange)](https://deepwiki.com/nirsimetri/onvif-python)
5-
[![PyPI](https://img.shields.io/badge/PyPI-0.1.1-yellow?logo=archive)](https://pypi.org/project/onvif-python/)
5+
[![PyPI](https://img.shields.io/badge/PyPI-0.1.2-yellow?logo=archive)](https://pypi.org/project/onvif-python/)
66
[![Downloads](https://img.shields.io/pypi/dm/onvif-python?label=PyPI%20Downloads)](https://clickpy.clickhouse.com/dashboard/onvif-python)
77
<br>
88
[![Build](https://github.com/nirsimetri/onvif-python/actions/workflows/python-app.yml/badge.svg?branch=main)](https://github.com/nirsimetri/onvif-python/actions/workflows/python-app.yml)
@@ -173,8 +173,8 @@ Pustaka ini menyertakan antarmuka baris perintah (CLI) yang kuat untuk berintera
173173
<summary><b>1. CLI Langsung</b></summary>
174174

175175
```bash
176-
usage: onvif [-h] --host HOST --port PORT [--username USERNAME] [--password PASSWORD] [--timeout TIMEOUT] [--https] [--no-verify] [--no-patch]
177-
[--interactive] [--debug] [--wsdl WSDL] [--cache {all,db,mem,none}]
176+
usage: onvif [-h] [--host HOST] [--port PORT] [--username USERNAME] [--password PASSWORD] [--discover] [--timeout TIMEOUT] [--https] [--no-verify]
177+
[--no-patch] [--interactive] [--debug] [--wsdl WSDL] [--cache {all,db,mem,none}]
178178
[service] [method] [params ...]
179179

180180
ONVIF Terminal Client —
@@ -193,6 +193,7 @@ options:
193193
Username for authentication
194194
--password PASSWORD, -p PASSWORD
195195
Password for authentication
196+
--discover, -d Discover ONVIF devices on the network using WS-Discovery
196197
--timeout TIMEOUT Connection timeout in seconds (default: 10)
197198
--https Use HTTPS instead of HTTP
198199
--no-verify Disable SSL certificate verification
@@ -204,6 +205,11 @@ options:
204205
Caching mode for ONVIFClient (default: all). 'all': memory+disk, 'db': disk-only, 'mem': memory-only, 'none': disabled.
205206

206207
Examples:
208+
# Discover ONVIF devices on network
209+
onvif --discover --username admin --password admin123 --interactive
210+
onvif media GetProfiles --discover --username admin
211+
onvif -d -i
212+
207213
# Direct command execution
208214
onvif devicemgmt GetCapabilities Category=All --host 192.168.1.17 --port 8000 --username admin --password admin123
209215
onvif ptz ContinuousMove ProfileToken=Profile_1 Velocity={"PanTilt": {"x": -0.1, "y": 0}} --host 192.168.1.17 --port 8000 --username admin --password admin123
@@ -320,7 +326,72 @@ Jika Anda tidak menyertakan nama pengguna atau kata sandi, Anda akan diminta unt
320326
> [!IMPORTANT]
321327
> Anda dapat melihat semua perintah lainnya yang tersedia di shell interaktif dengan mencobanya langsung. Shell interaktif menjalankan pemeriksaan kesehatan latar belakang secara berkala untuk mendeteksi kehilangan koneksi. Shell ini menggunakan ping TCP diam-diam agar tidak mengganggu pekerjaan Anda dan akan otomatis keluar jika perangkat tidak dapat dijangkau, mirip dengan sesi SSH.
322328
323-
**2. Eksekusi Perintah Langsung**
329+
**2. Penemuan Perangkat (WS-Discovery)**
330+
331+
CLI menyertakan fitur penemuan perangkat ONVIF otomatis menggunakan protokol WS-Discovery. Fitur ini memungkinkan Anda menemukan semua perangkat yang sesuai dengan ONVIF di jaringan lokal Anda tanpa perlu mengetahui alamat IP mereka terlebih dahulu.
332+
333+
**Temukan dan Terhubung Secara Interaktif:**
334+
```bash
335+
# Temukan perangkat dan masuk ke mode interaktif
336+
onvif --discover --username admin --password admin123 --interactive
337+
338+
# Bentuk singkat
339+
onvif -d -u admin -p admin123 -i
340+
```
341+
342+
**Temukan dan Eksekusi Perintah:**
343+
```bash
344+
# Temukan perangkat dan eksekusi perintah pada perangkat yang dipilih
345+
onvif media GetProfiles --discover --username admin --password admin123
346+
347+
# Bentuk singkat
348+
onvif media GetProfiles -d -u admin -p admin123
349+
```
350+
351+
**Cara Kerja Penemuan Perangkat:**
352+
353+
1. **Pemindaian Jaringan Otomatis**: Mengirim pesan WS-Discovery Probe ke alamat multicast `239.255.255.250:3702`
354+
2. **Deteksi Perangkat**: Mendengarkan respons ProbeMatch dari perangkat ONVIF (timeout default: 4 detik)
355+
3. **Pemilihan Interaktif**: Menampilkan daftar bernomor dari perangkat yang ditemukan dengan detail mereka:
356+
- UUID Perangkat (Endpoint Reference)
357+
- XAddrs (URL layanan ONVIF)
358+
- Tipe Perangkat (mis., NetworkVideoTransmitter)
359+
- Scopes (informasi nama, lokasi, hardware, profil)
360+
4. **Koneksi**: Setelah Anda memilih perangkat, CLI otomatis terhubung menggunakan host dan port yang ditemukan
361+
362+
**Contoh Output Penemuan:**
363+
```
364+
Discovering ONVIF devices on network...
365+
Network interface: 192.168.1.100
366+
Timeout: 4s
367+
368+
Found 2 ONVIF device(s):
369+
370+
[1] 192.168.1.14:2020
371+
[id] uuid:3fa1fe68-b915-4053-a3e1-a8294833fe3c
372+
[xaddrs] http://192.168.1.14:2020/onvif/device_service
373+
[types] tdn:NetworkVideoTransmitter
374+
[scopes] [name/C210] [hardware/C210] [Profile/Streaming] [location/Hong Kong] [type/NetworkVideoTransmitter]
375+
376+
[2] 192.168.1.17:8000
377+
[id] urn:uuid:7d04ff31-61e6-11f0-a00c-6056eef47207
378+
[xaddrs] http://192.168.1.17:8000/onvif/device_service
379+
[types] dn:NetworkVideoTransmitter tds:Device
380+
[scopes] [type/NetworkVideoTransmitter] [location/unknown] [name/IPC_123465959]
381+
382+
Select device number 1-2 or q to quit: 1
383+
384+
Selected: 192.168.1.14:2020
385+
```
386+
387+
**Catatan:**
388+
389+
- Penemuan hanya bekerja di jaringan lokal (subnet yang sama)
390+
- Beberapa jaringan mungkin memblokir lalu lintas multicast (periksa pengaturan firewall)
391+
- Argumen `--host` dan `--port` tidak diperlukan saat menggunakan `--discover`
392+
- Anda masih dapat memberikan `--username` dan `--password` di awal untuk menghindari prompt
393+
394+
**3. Eksekusi Perintah Langsung**
324395

325396
Anda juga dapat mengeksekusi satu perintah ONVIF secara langsung. Ini berguna untuk skrip atau pengecekan cepat.
326397

onvif/cli/interactive.py

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)