core/homeassistant/components/tractive/entity.py

31 lines
940 B
Python
Raw Normal View History

"""A entity class for Tractive integration."""
from __future__ import annotations
from typing import Any
2021-10-16 21:51:10 +00:00
from homeassistant.helpers.entity import DeviceInfo, Entity
from .const import DOMAIN
class TractiveEntity(Entity):
"""Tractive entity class."""
_attr_has_entity_name = True
def __init__(
self, user_id: str, trackable: dict[str, Any], tracker_details: dict[str, Any]
) -> None:
"""Initialize tracker entity."""
2021-10-16 21:51:10 +00:00
self._attr_device_info = DeviceInfo(
configuration_url="https://my.tractive.com/",
2021-10-16 21:51:10 +00:00
identifiers={(DOMAIN, tracker_details["_id"])},
name=trackable["details"]["name"],
2021-10-16 21:51:10 +00:00
manufacturer="Tractive GmbH",
sw_version=tracker_details["fw_version"],
model=tracker_details["model_number"],
)
self._user_id = user_id
self._tracker_id = tracker_details["_id"]
self._trackable = trackable