Move nzbget base entity to separate module (#126502)
parent
0163f3d57e
commit
438cbc99b1
|
@ -6,8 +6,6 @@ from homeassistant.config_entries import ConfigEntry
|
|||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant, ServiceCall
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.device_registry import DeviceEntryType, DeviceInfo
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
from .const import (
|
||||
ATTR_SPEED,
|
||||
|
@ -93,25 +91,3 @@ def _async_register_services(
|
|||
async def _async_update_listener(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
||||
"""Handle options update."""
|
||||
await hass.config_entries.async_reload(entry.entry_id)
|
||||
|
||||
|
||||
class NZBGetEntity(CoordinatorEntity[NZBGetDataUpdateCoordinator]):
|
||||
"""Defines a base NZBGet entity."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
entry_id: str,
|
||||
entry_name: str,
|
||||
coordinator: NZBGetDataUpdateCoordinator,
|
||||
) -> None:
|
||||
"""Initialize the NZBGet entity."""
|
||||
super().__init__(coordinator)
|
||||
self._entry_id = entry_id
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(DOMAIN, entry_id)},
|
||||
name=entry_name,
|
||||
entry_type=DeviceEntryType.SERVICE,
|
||||
)
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
"""The NZBGet integration."""
|
||||
|
||||
from homeassistant.helpers.device_registry import DeviceEntryType, DeviceInfo
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
from .const import DOMAIN
|
||||
from .coordinator import NZBGetDataUpdateCoordinator
|
||||
|
||||
|
||||
class NZBGetEntity(CoordinatorEntity[NZBGetDataUpdateCoordinator]):
|
||||
"""Defines a base NZBGet entity."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
entry_id: str,
|
||||
entry_name: str,
|
||||
coordinator: NZBGetDataUpdateCoordinator,
|
||||
) -> None:
|
||||
"""Initialize the NZBGet entity."""
|
||||
super().__init__(coordinator)
|
||||
self._entry_id = entry_id
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(DOMAIN, entry_id)},
|
||||
name=entry_name,
|
||||
entry_type=DeviceEntryType.SERVICE,
|
||||
)
|
|
@ -17,9 +17,9 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
|||
from homeassistant.helpers.typing import StateType
|
||||
from homeassistant.util.dt import utcnow
|
||||
|
||||
from . import NZBGetEntity
|
||||
from .const import DATA_COORDINATOR, DOMAIN
|
||||
from .coordinator import NZBGetDataUpdateCoordinator
|
||||
from .entity import NZBGetEntity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -10,9 +10,9 @@ from homeassistant.const import CONF_NAME
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
||||
from . import NZBGetEntity
|
||||
from .const import DATA_COORDINATOR, DOMAIN
|
||||
from .coordinator import NZBGetDataUpdateCoordinator
|
||||
from .entity import NZBGetEntity
|
||||
|
||||
|
||||
async def async_setup_entry(
|
||||
|
|
Loading…
Reference in New Issue