Use callback instead of async

This commit is contained in:
Tobias Haase
2019-08-01 22:45:46 +02:00
parent e1df96e95c
commit 036101f419
2 changed files with 5 additions and 2 deletions

View File

@@ -50,9 +50,10 @@ RESPONSE_SCHEMA = vol.Schema(
class Updater:
"""Updater class."""
"""Updater class for data exchange."""
def __init__(self, update_available: bool, newest_version: str, release_notes: str):
"""Updater constructor."""
self.update_available = update_available
self.release_notes = release_notes
self.newest_version = newest_version

View File

@@ -1,5 +1,6 @@
"""Support for Home Assistant Updater binary sensors."""
from homeassistant.core import callback
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.helpers.dispatcher import async_dispatcher_connect
@@ -58,7 +59,8 @@ class UpdaterBinary(BinarySensorDevice):
data[ATTR_NEWEST_VERSION] = self._newest_version
return data
async def async_added_to_hass(self):
@callback
def async_added_to_hass(self):
"""Register update dispatcher."""
async def async_state_update(updater: Updater):