Skip to content
Merged
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
10 changes: 9 additions & 1 deletion homeassistant/components/bosch_shc/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@

from boschshcpy import SHCDevice, SHCIntrusionSystem

from homeassistant.core import HomeAssistant
from homeassistant.helpers.device_registry import async_get as get_dev_reg
from homeassistant.helpers.entity import DeviceInfo, Entity

from .const import DOMAIN


async def async_remove_devices(hass, entity, entry_id) -> None:
async def async_remove_devices(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Side note: This doesn't need to be a coroutine function as there's no await inside.

hass: HomeAssistant, entity: SHCBaseEntity, entry_id: str
) -> None:
"""Get item that is removed from session."""
dev_registry = get_dev_reg(hass)
device = dev_registry.async_get_device(
Expand Down Expand Up @@ -49,6 +52,11 @@ async def async_will_remove_from_hass(self) -> None:
await super().async_will_remove_from_hass()
self._device.unsubscribe_callback(self.entity_id)

@property
def device_id(self) -> str:
"""Return the device id."""
return self._device.id

Comment on lines +55 to +59

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

As far as I can tell, async_remove_devices couldn't have worked.

device = dev_registry.async_get_device(
identifiers={(DOMAIN, entity.device_id)}, connections=set()
)


class SHCEntity(SHCBaseEntity):
"""Representation of a SHC device entity."""
Expand Down