Update hass-nabucasa & fix state (#22385)
* Update hass-nabucasa & fix state * Fix lint
This commit is contained in:
1 parent
f997957054
commit
b57d809dad
5 files changed
+14
-7
No files matched your search
@@ -24,7 +24,7 @@ from .const import (
|
||||
CONF_USER_POOL_ID, DOMAIN, MODE_DEV, MODE_PROD)
|
||||
from .prefs import CloudPreferences
|
||||
|
||||
REQUIREMENTS = ['hass-nabucasa==0.10']
|
||||
REQUIREMENTS = ['hass-nabucasa==0.11']
|
||||
DEPENDENCIES = ['http']
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""Support for Home Assistant Cloud binary sensors."""
|
||||
import asyncio
|
||||
|
||||
from homeassistant.components.binary_sensor import BinarySensorDevice
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
|
||||
from .const import DISPATCHER_REMOTE_UPDATE, DOMAIN
|
||||
@@ -8,6 +9,9 @@ from .const import DISPATCHER_REMOTE_UPDATE, DOMAIN
|
||||
DEPENDENCIES = ['cloud']
|
||||
|
||||
|
||||
WAIT_UNTIL_CHANGE = 3
|
||||
|
||||
|
||||
async def async_setup_platform(
|
||||
hass, config, async_add_entities, discovery_info=None):
|
||||
"""Set up the cloud binary sensors."""
|
||||
@@ -58,10 +62,10 @@ class CloudRemoteBinary(BinarySensorDevice):
|
||||
|
||||
async def async_added_to_hass(self):
|
||||
"""Register update dispatcher."""
|
||||
@callback
|
||||
def async_state_update(data):
|
||||
async def async_state_update(data):
|
||||
"""Update callback."""
|
||||
self.async_write_ha_state()
|
||||
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)
|
||||
|
||||
Reference in new issue
Block a user