Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion homeassistant/components/binary_sensor/esphome.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ def available(self):
"""Return True if entity is available."""
if self._static_info.is_status_binary_sensor:
return True
return super(EsphomeEntity, self).available
return super().available
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 changes: 2 additions & 1 deletion homeassistant/components/esphome/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@

# The HA component types this integration supports
HA_COMPONENTS = [
'sensor',
'binary_sensor',
'cover',
'fan',
'light',
'sensor',
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'switch',
]

Expand Down Expand Up @@ -461,6 +461,7 @@ async def async_will_remove_from_hass(self):
"""Unregister callbacks."""
for remove_callback in self._remove_callbacks:
remove_callback()
self._remove_callbacks = []
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't know that async_will_remove behaves this way (see #19414) - this fixes the same thing as in #19414


@property
def _entry_data(self) -> RuntimeEntryData:
Expand Down
5 changes: 5 additions & 0 deletions homeassistant/components/switch/esphome.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ def icon(self) -> str:
"""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
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switches can also be optimistic in ESPHome (for example template switches without a state lambda). Forgot to include it in the original PR.


@property
def is_on(self):
"""Return true if the switch is on."""
Expand Down