mirror of
https://github.com/home-assistant/core.git
synced 2025-08-06 14:15:12 +02:00
Use callback instead of async
This commit is contained in:
@@ -50,9 +50,10 @@ RESPONSE_SCHEMA = vol.Schema(
|
|||||||
|
|
||||||
|
|
||||||
class Updater:
|
class Updater:
|
||||||
"""Updater class."""
|
"""Updater class for data exchange."""
|
||||||
|
|
||||||
def __init__(self, update_available: bool, newest_version: str, release_notes: str):
|
def __init__(self, update_available: bool, newest_version: str, release_notes: str):
|
||||||
|
"""Updater constructor."""
|
||||||
self.update_available = update_available
|
self.update_available = update_available
|
||||||
self.release_notes = release_notes
|
self.release_notes = release_notes
|
||||||
self.newest_version = newest_version
|
self.newest_version = newest_version
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
"""Support for Home Assistant Updater binary sensors."""
|
"""Support for Home Assistant Updater binary sensors."""
|
||||||
|
|
||||||
|
from homeassistant.core import callback
|
||||||
from homeassistant.components.binary_sensor import BinarySensorDevice
|
from homeassistant.components.binary_sensor import BinarySensorDevice
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
|
|
||||||
@@ -58,7 +59,8 @@ class UpdaterBinary(BinarySensorDevice):
|
|||||||
data[ATTR_NEWEST_VERSION] = self._newest_version
|
data[ATTR_NEWEST_VERSION] = self._newest_version
|
||||||
return data
|
return data
|
||||||
|
|
||||||
async def async_added_to_hass(self):
|
@callback
|
||||||
|
def async_added_to_hass(self):
|
||||||
"""Register update dispatcher."""
|
"""Register update dispatcher."""
|
||||||
|
|
||||||
async def async_state_update(updater: Updater):
|
async def async_state_update(updater: Updater):
|
||||||
|
Reference in New Issue
Block a user