2021-08-23 22:20:28 +00:00
|
|
|
"""A entity class for Tractive integration."""
|
2021-10-03 07:13:12 +00:00
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
from typing import Any
|
2021-08-23 22:20:28 +00:00
|
|
|
|
2021-10-16 21:51:10 +00:00
|
|
|
from homeassistant.helpers.entity import DeviceInfo, Entity
|
2021-08-23 22:20:28 +00:00
|
|
|
|
|
|
|
from .const import DOMAIN
|
|
|
|
|
|
|
|
|
|
|
|
class TractiveEntity(Entity):
|
|
|
|
"""Tractive entity class."""
|
|
|
|
|
2023-07-11 06:09:57 +00:00
|
|
|
_attr_has_entity_name = True
|
|
|
|
|
2021-10-03 07:13:12 +00:00
|
|
|
def __init__(
|
|
|
|
self, user_id: str, trackable: dict[str, Any], tracker_details: dict[str, Any]
|
|
|
|
) -> None:
|
2021-08-23 22:20:28 +00:00
|
|
|
"""Initialize tracker entity."""
|
2021-10-16 21:51:10 +00:00
|
|
|
self._attr_device_info = DeviceInfo(
|
2021-10-19 17:57:01 +00:00
|
|
|
configuration_url="https://my.tractive.com/",
|
2021-10-16 21:51:10 +00:00
|
|
|
identifiers={(DOMAIN, tracker_details["_id"])},
|
2022-07-17 13:01:26 +00:00
|
|
|
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"],
|
|
|
|
)
|
2021-08-23 22:20:28 +00:00
|
|
|
self._user_id = user_id
|
|
|
|
self._tracker_id = tracker_details["_id"]
|
|
|
|
self._trackable = trackable
|