mirror of
https://github.com/home-assistant/core.git
synced 2025-08-04 21:25:13 +02:00
remove SENSOR_TYPES
This commit is contained in:
@@ -7,14 +7,7 @@ import voluptuous as vol
|
||||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
ATTR_NAME,
|
||||
CONF_API_KEY,
|
||||
CONF_NAME,
|
||||
CONF_SENSORS,
|
||||
CONF_URL,
|
||||
Platform,
|
||||
)
|
||||
from homeassistant.const import ATTR_NAME, CONF_API_KEY, CONF_NAME, CONF_URL, Platform
|
||||
from homeassistant.core import HomeAssistant, ServiceCall
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
@@ -30,21 +23,16 @@ from .const import (
|
||||
EVENT_API_CALL_SUCCESS,
|
||||
SERVICE_API_CALL,
|
||||
)
|
||||
from .sensor import SENSORS_TYPES
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
INSTANCE_SCHEMA = vol.All(
|
||||
cv.deprecated(CONF_SENSORS),
|
||||
vol.Schema(
|
||||
{
|
||||
vol.Optional(CONF_URL, default=DEFAULT_URL): cv.url,
|
||||
vol.Optional(CONF_NAME): cv.string,
|
||||
vol.Required(CONF_API_USER): cv.string,
|
||||
vol.Required(CONF_API_KEY): cv.string,
|
||||
vol.Optional(CONF_SENSORS, default=list(SENSORS_TYPES)): vol.All(
|
||||
cv.ensure_list, vol.Unique(), [vol.In(list(SENSORS_TYPES))]
|
||||
),
|
||||
}
|
||||
),
|
||||
)
|
||||
|
@@ -32,21 +32,6 @@ MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=15)
|
||||
|
||||
SensorType = namedtuple("SensorType", ["name", "icon", "unit", "path"])
|
||||
|
||||
SENSORS_TYPES = {
|
||||
"name": SensorType("Name", None, None, ["profile", "name"]),
|
||||
"hp": SensorType("HP", "mdi:heart", "HP", ["stats", "hp"]),
|
||||
"maxHealth": SensorType("max HP", "mdi:heart", "HP", ["stats", "maxHealth"]),
|
||||
"mp": SensorType("Mana", "mdi:auto-fix", "MP", ["stats", "mp"]),
|
||||
"maxMP": SensorType("max Mana", "mdi:auto-fix", "MP", ["stats", "maxMP"]),
|
||||
"exp": SensorType("EXP", "mdi:star", "EXP", ["stats", "exp"]),
|
||||
"toNextLevel": SensorType("Next Lvl", "mdi:star", "EXP", ["stats", "toNextLevel"]),
|
||||
"lvl": SensorType(
|
||||
"Lvl", "mdi:arrow-up-bold-circle-outline", "Lvl", ["stats", "lvl"]
|
||||
),
|
||||
"gp": SensorType("Gold", "mdi:circle-multiple", "Gold", ["stats", "gp"]),
|
||||
"class": SensorType("Class", "mdi:sword", None, ["stats", "class"]),
|
||||
}
|
||||
|
||||
|
||||
@dataclass(kw_only=True, frozen=True)
|
||||
class HabitipySensorEntityDescription(SensorEntityDescription):
|
||||
|
Reference in New Issue
Block a user