Add entity category to Tractive (#57720)

pull/57743/head
Maciej Bieniek 2021-10-15 02:46:25 +02:00 committed by GitHub
parent b0ff28ceb4
commit e7e88d6a19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 1 deletions

View File

@ -9,7 +9,7 @@ from homeassistant.components.binary_sensor import (
BinarySensorEntityDescription,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_BATTERY_CHARGING
from homeassistant.const import ATTR_BATTERY_CHARGING, ENTITY_CATEGORY_DIAGNOSTIC
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -77,6 +77,7 @@ SENSOR_TYPE = BinarySensorEntityDescription(
key=ATTR_BATTERY_CHARGING,
name="Battery Charging",
device_class=DEVICE_CLASS_BATTERY_CHARGING,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
)

View File

@ -9,6 +9,7 @@ from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
ATTR_BATTERY_LEVEL,
DEVICE_CLASS_BATTERY,
ENTITY_CATEGORY_DIAGNOSTIC,
PERCENTAGE,
TIME_MINUTES,
)
@ -134,6 +135,7 @@ SENSOR_TYPES: tuple[TractiveSensorEntityDescription, ...] = (
native_unit_of_measurement=PERCENTAGE,
device_class=DEVICE_CLASS_BATTERY,
entity_class=TractiveHardwareSensor,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
),
TractiveSensorEntityDescription(
key=ATTR_MINUTES_ACTIVE,

View File

@ -9,6 +9,7 @@ from aiotractive.exceptions import TractiveError
from homeassistant.components.switch import SwitchEntity, SwitchEntityDescription
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ENTITY_CATEGORY_CONFIG
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -49,18 +50,21 @@ SWITCH_TYPES: tuple[TractiveSwitchEntityDescription, ...] = (
name="Tracker Buzzer",
icon="mdi:volume-high",
method="async_set_buzzer",
entity_category=ENTITY_CATEGORY_CONFIG,
),
TractiveSwitchEntityDescription(
key=ATTR_LED,
name="Tracker LED",
icon="mdi:led-on",
method="async_set_led",
entity_category=ENTITY_CATEGORY_CONFIG,
),
TractiveSwitchEntityDescription(
key=ATTR_LIVE_TRACKING,
name="Live Tracking",
icon="mdi:map-marker-path",
method="async_set_live_tracking",
entity_category=ENTITY_CATEGORY_CONFIG,
),
)