Skip to content

Add doorlock, intercom, charger, sensors, energy commands and security hardening - #33

Merged
discostu105 merged 6 commits into
mainfrom
claude/explore-mcp-loxone-9Z1ai
Mar 14, 2026
Merged

discostu105 merged 6 commits into
mainfrom
claude/explore-mcp-loxone-9Z1ai

Conversation

@discostu105

@discostu105 discostu105 commented Mar 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

Feature expansion of the lox CLI to cover additional Loxone control types and improve security:

Security & Robustness

  • UUID validation: send_cmd/get_all now validate UUIDs before URL construction, preventing path traversal attacks
  • Stricter is_uuid(): Only hex characters and dashes allowed (was: any string with a dash and len > 20)
  • HTTP retry logic: request_with_retry() with exponential backoff (200ms/400ms/800ms), skips 4xx errors
  • Configurable SSL: New verify_ssl config option and --verify-ssl flag on setup set

New Commands

  • doorlock: lock/unlock/open for DoorLock controls
  • intercom: answer/hangup/open for Intercom controls
  • charger: start/stop/pause with optional --limit for EV chargers
  • sensors: list sensor readings filtered by type (temperature, door-window, motion, smoke)
  • energy: show energy meter readings (Meter, EnergyManager, EnergyMonitor)

Extended Commands

  • music: added next, prev, mute, unmute subcommands
  • alarm: added arm-home mode and --code PIN support for arm/disarm
  • on/off: added --all-in-room flag for room-wide control

Testing

  • 67 tests (up from 62), all passing
  • Tests for UUID validation, path traversal rejection, room-wide resolution
  • Clippy clean, release build verified

Test plan

  • cargo test — 67 tests pass
  • cargo clippy — no warnings
  • cargo build --release — builds successfully
  • Manual test with Miniserver: doorlock, intercom, charger commands
  • Manual test: lox on --all-in-room "Wohnzimmer"
  • Manual test: lox alarm arm --code 1234
  • Manual test: lox music next, lox music mute
  • Manual test: lox sensors --type temperature

https://claude.ai/code/session_01MGpgD2VXRVnNWZoEStcknK

claude and others added 6 commits March 13, 2026 11:31
- Validate UUIDs in send_cmd/get_all to prevent path traversal attacks
- Stricter is_uuid(): only hex chars and dashes allowed
- Add request_with_retry() with exponential backoff (3 attempts)
- Add verify_ssl config option (default: false for self-signed certs)
- Add --verify-ssl flag to setup set command

https://claude.ai/code/session_01MGpgD2VXRVnNWZoEStcknK
…music/alarm

New commands:
- doorlock: lock/unlock/open for DoorLock controls
- intercom: answer/hangup/open for Intercom controls
- charger: start/stop/pause with optional --limit for EV chargers
- sensors: list sensor readings filtered by type (temperature, door-window, motion, smoke)
- energy: show energy meter readings

Extended commands:
- music: add next, prev, mute, unmute subcommands
- alarm: add arm-home mode and --code PIN support for arm/disarm
- on/off: add --all-in-room flag for room-wide control

https://claude.ai/code/session_01MGpgD2VXRVnNWZoEStcknK
- Add tests for resolve_all_in_room (with/without type filter, empty room)
- Add stricter is_uuid tests (reject non-hex, no-dash, human strings)
- Add retry logic test
- Fix clippy wildcard_in_or_patterns warning in sensors command

https://claude.ai/code/session_01MGpgD2VXRVnNWZoEStcknK
- Add type check for Charger/EV controls before executing charger commands
  (matching doorlock/intercom pattern)
- Replace fragile string matching in retry logic with structured
  HttpStatusError downcast for 4xx detection
- Use expect() instead of unwrap() on last_err for clearer panic message

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@discostu105
discostu105 merged commit ac3b027 into main Mar 14, 2026
2 checks passed
@discostu105
discostu105 deleted the claude/explore-mcp-loxone-9Z1ai branch October 29, 2026 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants