diff --git a/homeassistant/components/binary_sensor/esphome.py b/homeassistant/components/binary_sensor/esphome.py index aa23f2572d9..4796df636ba 100644 --- a/homeassistant/components/binary_sensor/esphome.py +++ b/homeassistant/components/binary_sensor/esphome.py @@ -60,4 +60,4 @@ class EsphomeBinarySensor(EsphomeEntity, BinarySensorDevice): """Return True if entity is available.""" if self._static_info.is_status_binary_sensor: return True - return super(EsphomeEntity, self).available + return super().available diff --git a/homeassistant/components/esphome/__init__.py b/homeassistant/components/esphome/__init__.py index eae56460597..ef49561efe7 100644 --- a/homeassistant/components/esphome/__init__.py +++ b/homeassistant/components/esphome/__init__.py @@ -43,11 +43,11 @@ STORAGE_VERSION = 1 # The HA component types this integration supports HA_COMPONENTS = [ - 'sensor', 'binary_sensor', 'cover', 'fan', 'light', + 'sensor', 'switch', ] @@ -461,6 +461,7 @@ class EsphomeEntity(Entity): """Unregister callbacks.""" for remove_callback in self._remove_callbacks: remove_callback() + self._remove_callbacks = [] @property def _entry_data(self) -> RuntimeEntryData: diff --git a/homeassistant/components/switch/esphome.py b/homeassistant/components/switch/esphome.py index cfa11db9437..4bf4b416b8d 100644 --- a/homeassistant/components/switch/esphome.py +++ b/homeassistant/components/switch/esphome.py @@ -47,6 +47,11 @@ class EsphomeSwitch(EsphomeEntity, SwitchDevice): """Return the 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 def is_on(self): """Return true if the switch is on."""