### Start live view server Source: https://github.com/alzgamer-kr/pyneolink/blob/main/README.md Start the live view server using the configuration file. ```powershell python pyneolink/cli.py serve --config config.json ``` -------------------------------- ### Set up local development environment Source: https://github.com/alzgamer-kr/pyneolink/blob/main/README.md Set up a local development environment from a checkout. Creates a virtual environment, activates it, installs requirements, and installs the package in editable mode with dev and voice extras. ```powershell python -m venv .venv .venv\Scripts\activate python -m pip install -r requirements.txt python -m pip install -e ".[dev,voice]" ``` -------------------------------- ### Install pyneolink from PyPI Source: https://github.com/alzgamer-kr/pyneolink/blob/main/README.md Install the pyneolink package from PyPI. This is the standard installation command. ```powershell python -m pip install pyneolink==0.5.0 ``` -------------------------------- ### Start live view server with HLS options Source: https://github.com/alzgamer-kr/pyneolink/blob/main/README.md Start the live view server with custom HLS buffer size and segment duration. Defaults are 100 MB and 2 seconds. ```powershell python pyneolink/cli.py serve --config config.json --hls-buffer-mb 100 --hls-segment-seconds 2 ``` -------------------------------- ### Start StreamServer with dict config Source: https://github.com/alzgamer-kr/pyneolink/blob/main/README.md Starts a live stream server from a dict configuration, binding to 0.0.0.0:8554 and serving the specified camera. The server uses buffer_seconds=1.5, hls_buffer_mb=100, and hls_segment_seconds=2. ```python from pyneolink import StreamServer config = { "bind": "0.0.0.0", "bind_port": 8554, "cameras": [ { "name": "Home-Front", "username": "admin", "password": "password", "uid": "ABCDEF0123456789", "discovery": "relay", } ], } StreamServer(config, buffer_seconds=1.5, hls_buffer_mb=100, hls_segment_seconds=2).serve_forever() ``` -------------------------------- ### Run PyNeolink example scripts Source: https://github.com/alzgamer-kr/pyneolink/blob/main/examples/README.md Run each example script from the repository root. The download test, battery runtime test, stream session probes, and physical smoke test accept command-line options for configuration, camera selection, stream quality, duration, and output behavior. ```powershell python examples/camera_example.py python examples/sd_card_example.py python examples/download_test.py --config config.json --days 2 --quality high --sort desc --max-files 1 python examples/battery_example.py python examples/battery_runtime_test.py --config config.json --camera "Home-Front" --mode motion python examples/battery_runtime_test.py --config config.json --camera "Home-Front" --mode serve --stream high python examples/stream_session_probe.py --config config.json --camera "Home-Front" --stream high --duration 600 --sample-interval 30 python examples/dual_camera_session_probe.py --config config.json --camera "Home-Front" --camera "Home-Back" --stream high --duration 3600 --stagger-seconds 600 python examples/motion_example.py python examples/record_example.py python examples/voice_example.py python examples/settings_example.py python examples/ptz_example.py python examples/stream_example.py python examples/physical_camera_smoke_test.py --config config.json --camera "Home-Front" --debug ``` -------------------------------- ### Run live HTTP server with pyneolink/cli.py serve Source: https://github.com/alzgamer-kr/pyneolink/blob/main/examples/README.md Start the live HTTP server for testing. Opening the camera's HLS URL in VLC starts that camera's stream; other configured cameras remain unopened. Stop the server with Ctrl+C after checking. ```powershell python -u pyneolink/cli.py serve --config config.json --host 127.0.0.1 --port 8565 --debug --buffer-seconds 3 --hls-segment-seconds 4 --hls-buffer-mb 128 ``` -------------------------------- ### Get camera info with Camera context manager Source: https://github.com/alzgamer-kr/pyneolink/blob/main/README.md Opens a camera session and retrieves basic camera information. The context manager starts the internal message dispatcher automatically. ```python from pyneolink import Camera with Camera(uuid="ABCDEF0123456789", username="admin", password="password") as camera: info = camera.info() print(info) ``` -------------------------------- ### Get camera info via CLI Source: https://github.com/alzgamer-kr/pyneolink/blob/main/README.md Get camera info using either the --camera flag with --config or the --info flag. ```powershell python pyneolink/cli.py info --camera "Home-Front" --config config.json python pyneolink/cli.py --info --camera "Home-Front" ``` -------------------------------- ### Install pyneolink with voice support Source: https://github.com/alzgamer-kr/pyneolink/blob/main/README.md Install pyneolink with microphone voice input support. This adds the optional voice dependency. ```powershell python -m pip install "pyneolink[voice]==0.5.0" ``` -------------------------------- ### Serve preview cache over HTTP with preview.serve() Source: https://github.com/alzgamer-kr/pyneolink/blob/main/docs/06-sd-card-downloads.md Serves the cached MP4 over HTTP on port 8560 for players like VLC. The server starts from the beginning of the cache and waits for more bytes if it reaches the end while the camera is still sending. Press Enter to stop the preview. ```python with file.preview(cleanup=True, progress=True) as preview: with preview.serve(port=8560) as server: print(server.url) input("Press Enter to stop preview...") ``` -------------------------------- ### Set up Conda development environment Source: https://github.com/alzgamer-kr/pyneolink/blob/main/README.md Set up a Conda environment for development. Creates a new environment with Python 3.14, activates it, installs requirements and the package in editable mode, then runs the test suite. ```powershell conda create -n pyneolink-dev python=3.14 pip conda activate pyneolink-dev python -m pip install -r requirements.txt python -m pip install -e ".[dev,voice]" python -m pytest ``` -------------------------------- ### Recall PTZ preset with required snapshot Source: https://github.com/alzgamer-kr/pyneolink/blob/main/README.md Lists PTZ presets and recalls preset 3. The tested Argus PT Ultra requires a snapshot exchange after login before it accepts PTZ preset recall; the caller must perform and discard that snapshot in the same session. goto_preset() intentionally has no model-specific side effects and does not start a continuous video stream. ```python from pyneolink import Camera with Camera(uuid="ABCDEF0123456789", username="admin", password="password") as camera: print(camera.ptz().presets()) # Required by the tested Argus PT Ultra before preset recall. camera.snapshot() camera.ptz().goto_preset(3) ``` -------------------------------- ### Take snapshots and record live streams Source: https://github.com/alzgamer-kr/pyneolink/blob/main/README.md Take snapshots and record live streams. The record command saves MPEG-TS; omit --duration to record until Ctrl+C. It does not force the camera to start a new SD-card recording. ```powershell python pyneolink/cli.py snapshot --camera "Home-Front" --out snapshots/ python pyneolink/cli.py record --camera "Home-Front" --out recordings/ --duration 30 --quality high python pyneolink/cli.py record --camera "Home-Front" --out recordings/live.ts --quality low ``` -------------------------------- ### Get next message number Source: https://github.com/alzgamer-kr/pyneolink/blob/main/docs/03-authentication-and-encryption.md Retrieves the next message number for the login request. ```python msg_num = self._next_msg_num() ``` -------------------------------- ### Get motion status Source: https://github.com/alzgamer-kr/pyneolink/blob/main/docs/08-motion-voice-and-controls.md Retrieves the current motion detection status from the camera. The timeout parameter is set to 3.0 seconds. ```python status = camera.motion().status(timeout=3.0) ``` -------------------------------- ### Connect and login with Camera context manager Source: https://github.com/alzgamer-kr/pyneolink/blob/main/docs/02-connection-flow.md Typical usage of the Camera class as a context manager. The __enter__ method calls connect() and login(), after which camera.sock, camera.cipher, and camera.login_xml are ready for commands. ```python with Camera(uuid="ABCDEF0123456789", password="password") as camera: info = camera.info() ``` -------------------------------- ### Create config.json with camera credentials Source: https://github.com/alzgamer-kr/pyneolink/blob/main/README.md Create a local config.json with camera credentials. The file is ignored by Git because it can contain camera credentials. ```json { "bind": "0.0.0.0", "bind_port": 8554, "cameras": [ { "name": "Home-Front", "username": "admin", "password": "password", "uid": "ABCDEF0123456789", "discovery": "relay" } ] } ``` -------------------------------- ### Basic preview cache usage with SDFile.preview() Source: https://github.com/alzgamer-kr/pyneolink/blob/main/docs/06-sd-card-downloads.md Opens a preview stream for a recording, caches the MP4 locally, waits until the cache is ready (timeout 15 seconds), and prints the local path. Use cleanup=True to remove the cache after the context exits. ```python with file.preview(cleanup=True, progress=True) as preview: preview.wait_ready(timeout=15) print(preview.path) ``` -------------------------------- ### Ensure connection and login with ensure_connected Source: https://github.com/alzgamer-kr/pyneolink/blob/main/docs/02-connection-flow.md Ensures connection and login are established on demand. Most public methods like camera.info(), camera.command(), and camera.sd_card() can bring up connection/login automatically. ```python def ensure_connected(self): if self.sock is None: self.connect() if not self.login_xml: self.login() ``` -------------------------------- ### Build login XML Source: https://github.com/alzgamer-kr/pyneolink/blob/main/docs/03-authentication-and-encryption.md Builds the login XML with user and network information. ```xml ... ... 1 LAN 0 ``` -------------------------------- ### Local UDP P2P probe with connect_local_direct Source: https://github.com/alzgamer-kr/pyneolink/blob/main/docs/02-connection-flow.md First connection attempt when uid is present, address and cached_address are not set, and discovery allows UID discovery. Performs a local UDP handshake with the camera through broadcast; on success, self.sock becomes a UdpBcConnection and state is updated with transport="udp-local". ```python connect_local_direct(uid) ``` -------------------------------- ### Record live stream with Camera.record() Source: https://github.com/alzgamer-kr/pyneolink/blob/main/README.md Records the live stream on the client machine as MPEG-TS. With duration, it waits and returns the final Path; without duration, it returns a running StreamRecorder usable as a context manager or with stop(). This does not enable or disable the camera's own SD-card recording. ```python import time from pyneolink import Camera with Camera(uuid="ABCDEF0123456789", username="admin", password="password") as camera: path = camera.record(out="recordings", duration=30, stream="mainStream") print(f"saved to {path}") with camera.record(out="recordings/live.ts", stream="subStream") as recorder: time.sleep(10) print(f"saved to {recorder.path}") ``` -------------------------------- ### SD Card File Listing and Download Source: https://github.com/alzgamer-kr/pyneolink/blob/main/docs/06-sd-card-downloads.md Shows the public entry point for the SD card API: creating an `sd` object, listing files within a date range, printing count and names, downloading with quality and overwrite options, and iterating over filtered files to print metadata. ```python sd = camera.sd_card() files = sd.files(start="2026-06-03", end="2026-06-03") print(files.count(), files.names()) result = files.download("downloads", quality="high", rewrite_exists=False) for video in sd.files(start="2026-06-03", end="2026-06-03", name=".mp4"): print(video.info()["file_name"]) ``` -------------------------------- ### Manage PTZ presets via CLI Source: https://github.com/alzgamer-kr/pyneolink/blob/main/README.md List PTZ presets and recall a preset by number or name. On the tested Argus PT Ultra, the standalone ptz preset command may return 400 because it does not perform the required snapshot warm-up automatically. ```powershell python pyneolink/cli.py ptz --config config.json --camera "Home-Front" presets python pyneolink/cli.py ptz --config config.json --camera "Home-Front" preset 3 python pyneolink/cli.py ptz --config config.json --camera "Home-Front" preset garage ``` -------------------------------- ### Download SD-card videos with SDFileCollection Source: https://github.com/alzgamer-kr/pyneolink/blob/main/README.md Lists SD-card videos, sorts and limits them by size, downloads them, and retries any failed downloads. SdCard.files() returns a list-compatible SDFileCollection; batch download stores only result metadata, so completed media is never retained in RAM. ```python from pyneolink import Camera with Camera(uuid="ABCDEF0123456789", username="admin", password="password") as camera: sd = camera.sd_card() videos = sd.files(start="2026-06-03", end="2026-06-03", name=".mp4") print(videos.count(), videos.names(), videos.size) videos.sort(key="size", reverse=True) videos = videos.limit_size(2 * 1024**3) result = videos.download( "downloads", quality="high", rewrite_exists=False, progress=True, delayed_reconnect_retries=2, delayed_reconnect_delay=120, notify_on_finish=True, ) print(result.info()) failed = result.failed_list() if failed: failed.download("downloads", quality="high", rewrite_exists=False) ``` -------------------------------- ### Control PIR and IR settings Source: https://github.com/alzgamer-kr/pyneolink/blob/main/docs/08-motion-voice-and-controls.md Demonstrates the PIR and IR control API. It retrieves the settings facade, queries PIR and IR status, and toggles PIR on/off and IR on/off/auto. ```python settings = camera.settings() status = settings.pir.status() settings.pir.on() settings.pir.off() ir_status = settings.ir.status() settings.ir.on() settings.ir.off() settings.ir.auto() ``` -------------------------------- ### List and recall PTZ presets with camera.ptz() Source: https://github.com/alzgamer-kr/pyneolink/blob/main/docs/09-ptz-presets.md Lists available PTZ presets and recalls a preset by integer ID or exact case-insensitive name. On the Argus PT Ultra, a snapshot must be taken before recall to avoid a 400 response. ```python presets = camera.ptz().presets() # Required by the tested Argus PT Ultra before preset recall. camera.snapshot() camera.ptz().goto_preset(3) camera.ptz().goto_preset("garage") ``` -------------------------------- ### Take camera snapshot Source: https://github.com/alzgamer-kr/pyneolink/blob/main/README.md Takes a snapshot, either saving it to a directory or returning the image data. ```python from pyneolink import Camera with Camera(uuid="ABCDEF0123456789", username="admin", password="password") as camera: camera.snapshot(out="snapshots") image = camera.snapshot() ``` -------------------------------- ### Record via CLI with --duration and --out Source: https://github.com/alzgamer-kr/pyneolink/blob/main/docs/07-media-and-streaming.md CLI commands to record video from a camera. The first uses --duration to stop after 30 seconds and a directory for output; the second omits --duration, making the CLI catch Ctrl+C to stop the recorder cleanly. --quality selects the stream (high maps to mainStream, low to subStream). ```powershell python pyneolink/cli.py record --camera "Home-Front" --out recordings/ --duration 30 --quality high python pyneolink/cli.py record --camera "Home-Front" --out recordings/live.ts --quality low ``` -------------------------------- ### Configure PIR and IR settings Source: https://github.com/alzgamer-kr/pyneolink/blob/main/README.md Reads and toggles PIR and IR settings, including setting IR to auto mode. ```python from pyneolink import Camera with Camera(uuid="ABCDEF0123456789", username="admin", password="password") as camera: settings = camera.settings() print(settings.pir.status()) settings.pir.on() settings.pir.off() print(settings.ir.status()) settings.ir.on() settings.ir.off() settings.ir.auto() ``` -------------------------------- ### AES IV Source: https://github.com/alzgamer-kr/pyneolink/blob/main/docs/03-authentication-and-encryption.md The initialization vector for AES is 16 zero bytes. ```text b"\x00" * 16 ``` -------------------------------- ### Check motion status via CLI Source: https://github.com/alzgamer-kr/pyneolink/blob/main/README.md Check motion status, optionally watch for a duration. ```powershell python pyneolink/cli.py motion --camera "Home-Front" python pyneolink/cli.py motion --camera "Home-Front" --watch --duration 30 ``` -------------------------------- ### Voice and siren control via CLI Source: https://github.com/alzgamer-kr/pyneolink/blob/main/README.md Play audio file, use microphone, generate tone, or trigger siren. ```powershell python pyneolink/cli.py voice --camera "Home-Front" --file alert.mp3 python pyneolink/cli.py voice --camera "Home-Front" --microphone --seconds 10 python pyneolink/cli.py voice --camera "Home-Front" --tone 1000 --seconds 3 python pyneolink/cli.py voice --camera "Home-Front" --siren ``` -------------------------------- ### Connect via UDP relay with connect_relay Source: https://github.com/alzgamer-kr/pyneolink/blob/main/docs/02-connection-flow.md Opens a UDP P2P channel through the Reolink register/relay infrastructure. The result is also a UdpBcConnection; after success, state is updated with transport="udp-relay". ```python connect_relay(uid) ``` -------------------------------- ### Compute MD5 login credentials Source: https://github.com/alzgamer-kr/pyneolink/blob/main/docs/03-authentication-and-encryption.md Computes the MD5-hashed username and password using the nonce. ```python login_username = md5_hex(username + nonce) login_password = md5_hex(password + nonce) ``` -------------------------------- ### Control IR light and LED via CLI Source: https://github.com/alzgamer-kr/pyneolink/blob/main/README.md Control IR light and LED: check status, turn on/off, or set to auto. ```powershell python pyneolink/cli.py ir --config config.json --camera "Home-Front" status python pyneolink/cli.py ir --config config.json --camera "Home-Front" on python pyneolink/cli.py ir --config config.json --camera "Home-Front" off python pyneolink/cli.py ir --config config.json --camera "Home-Front" auto python pyneolink/cli.py led --config config.json --camera "Home-Front" auto ``` -------------------------------- ### Record video with Camera.record and StreamRecorder Source: https://github.com/alzgamer-kr/pyneolink/blob/main/docs/07-media-and-streaming.md Shows two ways to record video with the Camera object: with a fixed duration (blocks until complete) and without a duration (returns a running recorder that can be stopped manually). The StreamRecorder can be used as a context manager and writes MPEG-TS files locally. ```python import time from pyneolink import Camera with Camera(uuid="ABCDEF0123456789", username="admin", password="password") as camera: path = camera.record(out="recordings", duration=30, stream="mainStream") with camera.record(out="recordings/live.ts", stream="subStream") as recorder: time.sleep(10) ``` -------------------------------- ### Check battery status via CLI Source: https://github.com/alzgamer-kr/pyneolink/blob/main/README.md Check battery status, optionally watch with a specified interval and mode. ```powershell python pyneolink/cli.py battery --camera "Home-Front" python pyneolink/cli.py battery --camera "Home-Front" --watch --interval 60 python pyneolink/cli.py battery --camera "Home-Front" --watch --interval 60 --mode online ``` -------------------------------- ### MTU chunk size limit (text) Source: https://github.com/alzgamer-kr/pyneolink/blob/main/docs/05-udp-p2p-transport.md Shows that sendall() splits Baichuan bytes into chunks up to MTU - UDP_DATA_HEADER_SIZE. ```plaintext MTU - UDP_DATA_HEADER_SIZE ``` -------------------------------- ### Open TCP connection with socket.create_connection Source: https://github.com/alzgamer-kr/pyneolink/blob/main/docs/02-connection-flow.md Opens a TCP Baichuan connection when an explicit address is provided. The default port is 9000 when no port is specified. ```python socket.create_connection((host, port)) ``` -------------------------------- ### Create XML extension with extension_xml() Source: https://github.com/alzgamer-kr/pyneolink/blob/main/docs/04-baichuan-messages.md Shows the XML structure created by `extension_xml()`. Extensions are encrypted separately from payloads; `payload_offset` in the header marks where the extension ends and the payload begins. ```xml 0 ``` -------------------------------- ### Batch download with retry loop Source: https://github.com/alzgamer-kr/pyneolink/blob/main/docs/06-sd-card-downloads.md Downloads files matching a date range and name pattern, then retries failed downloads in a loop until all succeed. Uses DownloadBatchResult methods to inspect and retry failures. ```python files = sd.files(start="2026-09-01", end="2026-09-03", name=".mp4") result = files.download( "downloads", quality="high", rewrite_exists=False, progress=True, reconnect_retries=3, reconnect_delay=5, delayed_reconnect_retries=2, delayed_reconnect_delay=120, notify_on_finish=True, ) print(result.info()) print(result.total_time()) failed = result.failed_list() while failed: retry = failed.download("downloads", quality="high", rewrite_exists=False) failed = retry.failed_list() ``` -------------------------------- ### Send and receive expected reply with camera.send() Source: https://github.com/alzgamer-kr/pyneolink/blob/main/docs/04-baichuan-messages.md Use for normal command flow where a request is sent and the matching reply is awaited. `msg_num` is the correlation id; unmatched packets are ignored until the expected reply arrives or the call times out. ```python msg_num = camera.send(msg_id, payload) reply = camera._recv_expected(msg_num) ``` -------------------------------- ### Control PIR sensor via CLI Source: https://github.com/alzgamer-kr/pyneolink/blob/main/README.md Control PIR sensor: check status, turn on, or turn off. ```powershell python pyneolink/cli.py pir --config config.json --camera "Home-Front" status python pyneolink/cli.py pir --config config.json --camera "Home-Front" on python pyneolink/cli.py pir --config config.json --camera "Home-Front" off ``` -------------------------------- ### Watch motion events with EVENTS.human Source: https://github.com/alzgamer-kr/pyneolink/blob/main/README.md Checks motion status and watches for motion events for 30 seconds, printing when a human is detected and active. ```python from pyneolink import Camera, EVENTS with Camera(uuid="ABCDEF0123456789", username="admin", password="password") as camera: motion = camera.motion() print(motion.status()) with motion.watch(duration=30) as events: for event in events: if event == EVENTS.human and event.active: print("human detected") ``` -------------------------------- ### Read battery status and periodic updates Source: https://github.com/alzgamer-kr/pyneolink/blob/main/README.md Reads battery status once and then subscribes to periodic updates. The second context manager uses interval=60, mode="reconnect", and count=3 to receive three updates. ```python from pyneolink import Camera with Camera(uuid="ABCDEF0123456789", username="admin", password="password") as camera: battery = camera.battery() with battery.info() as info: print(info["level_percent"], info["is_charging"], info["adapter_status"]) with battery.info(interval=60, mode="reconnect", count=3) as updates: for update in updates: print(update["level_percent"], update["adapter_status"]) ``` -------------------------------- ### Remove function placeholder Source: https://github.com/alzgamer-kr/pyneolink/blob/main/docs/06-sd-card-downloads.md Shows the current placeholder implementation for the `remove()` method, which is not yet wired up and raises `NotImplementedError`. ```python raise NotImplementedError(...) ``` -------------------------------- ### Wrap XML payload with xml_document() Source: https://github.com/alzgamer-kr/pyneolink/blob/main/docs/04-baichuan-messages.md Shows the XML document wrapper produced by `xml_document(inner)`. Most camera requests use XML payloads. ```xml ... ``` -------------------------------- ### remote lookup with socket (python) Source: https://github.com/alzgamer-kr/pyneolink/blob/main/docs/05-udp-p2p-transport.md Calls _lookup_with_socket() to send C2M_Q to p2p*.reolink.com:9999 during connect_relay(). ```python _lookup_with_socket() ``` -------------------------------- ### Derive AES key Source: https://github.com/alzgamer-kr/pyneolink/blob/main/docs/03-authentication-and-encryption.md Derives the AES key from the nonce and password. ```python make_aes_key(nonce, password) ``` -------------------------------- ### Binary data extension Source: https://github.com/alzgamer-kr/pyneolink/blob/main/docs/03-authentication-and-encryption.md XML extension indicating binary payload. ```xml 1 ``` -------------------------------- ### HLS timeshift stream URLs Source: https://github.com/alzgamer-kr/pyneolink/blob/main/README.md Open HLS timeshift streams in VLC/ffplay. HLS keeps a sliding in-memory buffer. ```text http://127.0.0.1:8554/Home-Front/high/hls.m3u8 http://127.0.0.1:8554/Home-Front/low/hls.m3u8 ``` -------------------------------- ### discovery packet header layout (text) Source: https://github.com/alzgamer-kr/pyneolink/blob/main/docs/05-udp-p2p-transport.md Lists the fields of the discovery packet header in order: magic, tid, checksum, payload_size. Used for the discovery XML packet format. ```plaintext magic tid checksum payload_size ``` -------------------------------- ### Play voice and trigger siren Source: https://github.com/alzgamer-kr/pyneolink/blob/main/README.md Plays an audio file through the camera's speaker and triggers the siren. ```python from pyneolink import Camera with Camera(uuid="ABCDEF0123456789", username="admin", password="password") as camera: voice = camera.voice() voice.play("alert.mp3") voice.siren() ``` -------------------------------- ### Direct MPEG-TS stream URLs Source: https://github.com/alzgamer-kr/pyneolink/blob/main/README.md Open direct MPEG-TS streams in VLC/ffplay. ```text http://127.0.0.1:8554/Home-Front/high http://127.0.0.1:8554/Home-Front/low ``` -------------------------------- ### Watch motion events Source: https://github.com/alzgamer-kr/pyneolink/blob/main/docs/08-motion-voice-and-controls.md Watches for motion events for a duration of 30 seconds. The context manager yields an iterator of events, each with a type and active flag. ```python with camera.motion().watch(duration=30) as events: for event in events: print(event.type, event.active) ``` -------------------------------- ### AES key derivation formula Source: https://github.com/alzgamer-kr/pyneolink/blob/main/docs/03-authentication-and-encryption.md Formula for deriving the AES key: MD5 hex of nonce and password, truncated to 16 ASCII bytes. ```text md5_hex(nonce + "-" + password)[:16].encode("ascii") ``` -------------------------------- ### Force BC cipher for login message Source: https://github.com/alzgamer-kr/pyneolink/blob/main/docs/03-authentication-and-encryption.md Forces the BC cipher for the login message even when AES is negotiated. ```python if msg_id == MSG.LOGIN: wire_cipher = Cipher("bc") ``` -------------------------------- ### Encode legacy login packet Source: https://github.com/alzgamer-kr/pyneolink/blob/main/docs/03-authentication-and-encryption.md Encodes the legacy login packet with the given message number, username, and maximum encryption mode. ```python encode_legacy_login(msg_num, username, max_encryption="aes") ``` -------------------------------- ### PTZ preset recall XML payload Source: https://github.com/alzgamer-kr/pyneolink/blob/main/docs/09-ptz-presets.md Encrypted XML payload sent to recall a PTZ preset. The request uses the standard channel extension and normal Camera.command() framing/encryption; a response code of 200 indicates acceptance. ```xml 0 3toPos ``` -------------------------------- ### UDP relay address marker Source: https://github.com/alzgamer-kr/pyneolink/blob/main/docs/02-connection-flow.md Special marker returned by _resolve_address() when uid is present and discovery is relay or cellular, indicating the UDP relay path. ```python ("", 0, "udp-relay") ``` -------------------------------- ### Extract encryption mode from response code Source: https://github.com/alzgamer-kr/pyneolink/blob/main/docs/03-authentication-and-encryption.md Extracts the low byte of the response code to determine the encryption mode. ```python mode = reply.header.response_code & 0xFF ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.