Miscellaneous ESPHome cleanups (#19425)

This commit is contained in:
Otto Winter 2018-12-18 19:04:50 +01:00 committed by Martin Hjelmare
parent c0ae7b1a49
commit 7317b1bb8b
3 changed files with 8 additions and 2 deletions

View file

@ -60,4 +60,4 @@ class EsphomeBinarySensor(EsphomeEntity, BinarySensorDevice):
"""Return True if entity is available.""" """Return True if entity is available."""
if self._static_info.is_status_binary_sensor: if self._static_info.is_status_binary_sensor:
return True return True
return super(EsphomeEntity, self).available return super().available

View file

@ -43,11 +43,11 @@ STORAGE_VERSION = 1
# The HA component types this integration supports # The HA component types this integration supports
HA_COMPONENTS = [ HA_COMPONENTS = [
'sensor',
'binary_sensor', 'binary_sensor',
'cover', 'cover',
'fan', 'fan',
'light', 'light',
'sensor',
'switch', 'switch',
] ]
@ -461,6 +461,7 @@ class EsphomeEntity(Entity):
"""Unregister callbacks.""" """Unregister callbacks."""
for remove_callback in self._remove_callbacks: for remove_callback in self._remove_callbacks:
remove_callback() remove_callback()
self._remove_callbacks = []
@property @property
def _entry_data(self) -> RuntimeEntryData: def _entry_data(self) -> RuntimeEntryData:

View file

@ -47,6 +47,11 @@ class EsphomeSwitch(EsphomeEntity, SwitchDevice):
"""Return the icon.""" """Return the icon."""
return self._static_info.icon return self._static_info.icon
@property
def assumed_state(self) -> bool:
"""Return true if we do optimistic updates."""
return self._static_info.optimistic
@property @property
def is_on(self): def is_on(self):
"""Return true if the switch is on.""" """Return true if the switch is on."""