Skip to content

Conversation

@wjnelson78
Copy link

Commit Message

fix: use hass.data["lovelace"].resources instead of hass.data["lovelace"]["resources"]

Extended Description

This commit addresses the deprecation warning related to accessing Lovelace resources by dictionary key. As of Home Assistant 2026.2, direct dictionary access to lovelace_data['resources'] will no longer be supported, and the recommended approach is to use the property-based access lovelace_data.resources instead.

Changes

• Updated utils.py to replace:

resources: ResourceStorageCollection = hass.data["lovelace"]["resources"]

with:

resources: ResourceStorageCollection = hass.data["lovelace"].resources

• Ensured that references to resources in subsequent code remain compatible with the new property-based API.

By making this change, the WebRTC integration will remain functional in future Home Assistant releases past 2026.2.

…ce"]["resources"]

This commit addresses the deprecation warning related to accessing Lovelace resources by dictionary key. As of Home Assistant 2026.2, direct dictionary access to lovelace_data['resources'] will no longer be supported, and the recommended approach is to use the property-based access lovelace_data.resources instead.

Updated utils.py to replace
resources: ResourceStorageCollection = hass.data["lovelace"]["resources"]
with
resources: ResourceStorageCollection = hass.data["lovelace"].resources

Ensured that references to resources in subsequent code remain compatible with the new property-based API.
@AlexxIT AlexxIT added the duplicate This issue or pull request already exists label Mar 11, 2025
@AlexxIT
Copy link
Owner

AlexxIT commented Mar 11, 2025

Duplicate: #799

Your changes won't be accepted because they break backwards compatibility.
Many of my integrations support the oldest versions of HA as much as possible.
This is a good fix:
https://github.com/AlexxIT/YandexStation/blob/547619ae08cca01ad478b2ea3f2f9fd00fd969cc/custom_components/yandex_station/core/utils.py#L147-L149

@AlexxIT AlexxIT closed this Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

duplicate This issue or pull request already exists

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants