Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecation warnings SUPPORT_PLAY_MEDIA and async_forward_entry_setup #248

Merged
merged 2 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import yaml

from homeassistant.components.media_player import SUPPORT_PLAY_MEDIA
from homeassistant.core import HomeAssistant
from homeassistant.util import slugify

Expand Down Expand Up @@ -192,7 +191,7 @@ def _set_input_select_cast_devices(
name = state.name

supported_features = state.attributes.get("supported_features", 0)
support_play_media = bool(supported_features & SUPPORT_PLAY_MEDIA)
support_play_media = bool(supported_features & MediaPlayerEntityFeature.PLAY_MEDIA)

if support_play_media:
options.append(name)
Expand Down Expand Up @@ -264,7 +263,7 @@ def _set_script_cast(
name = state.name

supported_features = state.attributes.get("supported_features", 0)
support_play_media = bool(supported_features & SUPPORT_PLAY_MEDIA)
support_play_media = bool(supported_features & MediaPlayerEntityFeature.PLAY_MEDIA)

if support_play_media:
media_player_item = f"""{name}"": ""{entity_id}"""
Expand Down
5 changes: 1 addition & 4 deletions custom_components/blueiris/managers/home_assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,7 @@ async def async_init(self, entry: ConfigEntry):
_LOGGER.error(f"Failed to async_init, error: {ex}, line: {line_number}")

async def _async_init(self):
load = self._hass.config_entries.async_forward_entry_setup

for domain in SIGNALS:
await load(self._config_manager.config_entry, domain)
await self._hass.config_entries.async_forward_entry_setups(self._config_manager.config_entry, list(SIGNALS.keys()))

self._is_initialized = True

Expand Down
Loading