Fix provisioning for modern Dataplicity API, Python 3.14, reverse-proxy hack#51
Open
alex-mextner wants to merge 2 commits into
Open
Fix provisioning for modern Dataplicity API, Python 3.14, reverse-proxy hack#51alex-mextner wants to merge 2 commits into
alex-mextner wants to merge 2 commits into
Conversation
- Update provisioning to new dataplicity device-gateway API - Endpoint: app-api.dataplicity.com/device-gateway/provision/ - Install URL: .sh instead of .py - Requires device_class_hash parsed from .sh wrapper - Response fields renamed: hash_id / device_secret (with fallbacks) - Add recovery input mode (serial:auth) for already-provisioned devices - Fix config_flow regex to accept .sh and .py URLs - Fix Python 3.14 compatibility: - Remove broken co_freevars assignment (immutable tuple) - Restore original forwarded_middleware cell-contents hack - Add logging to async_setup exception handler - Clean up hass.data in async_unload_entry - Bump dataplicity agent to 0.5.13 (verified working with wormhole) - Bump integration version to 1.3.0 - Update translations (en/ru) for .sh URL and recovery mode Closes AlexxIT#49, closes AlexxIT#47, closes AlexxIT#48
- Update provisioning to new dataplicity device-gateway API - Endpoint: app-api.dataplicity.com/device-gateway/provision/ - Install URL: .sh instead of .py - Requires device_class_hash parsed from .sh wrapper - Response fields renamed: hash_id / device_secret (with fallbacks) - Add recovery input mode (serial:auth) for already-provisioned devices - Fix config_flow regex to accept .sh and .py URLs - Fix Python 3.14 compatibility: - Remove broken co_freevars assignment (immutable tuple) - Restore original forwarded_middleware cell-contents hack - Add logging to async_setup exception handler - Clean up hass.data in async_unload_entry - Bump dataplicity agent to 0.5.13 (verified working with wormhole) - Bump integration version to 1.3.0 - Update translations (en/ru) for .sh URL and recovery mode - Restore deleted inline comments (posix_spawn, closure hack, monkey-patches) Closes AlexxIT#49, closes AlexxIT#47, closes AlexxIT#48
e55895f to
982b5a6
Compare
Owner
|
I don't really understand your changes. The changes in #50 are minimal. And they don't affect the hack at all. |
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
This PR supersedes #50 by fixing the Dataplicity integration for modern infrastructure without breaking the existing silent reverse-proxy hack.
Background
PR #50 (petrouv) correctly updated the provisioning logic for the new Dataplicity API (
.shURLs,device_class_hash, new response fields). However, it introduced several regressions that break the integration on current Home Assistant / Python 3.14:fix_middleware— Fix provisioning for new Dataplicity device-gateway API #50 replaced the working closure-cell hack with aco_freevarsassignment that crashes on Python 3.14 (tupleis immutable). This silently disables the reverse-proxy auto-configuration, causing the wormhole to return 400 Bad Request unless the user manually editsconfiguration.yaml.utils.install_package— Fix provisioning for new Dataplicity device-gateway API #50 deleted theinstall_packagehelper but__init__.pystill calls it insidefake_install, leading to an unloggedAttributeError/ recursion crash during setup.except:inasync_setupswallows all errors, making failures invisible.hass.datacleanup —async_unload_entrykept a reference to the dead client.What this PR does differently
.shsupport,device_class_hash,hash_id/device_secretfallbacks,serial:authrecovery mode).fix_middleware: restores the original cell-contents hack that worked for years, plusgetattr(f, "__name__", None)safety. Noco_freevarsmutation.install_package: kept and documented with--no-depsreasoning.async_setupandasync_setup_entrynow log full tracebacks.async_unload_entrypopshass.data[DOMAIN].dataplicity==0.5.13(verified end-to-end; theredirect_portbug that pinned0.4.40is gone).Tested on
Closes