mirror of
https://github.com/home-assistant/core.git
synced 2026-12-02 19:57:03 -04:00
Add callback decorator to callback overrides (#190829)
This commit is contained in:
@@ -32,7 +32,7 @@ from homeassistant.components.media_player import (
|
||||
async_process_play_media_url,
|
||||
)
|
||||
from homeassistant.const import CONF_DEVICE_ID, CONF_MAC, CONF_TYPE, CONF_URL
|
||||
from homeassistant.core import CoreState, HomeAssistant
|
||||
from homeassistant.core import CoreState, HomeAssistant, callback
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
@@ -372,6 +372,7 @@ class DlnaDmrEntity(MediaPlayerEntity):
|
||||
# Device was de/re-connected, state might have changed
|
||||
self.async_write_ha_state()
|
||||
|
||||
@callback
|
||||
@override
|
||||
def _async_write_ha_state(self) -> None:
|
||||
"""Write the state."""
|
||||
|
||||
@@ -7,6 +7,7 @@ from typing import Any, Self, final, override
|
||||
|
||||
from propcache.api import cached_property
|
||||
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.entity import EntityDescription
|
||||
from homeassistant.helpers.restore_state import ExtraStoredData, RestoreEntity
|
||||
from homeassistant.util import dt as dt_util
|
||||
@@ -177,6 +178,7 @@ class EventEntity(RestoreEntity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_)
|
||||
self.__last_event_attributes = event_data.last_event_attributes
|
||||
|
||||
@final
|
||||
@callback
|
||||
@override
|
||||
def _async_write_ha_state(self) -> None:
|
||||
"""Write the state to the state machine.
|
||||
|
||||
@@ -16,7 +16,7 @@ from homeassistant.const import (
|
||||
UnitOfSpeed,
|
||||
UnitOfTemperature,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
|
||||
from .coordinator import IrmKmiConfigEntry, IrmKmiCoordinator
|
||||
@@ -125,16 +125,19 @@ class IrmKmiWeather(
|
||||
"""Return the UV index."""
|
||||
return self.current_weather.get("uv_index")
|
||||
|
||||
@callback
|
||||
@override
|
||||
def _async_forecast_twice_daily(self) -> list[Forecast] | None:
|
||||
"""Return the daily forecast in native units."""
|
||||
return self.coordinator.data.daily_forecast
|
||||
|
||||
@callback
|
||||
@override
|
||||
def _async_forecast_daily(self) -> list[Forecast] | None:
|
||||
"""Return the daily forecast in native units."""
|
||||
return self.daily_forecast()
|
||||
|
||||
@callback
|
||||
@override
|
||||
def _async_forecast_hourly(self) -> list[Forecast] | None:
|
||||
"""Return the hourly forecast in native units."""
|
||||
|
||||
@@ -201,16 +201,19 @@ class SmhiWeather(SmhiWeatherEntity, SingleCoordinatorWeatherEntity):
|
||||
|
||||
return data
|
||||
|
||||
@callback
|
||||
@override
|
||||
def _async_forecast_daily(self) -> list[Forecast] | None:
|
||||
"""Service to retrieve the daily forecast."""
|
||||
return self._get_forecast_data(self.coordinator.data.daily, "daily")
|
||||
|
||||
@callback
|
||||
@override
|
||||
def _async_forecast_hourly(self) -> list[Forecast] | None:
|
||||
"""Service to retrieve the hourly forecast."""
|
||||
return self._get_forecast_data(self.coordinator.data.hourly, "hourly")
|
||||
|
||||
@callback
|
||||
@override
|
||||
def _async_forecast_twice_daily(self) -> list[Forecast] | None:
|
||||
"""Service to retrieve the twice daily forecast."""
|
||||
|
||||
Reference in New Issue
Block a user