Remove callback decorator from coroutine functions (#75626)
* Remove callback decorator from coroutine functions * Remove some more callback decorators
This commit is contained in:
parent
148f963510
commit
c05905ebda
12 changed files with 3 additions and 17 deletions
|
@ -25,7 +25,7 @@ from homeassistant.const import (
|
||||||
CONF_CLIENT_SECRET,
|
CONF_CLIENT_SECRET,
|
||||||
CONF_UNIT_SYSTEM,
|
CONF_UNIT_SYSTEM,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.icon import icon_for_battery_level
|
from homeassistant.helpers.icon import icon_for_battery_level
|
||||||
|
@ -279,7 +279,6 @@ class FitbitAuthCallbackView(HomeAssistantView):
|
||||||
self.add_entities = add_entities
|
self.add_entities = add_entities
|
||||||
self.oauth = oauth
|
self.oauth = oauth
|
||||||
|
|
||||||
@callback
|
|
||||||
async def get(self, request: Request) -> str:
|
async def get(self, request: Request) -> str:
|
||||||
"""Finish OAuth callback request."""
|
"""Finish OAuth callback request."""
|
||||||
hass: HomeAssistant = request.app["hass"]
|
hass: HomeAssistant = request.app["hass"]
|
||||||
|
|
|
@ -240,7 +240,6 @@ class FritzBoxTools(update_coordinator.DataUpdateCoordinator):
|
||||||
self.device_conn_type, "GetInfo"
|
self.device_conn_type, "GetInfo"
|
||||||
).get("NewEnable")
|
).get("NewEnable")
|
||||||
|
|
||||||
@callback
|
|
||||||
async def _async_update_data(self) -> None:
|
async def _async_update_data(self) -> None:
|
||||||
"""Update FritzboxTools data."""
|
"""Update FritzboxTools data."""
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -173,7 +173,6 @@ class GenericHygrostat(HumidifierEntity, RestoreEntity):
|
||||||
if self._keep_alive:
|
if self._keep_alive:
|
||||||
async_track_time_interval(self.hass, self._async_operate, self._keep_alive)
|
async_track_time_interval(self.hass, self._async_operate, self._keep_alive)
|
||||||
|
|
||||||
@callback
|
|
||||||
async def _async_startup(event):
|
async def _async_startup(event):
|
||||||
"""Init on startup."""
|
"""Init on startup."""
|
||||||
sensor_state = self.hass.states.get(self._sensor_entity_id)
|
sensor_state = self.hass.states.get(self._sensor_entity_id)
|
||||||
|
@ -309,7 +308,6 @@ class GenericHygrostat(HumidifierEntity, RestoreEntity):
|
||||||
# Get default humidity from super class
|
# Get default humidity from super class
|
||||||
return super().max_humidity
|
return super().max_humidity
|
||||||
|
|
||||||
@callback
|
|
||||||
async def _async_sensor_changed(self, entity_id, old_state, new_state):
|
async def _async_sensor_changed(self, entity_id, old_state, new_state):
|
||||||
"""Handle ambient humidity changes."""
|
"""Handle ambient humidity changes."""
|
||||||
if new_state is None:
|
if new_state is None:
|
||||||
|
@ -328,7 +326,6 @@ class GenericHygrostat(HumidifierEntity, RestoreEntity):
|
||||||
await self._async_operate()
|
await self._async_operate()
|
||||||
await self.async_update_ha_state()
|
await self.async_update_ha_state()
|
||||||
|
|
||||||
@callback
|
|
||||||
async def _async_sensor_not_responding(self, now=None):
|
async def _async_sensor_not_responding(self, now=None):
|
||||||
"""Handle sensor stale event."""
|
"""Handle sensor stale event."""
|
||||||
|
|
||||||
|
|
|
@ -574,7 +574,6 @@ class Group(Entity):
|
||||||
return group
|
return group
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@callback
|
|
||||||
async def async_create_group(
|
async def async_create_group(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
name: str,
|
name: str,
|
||||||
|
|
|
@ -328,7 +328,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
hass, DOMAIN, "motionEye", entry.data[CONF_WEBHOOK_ID], handle_webhook
|
hass, DOMAIN, "motionEye", entry.data[CONF_WEBHOOK_ID], handle_webhook
|
||||||
)
|
)
|
||||||
|
|
||||||
@callback
|
|
||||||
async def async_update_data() -> dict[str, Any] | None:
|
async def async_update_data() -> dict[str, Any] | None:
|
||||||
try:
|
try:
|
||||||
return await client.async_get_cameras()
|
return await client.async_get_cameras()
|
||||||
|
|
|
@ -343,7 +343,6 @@ class MQTT:
|
||||||
|
|
||||||
self.init_client()
|
self.init_client()
|
||||||
|
|
||||||
@callback
|
|
||||||
async def async_stop_mqtt(_event: Event):
|
async def async_stop_mqtt(_event: Event):
|
||||||
"""Stop MQTT component."""
|
"""Stop MQTT component."""
|
||||||
await self.async_disconnect()
|
await self.async_disconnect()
|
||||||
|
|
|
@ -7,7 +7,7 @@ import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_DEVICE, CONF_PLATFORM, CONF_VALUE_TEMPLATE
|
from homeassistant.const import CONF_DEVICE, CONF_PLATFORM, CONF_VALUE_TEMPLATE
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
|
|
||||||
|
@ -128,7 +128,6 @@ class MQTTTagScanner(MqttDiscoveryDeviceUpdate):
|
||||||
async def subscribe_topics(self) -> None:
|
async def subscribe_topics(self) -> None:
|
||||||
"""Subscribe to MQTT topics."""
|
"""Subscribe to MQTT topics."""
|
||||||
|
|
||||||
@callback
|
|
||||||
async def tag_scanned(msg: ReceiveMessage) -> None:
|
async def tag_scanned(msg: ReceiveMessage) -> None:
|
||||||
tag_id = self._value_template(msg.payload, "").strip()
|
tag_id = self._value_template(msg.payload, "").strip()
|
||||||
if not tag_id: # No output from template, ignore
|
if not tag_id: # No output from template, ignore
|
||||||
|
|
|
@ -22,7 +22,6 @@ _LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@singleton(DATA_NETWORK)
|
@singleton(DATA_NETWORK)
|
||||||
@callback
|
|
||||||
async def async_get_network(hass: HomeAssistant) -> Network:
|
async def async_get_network(hass: HomeAssistant) -> Network:
|
||||||
"""Get network singleton."""
|
"""Get network singleton."""
|
||||||
network = Network(hass)
|
network = Network(hass)
|
||||||
|
|
|
@ -187,7 +187,6 @@ class PhilipsTVDataUpdateCoordinator(DataUpdateCoordinator[None]):
|
||||||
super()._unschedule_refresh()
|
super()._unschedule_refresh()
|
||||||
self._async_notify_stop()
|
self._async_notify_stop()
|
||||||
|
|
||||||
@callback
|
|
||||||
async def _async_update_data(self):
|
async def _async_update_data(self):
|
||||||
"""Fetch the latest data from the source."""
|
"""Fetch the latest data from the source."""
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -106,7 +106,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
|
|
||||||
await async_start_bridge(hass, on_device_data_callback)
|
await async_start_bridge(hass, on_device_data_callback)
|
||||||
|
|
||||||
@callback
|
|
||||||
async def stop_bridge(event: Event) -> None:
|
async def stop_bridge(event: Event) -> None:
|
||||||
await async_stop_bridge(hass)
|
await async_stop_bridge(hass)
|
||||||
|
|
||||||
|
|
|
@ -196,7 +196,6 @@ def async_condition_from_config(
|
||||||
raise HomeAssistantError(f"Unhandled condition type {condition_type}")
|
raise HomeAssistantError(f"Unhandled condition type {condition_type}")
|
||||||
|
|
||||||
|
|
||||||
@callback
|
|
||||||
async def async_get_condition_capabilities(
|
async def async_get_condition_capabilities(
|
||||||
hass: HomeAssistant, config: ConfigType
|
hass: HomeAssistant, config: ConfigType
|
||||||
) -> dict[str, vol.Schema]:
|
) -> dict[str, vol.Schema]:
|
||||||
|
|
|
@ -27,7 +27,7 @@ from homeassistant.const import (
|
||||||
STATE_OFF,
|
STATE_OFF,
|
||||||
STATE_ON,
|
STATE_ON,
|
||||||
)
|
)
|
||||||
from homeassistant.core import Event, HomeAssistant, State, callback
|
from homeassistant.core import Event, HomeAssistant, State
|
||||||
from homeassistant.helpers import device_registry, entity_registry
|
from homeassistant.helpers import device_registry, entity_registry
|
||||||
from homeassistant.helpers.entityfilter import CONF_ENTITY_GLOBS
|
from homeassistant.helpers.entityfilter import CONF_ENTITY_GLOBS
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
|
@ -51,7 +51,6 @@ def set_utc(hass):
|
||||||
hass.config.set_time_zone("UTC")
|
hass.config.set_time_zone("UTC")
|
||||||
|
|
||||||
|
|
||||||
@callback
|
|
||||||
async def _async_mock_logbook_platform(hass: HomeAssistant) -> None:
|
async def _async_mock_logbook_platform(hass: HomeAssistant) -> None:
|
||||||
class MockLogbookPlatform:
|
class MockLogbookPlatform:
|
||||||
"""Mock a logbook platform."""
|
"""Mock a logbook platform."""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue