hass-core/homeassistant/components/tractive/entity.py
Maciej Bieniek 09b872d51f
Add sensor platform for Tractive integration (#54143)
* Add sensor platform

* Add extra_state_attributes

* Add more constants

* Add sensor.py to .coveragerc file

* Use native value

* Suggested change

* Move SENSOR_TYPES to sensor platform

* Add domain as prefix to the signal

* Use TractiveEntity class

* Add model.py to .coveragerc file

* Clean up files

* Add entity_class attribute to TractiveSensorEntityDescription class

* TractiveEntity inherits from Entity

* Suggested change

* Define _attr_icon as class attribute

Co-authored-by: Daniel Hjelseth Høyer <mail@dahoiv.net>
2021-08-24 00:20:28 +02:00

22 lines
733 B
Python

"""A entity class for Tractive integration."""
from homeassistant.helpers.entity import Entity
from .const import DOMAIN
class TractiveEntity(Entity):
"""Tractive entity class."""
def __init__(self, user_id, trackable, tracker_details):
"""Initialize tracker entity."""
self._attr_device_info = {
"identifiers": {(DOMAIN, tracker_details["_id"])},
"name": f"Tractive ({tracker_details['_id']})",
"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