mirror of
https://github.com/home-assistant/core.git
synced 2025-04-29 03:37:51 +00:00

* add sensor platform to backup integration * adjust namings, remove system integration flag * add first simple test * apply review comments * fix test * add sensor tests * adjustements to use backup helper * remove obsolet async_get_manager from init * unsubscribe from events on entry unload * add configuration_url * fix doc string * fix sensor tests * mark async_unsubscribe as callback * set integration_type service * extend sensor test * set integration_type on correct integration :) * fix after online conflict resolution * add sensor update tests * simplify the sensor update tests * avoid io during tests * Add comment --------- Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
"""Base for backup entities."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from homeassistant.const import __version__ as HA_VERSION
|
|
from homeassistant.helpers.device_registry import DeviceEntryType, DeviceInfo
|
|
from homeassistant.helpers.entity import EntityDescription
|
|
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
|
|
|
from .const import DOMAIN
|
|
from .coordinator import BackupDataUpdateCoordinator
|
|
|
|
|
|
class BackupManagerEntity(CoordinatorEntity[BackupDataUpdateCoordinator]):
|
|
"""Base entity for backup manager."""
|
|
|
|
_attr_has_entity_name = True
|
|
|
|
def __init__(
|
|
self,
|
|
coordinator: BackupDataUpdateCoordinator,
|
|
entity_description: EntityDescription,
|
|
) -> None:
|
|
"""Initialize base entity."""
|
|
super().__init__(coordinator)
|
|
self.entity_description = entity_description
|
|
self._attr_unique_id = entity_description.key
|
|
self._attr_device_info = DeviceInfo(
|
|
identifiers={(DOMAIN, "backup_manager")},
|
|
manufacturer="Home Assistant",
|
|
model="Home Assistant Backup",
|
|
sw_version=HA_VERSION,
|
|
name="Backup",
|
|
entry_type=DeviceEntryType.SERVICE,
|
|
configuration_url="homeassistant://config/backup",
|
|
)
|