Add local token, developer mode, and local pairing endpoints#2112
Merged
Conversation
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).
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.
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.
Contributor
There was a problem hiding this comment.
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
OverkizClientmethods for local token generation/activation/listing/deletion and local pairing (config/{gatewayId}/local/...). - Add
OverkizClientmethods and aDeveloperModemodel for developer mode status/toggling (setup/gateways/{gatewayId}/developerMode). - Add
LocalTokenandDeveloperModemodels 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_token—GET config/{gatewayId}/local/tokens/generateactivate_local_token—POST config/{gatewayId}/local/tokensget_local_tokens—GET config/{gatewayId}/local/tokens/{scope}delete_local_token—DELETE config/{gatewayId}/local/tokens/{uuid}LocalTokenmodel and ascripts/generate_local_token.pyhelper.Local pairing (preview/experimental)
open_local_pairing—POST config/{gatewayId}/local/openPairing(puts the gateway into pairing mode for ~180s).Developer mode (cloud API)
activate_developer_mode—POST setup/gateways/{gatewayId}/developerModeget_developer_mode—GET setup/gateways/{gatewayId}/developerModedeactivate_developer_mode—DELETE setup/gateways/{gatewayId}/developerModePaths and casing follow the bundled API spec (
docs/api/index.html).Tests
TestLocalTokenManagementcovering every new endpoint (request URL + payload).Rexel — confirmed working
Verified against a live Rexel gateway: the Rexel
overkiz/proxy routes the standardsetup/gateways/{id}/developerModepath, 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 eachGatewayCandidate:gateway_id— internal id (sent as thegatewayIdheader viaselect_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; useexternal_idforget_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_mode→DeveloperMode(active=False)✅get_local_tokens→[]✅activate_developer_mode→UnsupportedOperationError: 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 andcheck_responsemaps 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).