Skip to content

fix: HA 2026.8 compatibility - explicit config_entry + runtime_data migration#1448

Open
yuya4i wants to merge 1 commit intofuatakgun:masterfrom
yuya4i:fix/ha-2026-compatibility
Open

fix: HA 2026.8 compatibility - explicit config_entry + runtime_data migration#1448
yuya4i wants to merge 1 commit intofuatakgun:masterfrom
yuya4i:fix/ha-2026-compatibility

Conversation

@yuya4i
Copy link
Copy Markdown

@yuya4i yuya4i commented Apr 5, 2026

Summary

This PR fixes the ContextVar deprecation that will break the integration in Home Assistant 2026.8 (ref: #1370), and modernizes data storage to use config_entry.runtime_data.

Changes

  • coordinator.py: Pass config_entry explicitly to DataUpdateCoordinator.__init__() — fixes the ContextVar deprecation warning
  • __init__.py: Migrate from hass.data[DOMAIN][COORDINATOR] to config_entry.runtime_data pattern (recommended since HA 2024.4)
  • All platform files (camera.py, sensor.py, switch.py, etc.): Updated coordinator access from hass.data[DOMAIN][COORDINATOR] to config_entry.runtime_data
  • config_flow.py: Updated reauth flow to use runtime_data
  • const.py: Removed unused COORDINATOR constant
  • manifest.json: Version bump to 8.3.0
  • Removed duplicate asyncio import

Why this matters

  • HA 2026.8 will break if config_entry is not explicitly passed to DataUpdateCoordinator (currently shows deprecation warning)
  • runtime_data provides type safety and proper cleanup on unload
  • Supports multiple config entries safely

Testing

  • All 18 Python files pass py_compile syntax check
  • No remaining references to hass.data[DOMAIN][COORDINATOR] or COORDINATOR constant

Test plan

  • Install updated integration via HACS custom repository
  • Verify cameras, sensors, switches, locks all load correctly
  • Verify reauth flow (captcha/MFA) still works
  • Verify no ContextVar deprecation warning in HA logs
  • Test on HA 2026.4+ (current stable)

🤖 Generated with Claude Code

…nd explicit DataUpdateCoordinator config_entry

- Pass config_entry explicitly to DataUpdateCoordinator.__init__() to fix
  ContextVar deprecation warning (breaks in HA 2026.8)
- Migrate from hass.data[DOMAIN][COORDINATOR] to config_entry.runtime_data
  for proper type safety and multi-entry support
- Remove duplicate asyncio import in coordinator.py
- Remove unused COORDINATOR constant from const.py
- Update manifest.json: version bump to 8.3.0, update codeowners and URLs
- Update config_flow.py reauth to use runtime_data

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@fuatakgun
Copy link
Copy Markdown
Owner

thanks for doing this.

message = call.data.get("message")
_LOGGER.debug(f"{DOMAIN} - end_message - message: {message}")
await coordinator.send_message(message)
for entry in hass.config_entries.async_entries(DOMAIN):
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

you should extract coordinator here:

call.hass.config_entries.async_loaded_entries(DOMAIN).runtime_data

and we should fail here in case we cannot find the enrty with runtime_data, rather than being silent

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