Skip to content

v0.1.13 - Comprehensive Command API Implementation (2025-12-04)

What Changed?

This release significantly expands the Command class API with full coverage of all device commands defined in help.json. The threshold() and thresholds() methods are now bidirectional (GET/SET), and all remaining device commands have been implemented with consistent, well-documented interfaces. A new reset CLI command has been added that resets device configuration and sets all thresholds to 0.


What's New

Main Feature: Complete Command API Coverage

What it does: The Command class now provides methods for all 12 device commands: help(), status(), version(), poll_count(), deadtime(), uptime(), reset(), mac_address(), buffer_stats(), led(), threshold() (bidirectional), and thresholds() (bidirectional).

How to use it: Call Command methods on any device implementing DeviceProtocol. Each method provides clear, discoverable Python API with comprehensive docstrings.

Code example:

from kazunoko import connect, Command

with connect() as device:
    cmd = Command(device)

    # Get firmware version
    resp = cmd.version()
    print(resp.version)  # "1.9.8"

    # Get or set thresholds
    resp = cmd.threshold(1)  # GET_THRESHOLD
    resp = cmd.threshold(1, 300)  # SET_THRESHOLD

    # Control LED
    resp = cmd.led(1, "on")

    # Reset device and set all thresholds to 0
    resp = cmd.reset()

Installation

Quick Start

# Get the release
git checkout vX.Y.Z

# Setup
task env:setup

# Run CLI
uv run kazunoko --help

What's Different from the Last Version?

✅ Added

  • version() method to get device firmware version (GET_VERSION)
  • poll_count(count) method to set poll count (SET_POLL_COUNT)
  • deadtime(milliseconds) method to set detection deadtime (SET_DEADTIME)
  • uptime() method to get device uptime (UPTIME)
  • reset() method to reset device configuration (RESET)
  • mac_address() method to get device MAC address (GET_MAC_ADDRESS)
  • buffer_stats() method to get detection buffer statistics (GET_BUFFER_STATS)
  • led(channel, state) method to control LEDs (LED command with strict type hints)
  • reset CLI command that resets device and sets all thresholds to 0

🔧 Changed

  • threshold(channel, value) now supports optional value parameter for bidirectional GET/SET operations
  • thresholds(channels) now supports optional channels parameter for bidirectional GET/SET operations
  • Added Literal type hints for strict parameter validation in led() and threshold() methods

⚙️ Infrastructure

  • Added from typing import Literal import to support strict type hints

Is It Safe to Upgrade?

Backward Compatible: Yes

  • All existing methods retain their original behavior
  • threshold() and thresholds() enhancements are backward compatible (optional parameters)
  • New methods add functionality without breaking existing code
  • CLI improvements are backward compatible

Tests Passed

  • ✅ Builds without errors (uv build)
  • ✅ Type checking passes (mypy src/)
  • ✅ Linting passes (ruff check src/)
  • ✅ Pre-commit hooks pass (commitizen conventional commits)

Release Details

  • Date: 2025-12-04
  • Version: v0.1.13
  • Files Changed: 2 (command.py, cli.py)
  • Commits:
  • 6e69748 feat: improve threshold() method to support both GET and SET operations
  • a5005ad refactor: rename thresholds() parameter from channels to thresholds
  • c57c4d9 feat: add version() method to Command class
  • 9ee8287 feat: add poll_count() method to Command class
  • 3cabcfd feat: add uptime() method to Command class
  • 2c22da3 feat: add mac_address() method to Command class
  • 9f38717 feat: add buffer_stats() method to Command class
  • 29345cf feat: add led() method to Command class
  • e27c92a feat: enhance reset command to set thresholds to 0

Next Steps

Future releases should consider: - Adding comprehensive test suite for all Command methods - Implementing async support for high-performance scenarios - Adding batch operation support for setting multiple parameters - Documentation improvements with more real-world usage examples