1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 04:50:05 +00:00
This commit is contained in:
Paulus Schoutsen
2019-07-31 12:25:30 -07:00
parent da05dfe708
commit 4de97abc3a
2676 changed files with 163166 additions and 140084 deletions

View File

@@ -10,8 +10,7 @@ from .const import DISPATCHER_REMOTE_UPDATE, DOMAIN
WAIT_UNTIL_CHANGE = 3
async def async_setup_platform(
hass, config, async_add_entities, discovery_info=None):
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the cloud binary sensors."""
if discovery_info is None:
return
@@ -46,7 +45,7 @@ class CloudRemoteBinary(BinarySensorDevice):
@property
def device_class(self) -> str:
"""Return the class of this device, from component DEVICE_CLASSES."""
return 'connectivity'
return "connectivity"
@property
def available(self) -> bool:
@@ -60,13 +59,15 @@ class CloudRemoteBinary(BinarySensorDevice):
async def async_added_to_hass(self):
"""Register update dispatcher."""
async def async_state_update(data):
"""Update callback."""
await asyncio.sleep(WAIT_UNTIL_CHANGE)
self.async_schedule_update_ha_state()
self._unsub_dispatcher = async_dispatcher_connect(
self.hass, DISPATCHER_REMOTE_UPDATE, async_state_update)
self.hass, DISPATCHER_REMOTE_UPDATE, async_state_update
)
async def async_will_remove_from_hass(self):
"""Register update dispatcher."""