fix: Refresh Token Failures - #298
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||
PR Code Suggestions ✨Latest suggestions up to 3236c3d
Previous suggestions✅ Suggestions up to commit e2dd6ad
|
||||||||||||||||||||||
28217ef to
3236c3d
Compare
…re flow, and safe MFA access - Replace int | float union types with (int, float) tuples in isinstance calls - Correct voluptuous schema to use str validator with default for CONF_USER_ID - Fix reconfigure flow initiation to use correct API with entry_id in context - Use .get() method for safer MFA input access to prevent KeyError
9bd81c6 to
e682904
Compare
- Clear CONF_TOTP_SECRET from data during reconfigure initialization - Remove CONF_USER_ID from reconfigure MFA schema - Create new client with existing user ID for authentication - Ensure no new entities are added, only update existing entry
PR Type
Bug fix, Enhancement
Description
Handle 400 Bad Request token refresh failures with reconfigure flow
Add null checks for coordinator data in sensor and binary sensor setup
Implement reconfigure flow for authentication credential updates
Improve type hints using modern Python union syntax
Diagram Walkthrough
File Walkthrough
__init__.py
Handle authentication failures explicitlycustom_components/iec/init.py
ConfigEntryAuthFailedexception for proper error handlingConfigEntryAuthFailedexceptions instead of suppressing thembinary_sensor.py
Add null safety checks for coordinator datacustom_components/iec/binary_sensor.py
coordinator.databefore accessing keyscoordinator.py
Add auth error handling and reconfigure flow triggercustom_components/iec/coordinator.py
_handle_auth_errormethod to handle authentication errors andtrigger reconfigure flow
_handle_auth_errorbefore raisingConfigEntryAuthFailedin_async_update_data(int, float)to union syntaxint |floatsensor.py
Add null safety checks for coordinator datacustom_components/iec/sensor.py
coordinator.databefore accessing keys in filterconfig_flow.py
Add reconfigure flow for credential updatescustom_components/iec/config_flow.py
reconfigure_entryattribute to store reconfigure contextasync_step_reconfiguremethod to initiate reconfigure flowasync_step_reconfigure_mfamethod to handle MFA duringreconfiguration