Skip to content

Add local token, developer mode, and local pairing endpoints#2112

Merged
iMicknl merged 10 commits into
mainfrom
feat/local-token-developer-mode
Jun 4, 2026
Merged

Add local token, developer mode, and local pairing endpoints#2112
iMicknl merged 10 commits into
mainfrom
feat/local-token-developer-mode

Conversation

@iMicknl
Copy link
Copy Markdown
Owner

@iMicknl iMicknl commented Jun 1, 2026

Summary

Re-introduces the cloud-API endpoints for managing local gateway access, plus developer mode and local pairing controls.

Local token management (cloud API)

  • generate_local_tokenGET config/{gatewayId}/local/tokens/generate
  • activate_local_tokenPOST config/{gatewayId}/local/tokens
  • get_local_tokensGET config/{gatewayId}/local/tokens/{scope}
  • delete_local_tokenDELETE config/{gatewayId}/local/tokens/{uuid}
  • Adds the LocalToken model and a scripts/generate_local_token.py helper.

Local pairing (preview/experimental)

  • open_local_pairingPOST config/{gatewayId}/local/openPairing (puts the gateway into pairing mode for ~180s).

Developer mode (cloud API)

  • activate_developer_modePOST setup/gateways/{gatewayId}/developerMode
  • get_developer_modeGET setup/gateways/{gatewayId}/developerMode
  • deactivate_developer_modeDELETE setup/gateways/{gatewayId}/developerMode

Paths and casing follow the bundled API spec (docs/api/index.html).

Tests

  • Adds TestLocalTokenManagement covering every new endpoint (request URL + payload).
  • Full suite: 518 passed, ruff + mypy clean.

Rexel — confirmed working

Verified against a live Rexel gateway: the Rexel overkiz/ proxy routes the standard setup/gateways/{id}/developerMode path, so no Rexel-specific code is needed — the generic methods work as-is.

One caller-side caveat: Rexel surfaces two ids. discover_gateways() returns both on each GatewayCandidate:

  • gateway_id — internal id (sent as the gatewayId header via select_gateway()).
  • external_id — the Overkiz serial (e.g. 0201-0012-0000), which is what must go in the URL path.

Passing the internal id in the path fails with AccessDeniedToGatewayError; use external_id for get_developer_mode / get_local_tokens / etc. Sample call returned {'active': False} and an empty token list as expected.

🤖 Generated with Claude Code

Live validation (Rexel)

Tested against a live Rexel gateway (0201-0012-0000):

  • get_developer_modeDeveloperMode(active=False)
  • get_local_tokens[]
  • activate_developer_modeUnsupportedOperationError: Developer mode activation not supported for gateway #...

The activate result is the server's answer, not a client bug — the path routes correctly through the Rexel overkiz/ proxy and check_response maps it to the right typed exception. Developer mode toggling appears unsupported on (at least some) Rexel gateways, which makes sense given Rexel uses JWT/proxy-based access rather than local developer-mode tokens. The endpoints remain correct for servers that do support it (e.g. Somfy).

iMicknl added 3 commits June 1, 2026 09:29
Re-introduces the cloud API endpoints for managing local gateway tokens:
- generate_local_token: POST config/{gatewayId}/local/tokens/generate
- activate_local_token: POST config/{gatewayId}/local/tokens
- get_local_tokens: GET config/{gatewayId}/local/tokens/{scope}
- delete_local_token: DELETE config/{gatewayId}/local/tokens/{uuid}

Adds LocalToken model and a test script for Atlantic Cozytouch.
- open_local_pairing: POST config/{gatewayId}/local/openPairing
  Puts gateway into pairing mode for ~180s (Atlantic/Cozytouch)
- activate_developer_mode: POST setup/gateways/{gatewayId}/developerMode
  Enables local API access (Somfy)
- get_developer_mode: GET setup/gateways/{gatewayId}/developerMode
  Checks developer mode status
- deactivate_developer_mode: DELETE setup/gateways/{gatewayId}/developerMode
  Mirrors activate/get_developer_mode using the path/casing from the
  bundled API spec (docs/api/index.html).
- Add TestLocalTokenManagement covering token generate/activate/get/delete,
  open_local_pairing, and the developer mode endpoints (URL + payload).
iMicknl added 2 commits June 1, 2026 09:56
Drop the Atlantic/Cozytouch (SmartKiz) attribution and flag the endpoint
as preview since its behaviour is not yet fully validated.
Walks through the Rexel OAuth2 + PKCE sign-in, then calls
get_developer_mode and get_local_tokens for the selected gateway.
Useful for confirming which API surface Rexel exposes developer mode on.
Comment thread scripts/rexel_developer_mode.py Fixed
Comment thread scripts/rexel_developer_mode.py Fixed
iMicknl added 5 commits June 1, 2026 10:02
Drop the local experimentation helper from the PR.
The endpoint returns {"active": bool} (confirmed via bundled spec and a
live Rexel gateway). Add a DeveloperMode model and structure the response
instead of returning Any.
Live gateway testing showed the DELETE on setup/gateways/{id}/developerMode
is rejected (NoSuchResourceError) and it is not in the bundled API spec.
Flag it as preview rather than removing it.
@iMicknl iMicknl marked this pull request as ready for review June 4, 2026 15:04
@iMicknl iMicknl requested a review from tetienne as a code owner June 4, 2026 15:04
Copilot AI review requested due to automatic review settings June 4, 2026 15:04
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reintroduces cloud-API support in OverkizClient for managing gateway local tokens, controlling developer mode, and opening local pairing, along with new response models and unit tests for the added endpoints.

Changes:

  • Add OverkizClient methods for local token generation/activation/listing/deletion and local pairing (config/{gatewayId}/local/...).
  • Add OverkizClient methods and a DeveloperMode model for developer mode status/toggling (setup/gateways/{gatewayId}/developerMode).
  • Add LocalToken and DeveloperMode models plus unit tests validating request URLs and payloads.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
pyoverkiz/client.py Adds new client methods for local token management, local pairing, and developer mode endpoints.
pyoverkiz/models.py Introduces LocalToken and DeveloperMode attrs models for structured API responses.
tests/test_client.py Adds unit tests validating request paths/payloads for each newly added endpoint.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pyoverkiz/client.py
Comment thread pyoverkiz/client.py
@iMicknl iMicknl merged commit 7c7d82e into main Jun 4, 2026
10 checks passed
@iMicknl iMicknl deleted the feat/local-token-developer-mode branch June 4, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants