Fix callback and async (#31281)
* Fix callback and async * Fix a return * Fix test * Fix mqtt tests * Fix some more callbacks
This commit is contained in:
1 parent
ee602e40a6
commit
e9e44dbd97
90 files changed
+627
-883
No files matched your search
@@ -104,34 +104,25 @@ class LockDevice(Entity):
|
||||
"""Lock the lock."""
|
||||
raise NotImplementedError()
|
||||
|
||||
def async_lock(self, **kwargs):
|
||||
"""Lock the lock.
|
||||
|
||||
This method must be run in the event loop and returns a coroutine.
|
||||
"""
|
||||
return self.hass.async_add_job(ft.partial(self.lock, **kwargs))
|
||||
async def async_lock(self, **kwargs):
|
||||
"""Lock the lock."""
|
||||
await self.hass.async_add_job(ft.partial(self.lock, **kwargs))
|
||||
|
||||
def unlock(self, **kwargs):
|
||||
"""Unlock the lock."""
|
||||
raise NotImplementedError()
|
||||
|
||||
def async_unlock(self, **kwargs):
|
||||
"""Unlock the lock.
|
||||
|
||||
This method must be run in the event loop and returns a coroutine.
|
||||
"""
|
||||
return self.hass.async_add_job(ft.partial(self.unlock, **kwargs))
|
||||
async def async_unlock(self, **kwargs):
|
||||
"""Unlock the lock."""
|
||||
await self.hass.async_add_job(ft.partial(self.unlock, **kwargs))
|
||||
|
||||
def open(self, **kwargs):
|
||||
"""Open the door latch."""
|
||||
raise NotImplementedError()
|
||||
|
||||
def async_open(self, **kwargs):
|
||||
"""Open the door latch.
|
||||
|
||||
This method must be run in the event loop and returns a coroutine.
|
||||
"""
|
||||
return self.hass.async_add_job(ft.partial(self.open, **kwargs))
|
||||
async def async_open(self, **kwargs):
|
||||
"""Open the door latch."""
|
||||
await self.hass.async_add_job(ft.partial(self.open, **kwargs))
|
||||
|
||||
@property
|
||||
def state_attributes(self):
|
||||
|
||||
@@ -13,7 +13,7 @@ from homeassistant.const import (
|
||||
STATE_LOCKED,
|
||||
STATE_UNLOCKED,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers import condition, config_validation as cv, entity_registry
|
||||
from homeassistant.helpers.config_validation import DEVICE_CONDITION_BASE_SCHEMA
|
||||
from homeassistant.helpers.typing import ConfigType, TemplateVarsType
|
||||
@@ -63,6 +63,7 @@ async def async_get_conditions(hass: HomeAssistant, device_id: str) -> List[dict
|
||||
return conditions
|
||||
|
||||
|
||||
@callback
|
||||
def async_condition_from_config(
|
||||
config: ConfigType, config_validation: bool
|
||||
) -> condition.ConditionCheckerType:
|
||||
|
||||
Reference in new issue
Block a user