Clean up constants (#46948)
* Clean up constants * clean up humidifier constants * fix tests * fix prometheus tests Co-authored-by: Tobias Sauerwein <cgtobi@users.noreply.github.com>
This commit is contained in:
parent
dc880118a4
commit
ab53b49d3f
31 changed files with 69 additions and 68 deletions
|
@ -27,6 +27,7 @@ from homeassistant.const import (
|
||||||
ATTR_CODE,
|
ATTR_CODE,
|
||||||
ATTR_DEVICE_CLASS,
|
ATTR_DEVICE_CLASS,
|
||||||
ATTR_ENTITY_ID,
|
ATTR_ENTITY_ID,
|
||||||
|
ATTR_MODE,
|
||||||
ATTR_SUPPORTED_FEATURES,
|
ATTR_SUPPORTED_FEATURES,
|
||||||
ATTR_TEMPERATURE,
|
ATTR_TEMPERATURE,
|
||||||
CAST_APP_ID_HOMEASSISTANT,
|
CAST_APP_ID_HOMEASSISTANT,
|
||||||
|
@ -1424,8 +1425,8 @@ class ModesTrait(_Trait):
|
||||||
elif self.state.domain == input_select.DOMAIN:
|
elif self.state.domain == input_select.DOMAIN:
|
||||||
mode_settings["option"] = self.state.state
|
mode_settings["option"] = self.state.state
|
||||||
elif self.state.domain == humidifier.DOMAIN:
|
elif self.state.domain == humidifier.DOMAIN:
|
||||||
if humidifier.ATTR_MODE in attrs:
|
if ATTR_MODE in attrs:
|
||||||
mode_settings["mode"] = attrs.get(humidifier.ATTR_MODE)
|
mode_settings["mode"] = attrs.get(ATTR_MODE)
|
||||||
elif self.state.domain == light.DOMAIN:
|
elif self.state.domain == light.DOMAIN:
|
||||||
if light.ATTR_EFFECT in attrs:
|
if light.ATTR_EFFECT in attrs:
|
||||||
mode_settings["effect"] = attrs.get(light.ATTR_EFFECT)
|
mode_settings["effect"] = attrs.get(light.ATTR_EFFECT)
|
||||||
|
@ -1460,7 +1461,7 @@ class ModesTrait(_Trait):
|
||||||
humidifier.DOMAIN,
|
humidifier.DOMAIN,
|
||||||
humidifier.SERVICE_SET_MODE,
|
humidifier.SERVICE_SET_MODE,
|
||||||
{
|
{
|
||||||
humidifier.ATTR_MODE: requested_mode,
|
ATTR_MODE: requested_mode,
|
||||||
ATTR_ENTITY_ID: self.state.entity_id,
|
ATTR_ENTITY_ID: self.state.entity_id,
|
||||||
},
|
},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
"""Provides the constants needed for component."""
|
"""Provides the constants needed for component."""
|
||||||
from homeassistant.const import ATTR_MODE # noqa: F401 pylint: disable=unused-import
|
|
||||||
|
|
||||||
MODE_NORMAL = "normal"
|
MODE_NORMAL = "normal"
|
||||||
MODE_ECO = "eco"
|
MODE_ECO = "eco"
|
||||||
MODE_AWAY = "away"
|
MODE_AWAY = "away"
|
||||||
|
|
|
@ -6,6 +6,7 @@ import voluptuous as vol
|
||||||
from homeassistant.components.device_automation import toggle_entity
|
from homeassistant.components.device_automation import toggle_entity
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_ENTITY_ID,
|
ATTR_ENTITY_ID,
|
||||||
|
ATTR_MODE,
|
||||||
ATTR_SUPPORTED_FEATURES,
|
ATTR_SUPPORTED_FEATURES,
|
||||||
CONF_DEVICE_ID,
|
CONF_DEVICE_ID,
|
||||||
CONF_DOMAIN,
|
CONF_DOMAIN,
|
||||||
|
@ -30,7 +31,7 @@ SET_MODE_SCHEMA = cv.DEVICE_ACTION_BASE_SCHEMA.extend(
|
||||||
{
|
{
|
||||||
vol.Required(CONF_TYPE): "set_mode",
|
vol.Required(CONF_TYPE): "set_mode",
|
||||||
vol.Required(CONF_ENTITY_ID): cv.entity_domain(DOMAIN),
|
vol.Required(CONF_ENTITY_ID): cv.entity_domain(DOMAIN),
|
||||||
vol.Required(const.ATTR_MODE): cv.string,
|
vol.Required(ATTR_MODE): cv.string,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -90,7 +91,7 @@ async def async_call_action_from_config(
|
||||||
service_data[const.ATTR_HUMIDITY] = config[const.ATTR_HUMIDITY]
|
service_data[const.ATTR_HUMIDITY] = config[const.ATTR_HUMIDITY]
|
||||||
elif config[CONF_TYPE] == "set_mode":
|
elif config[CONF_TYPE] == "set_mode":
|
||||||
service = const.SERVICE_SET_MODE
|
service = const.SERVICE_SET_MODE
|
||||||
service_data[const.ATTR_MODE] = config[const.ATTR_MODE]
|
service_data[ATTR_MODE] = config[ATTR_MODE]
|
||||||
else:
|
else:
|
||||||
return await toggle_entity.async_call_action_from_config(
|
return await toggle_entity.async_call_action_from_config(
|
||||||
hass, config, variables, context, DOMAIN
|
hass, config, variables, context, DOMAIN
|
||||||
|
@ -115,7 +116,7 @@ async def async_get_action_capabilities(hass, config):
|
||||||
available_modes = state.attributes.get(const.ATTR_AVAILABLE_MODES, [])
|
available_modes = state.attributes.get(const.ATTR_AVAILABLE_MODES, [])
|
||||||
else:
|
else:
|
||||||
available_modes = []
|
available_modes = []
|
||||||
fields[vol.Required(const.ATTR_MODE)] = vol.In(available_modes)
|
fields[vol.Required(ATTR_MODE)] = vol.In(available_modes)
|
||||||
else:
|
else:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import voluptuous as vol
|
||||||
from homeassistant.components.device_automation import toggle_entity
|
from homeassistant.components.device_automation import toggle_entity
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_ENTITY_ID,
|
ATTR_ENTITY_ID,
|
||||||
|
ATTR_MODE,
|
||||||
ATTR_SUPPORTED_FEATURES,
|
ATTR_SUPPORTED_FEATURES,
|
||||||
CONF_CONDITION,
|
CONF_CONDITION,
|
||||||
CONF_DEVICE_ID,
|
CONF_DEVICE_ID,
|
||||||
|
@ -28,7 +29,7 @@ MODE_CONDITION = DEVICE_CONDITION_BASE_SCHEMA.extend(
|
||||||
{
|
{
|
||||||
vol.Required(CONF_ENTITY_ID): cv.entity_id,
|
vol.Required(CONF_ENTITY_ID): cv.entity_id,
|
||||||
vol.Required(CONF_TYPE): "is_mode",
|
vol.Required(CONF_TYPE): "is_mode",
|
||||||
vol.Required(const.ATTR_MODE): str,
|
vol.Required(ATTR_MODE): str,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -72,7 +73,7 @@ def async_condition_from_config(
|
||||||
config = CONDITION_SCHEMA(config)
|
config = CONDITION_SCHEMA(config)
|
||||||
|
|
||||||
if config[CONF_TYPE] == "is_mode":
|
if config[CONF_TYPE] == "is_mode":
|
||||||
attribute = const.ATTR_MODE
|
attribute = ATTR_MODE
|
||||||
else:
|
else:
|
||||||
return toggle_entity.async_condition_from_config(config)
|
return toggle_entity.async_condition_from_config(config)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"""Intents for the humidifier integration."""
|
"""Intents for the humidifier integration."""
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.const import ATTR_ENTITY_ID, STATE_OFF
|
from homeassistant.const import ATTR_ENTITY_ID, ATTR_MODE, STATE_OFF
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import intent
|
from homeassistant.helpers import intent
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
@ -9,7 +9,6 @@ import homeassistant.helpers.config_validation as cv
|
||||||
from . import (
|
from . import (
|
||||||
ATTR_AVAILABLE_MODES,
|
ATTR_AVAILABLE_MODES,
|
||||||
ATTR_HUMIDITY,
|
ATTR_HUMIDITY,
|
||||||
ATTR_MODE,
|
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
SERVICE_SET_HUMIDITY,
|
SERVICE_SET_HUMIDITY,
|
||||||
SERVICE_SET_MODE,
|
SERVICE_SET_MODE,
|
||||||
|
|
|
@ -3,17 +3,17 @@ import asyncio
|
||||||
import logging
|
import logging
|
||||||
from typing import Any, Dict, Iterable, Optional
|
from typing import Any, Dict, Iterable, Optional
|
||||||
|
|
||||||
from homeassistant.const import SERVICE_TURN_OFF, SERVICE_TURN_ON, STATE_OFF, STATE_ON
|
from homeassistant.const import (
|
||||||
|
ATTR_MODE,
|
||||||
|
SERVICE_TURN_OFF,
|
||||||
|
SERVICE_TURN_ON,
|
||||||
|
STATE_OFF,
|
||||||
|
STATE_ON,
|
||||||
|
)
|
||||||
from homeassistant.core import Context, State
|
from homeassistant.core import Context, State
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.helpers.typing import HomeAssistantType
|
||||||
|
|
||||||
from .const import (
|
from .const import ATTR_HUMIDITY, DOMAIN, SERVICE_SET_HUMIDITY, SERVICE_SET_MODE
|
||||||
ATTR_HUMIDITY,
|
|
||||||
ATTR_MODE,
|
|
||||||
DOMAIN,
|
|
||||||
SERVICE_SET_HUMIDITY,
|
|
||||||
SERVICE_SET_MODE,
|
|
||||||
)
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_EDITABLE,
|
ATTR_EDITABLE,
|
||||||
|
ATTR_OPTION,
|
||||||
CONF_ICON,
|
CONF_ICON,
|
||||||
CONF_ID,
|
CONF_ID,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
|
@ -29,7 +30,6 @@ DOMAIN = "input_select"
|
||||||
CONF_INITIAL = "initial"
|
CONF_INITIAL = "initial"
|
||||||
CONF_OPTIONS = "options"
|
CONF_OPTIONS = "options"
|
||||||
|
|
||||||
ATTR_OPTION = "option"
|
|
||||||
ATTR_OPTIONS = "options"
|
ATTR_OPTIONS = "options"
|
||||||
ATTR_CYCLE = "cycle"
|
ATTR_CYCLE = "cycle"
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ DOMAIN = "ipp"
|
||||||
ATTR_COMMAND_SET = "command_set"
|
ATTR_COMMAND_SET = "command_set"
|
||||||
ATTR_IDENTIFIERS = "identifiers"
|
ATTR_IDENTIFIERS = "identifiers"
|
||||||
ATTR_INFO = "info"
|
ATTR_INFO = "info"
|
||||||
ATTR_LOCATION = "location"
|
|
||||||
ATTR_MANUFACTURER = "manufacturer"
|
ATTR_MANUFACTURER = "manufacturer"
|
||||||
ATTR_MARKER_TYPE = "marker_type"
|
ATTR_MARKER_TYPE = "marker_type"
|
||||||
ATTR_MARKER_LOW_LEVEL = "marker_low_level"
|
ATTR_MARKER_LOW_LEVEL = "marker_low_level"
|
||||||
|
|
|
@ -3,7 +3,7 @@ from datetime import timedelta
|
||||||
from typing import Any, Callable, Dict, List, Optional
|
from typing import Any, Callable, Dict, List, Optional
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import DEVICE_CLASS_TIMESTAMP, PERCENTAGE
|
from homeassistant.const import ATTR_LOCATION, DEVICE_CLASS_TIMESTAMP, PERCENTAGE
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.helpers.typing import HomeAssistantType
|
||||||
from homeassistant.util.dt import utcnow
|
from homeassistant.util.dt import utcnow
|
||||||
|
@ -12,7 +12,6 @@ from . import IPPDataUpdateCoordinator, IPPEntity
|
||||||
from .const import (
|
from .const import (
|
||||||
ATTR_COMMAND_SET,
|
ATTR_COMMAND_SET,
|
||||||
ATTR_INFO,
|
ATTR_INFO,
|
||||||
ATTR_LOCATION,
|
|
||||||
ATTR_MARKER_HIGH_LEVEL,
|
ATTR_MARKER_HIGH_LEVEL,
|
||||||
ATTR_MARKER_LOW_LEVEL,
|
ATTR_MARKER_LOW_LEVEL,
|
||||||
ATTR_MARKER_TYPE,
|
ATTR_MARKER_TYPE,
|
||||||
|
|
|
@ -3,6 +3,8 @@ from pymelcloud import DEVICE_TYPE_ATA, DEVICE_TYPE_ATW
|
||||||
from pymelcloud.atw_device import Zone
|
from pymelcloud.atw_device import Zone
|
||||||
|
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
|
ATTR_DEVICE_CLASS,
|
||||||
|
ATTR_ICON,
|
||||||
DEVICE_CLASS_TEMPERATURE,
|
DEVICE_CLASS_TEMPERATURE,
|
||||||
ENERGY_KILO_WATT_HOUR,
|
ENERGY_KILO_WATT_HOUR,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
|
@ -13,9 +15,7 @@ from . import MelCloudDevice
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
|
|
||||||
ATTR_MEASUREMENT_NAME = "measurement_name"
|
ATTR_MEASUREMENT_NAME = "measurement_name"
|
||||||
ATTR_ICON = "icon"
|
|
||||||
ATTR_UNIT = "unit"
|
ATTR_UNIT = "unit"
|
||||||
ATTR_DEVICE_CLASS = "device_class"
|
|
||||||
ATTR_VALUE_FN = "value_fn"
|
ATTR_VALUE_FN = "value_fn"
|
||||||
ATTR_ENABLED_FN = "enabled"
|
ATTR_ENABLED_FN = "enabled"
|
||||||
|
|
||||||
|
|
|
@ -6,12 +6,11 @@ from homeassistant.components.webhook import (
|
||||||
async_register as webhook_register,
|
async_register as webhook_register,
|
||||||
async_unregister as webhook_unregister,
|
async_unregister as webhook_unregister,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_WEBHOOK_ID
|
from homeassistant.const import ATTR_DEVICE_ID, CONF_WEBHOOK_ID
|
||||||
from homeassistant.helpers import device_registry as dr, discovery
|
from homeassistant.helpers import device_registry as dr, discovery
|
||||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
ATTR_DEVICE_ID,
|
|
||||||
ATTR_DEVICE_NAME,
|
ATTR_DEVICE_NAME,
|
||||||
ATTR_MANUFACTURER,
|
ATTR_MANUFACTURER,
|
||||||
ATTR_MODEL,
|
ATTR_MODEL,
|
||||||
|
|
|
@ -3,9 +3,10 @@ import uuid
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
from homeassistant.components import person
|
from homeassistant.components import person
|
||||||
|
from homeassistant.const import ATTR_DEVICE_ID
|
||||||
from homeassistant.helpers import entity_registry as er
|
from homeassistant.helpers import entity_registry as er
|
||||||
|
|
||||||
from .const import ATTR_APP_ID, ATTR_DEVICE_ID, ATTR_DEVICE_NAME, CONF_USER_ID, DOMAIN
|
from .const import ATTR_APP_ID, ATTR_DEVICE_NAME, CONF_USER_ID, DOMAIN
|
||||||
|
|
||||||
|
|
||||||
@config_entries.HANDLERS.register(DOMAIN)
|
@config_entries.HANDLERS.register(DOMAIN)
|
||||||
|
|
|
@ -20,7 +20,6 @@ ATTR_APP_ID = "app_id"
|
||||||
ATTR_APP_NAME = "app_name"
|
ATTR_APP_NAME = "app_name"
|
||||||
ATTR_APP_VERSION = "app_version"
|
ATTR_APP_VERSION = "app_version"
|
||||||
ATTR_CONFIG_ENTRY_ID = "entry_id"
|
ATTR_CONFIG_ENTRY_ID = "entry_id"
|
||||||
ATTR_DEVICE_ID = "device_id"
|
|
||||||
ATTR_DEVICE_NAME = "device_name"
|
ATTR_DEVICE_NAME = "device_name"
|
||||||
ATTR_MANUFACTURER = "manufacturer"
|
ATTR_MANUFACTURER = "manufacturer"
|
||||||
ATTR_MODEL = "model"
|
ATTR_MODEL = "model"
|
||||||
|
|
|
@ -7,14 +7,18 @@ from homeassistant.components.device_tracker import (
|
||||||
)
|
)
|
||||||
from homeassistant.components.device_tracker.config_entry import TrackerEntity
|
from homeassistant.components.device_tracker.config_entry import TrackerEntity
|
||||||
from homeassistant.components.device_tracker.const import SOURCE_TYPE_GPS
|
from homeassistant.components.device_tracker.const import SOURCE_TYPE_GPS
|
||||||
from homeassistant.const import ATTR_BATTERY_LEVEL, ATTR_LATITUDE, ATTR_LONGITUDE
|
from homeassistant.const import (
|
||||||
|
ATTR_BATTERY_LEVEL,
|
||||||
|
ATTR_DEVICE_ID,
|
||||||
|
ATTR_LATITUDE,
|
||||||
|
ATTR_LONGITUDE,
|
||||||
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.helpers.restore_state import RestoreEntity
|
from homeassistant.helpers.restore_state import RestoreEntity
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
ATTR_ALTITUDE,
|
ATTR_ALTITUDE,
|
||||||
ATTR_COURSE,
|
ATTR_COURSE,
|
||||||
ATTR_DEVICE_ID,
|
|
||||||
ATTR_DEVICE_NAME,
|
ATTR_DEVICE_NAME,
|
||||||
ATTR_SPEED,
|
ATTR_SPEED,
|
||||||
ATTR_VERTICAL_ACCURACY,
|
ATTR_VERTICAL_ACCURACY,
|
||||||
|
|
|
@ -7,7 +7,12 @@ from aiohttp.web import Response, json_response
|
||||||
from nacl.encoding import Base64Encoder
|
from nacl.encoding import Base64Encoder
|
||||||
from nacl.secret import SecretBox
|
from nacl.secret import SecretBox
|
||||||
|
|
||||||
from homeassistant.const import CONTENT_TYPE_JSON, HTTP_BAD_REQUEST, HTTP_OK
|
from homeassistant.const import (
|
||||||
|
ATTR_DEVICE_ID,
|
||||||
|
CONTENT_TYPE_JSON,
|
||||||
|
HTTP_BAD_REQUEST,
|
||||||
|
HTTP_OK,
|
||||||
|
)
|
||||||
from homeassistant.core import Context
|
from homeassistant.core import Context
|
||||||
from homeassistant.helpers.json import JSONEncoder
|
from homeassistant.helpers.json import JSONEncoder
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.helpers.typing import HomeAssistantType
|
||||||
|
@ -17,7 +22,6 @@ from .const import (
|
||||||
ATTR_APP_ID,
|
ATTR_APP_ID,
|
||||||
ATTR_APP_NAME,
|
ATTR_APP_NAME,
|
||||||
ATTR_APP_VERSION,
|
ATTR_APP_VERSION,
|
||||||
ATTR_DEVICE_ID,
|
|
||||||
ATTR_DEVICE_NAME,
|
ATTR_DEVICE_NAME,
|
||||||
ATTR_MANUFACTURER,
|
ATTR_MANUFACTURER,
|
||||||
ATTR_MODEL,
|
ATTR_MODEL,
|
||||||
|
|
|
@ -9,7 +9,7 @@ import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.http import HomeAssistantView
|
from homeassistant.components.http import HomeAssistantView
|
||||||
from homeassistant.components.http.data_validator import RequestDataValidator
|
from homeassistant.components.http.data_validator import RequestDataValidator
|
||||||
from homeassistant.const import CONF_WEBHOOK_ID, HTTP_CREATED
|
from homeassistant.const import ATTR_DEVICE_ID, CONF_WEBHOOK_ID, HTTP_CREATED
|
||||||
from homeassistant.helpers import config_validation as cv
|
from homeassistant.helpers import config_validation as cv
|
||||||
from homeassistant.util import slugify
|
from homeassistant.util import slugify
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@ from .const import (
|
||||||
ATTR_APP_ID,
|
ATTR_APP_ID,
|
||||||
ATTR_APP_NAME,
|
ATTR_APP_NAME,
|
||||||
ATTR_APP_VERSION,
|
ATTR_APP_VERSION,
|
||||||
ATTR_DEVICE_ID,
|
|
||||||
ATTR_DEVICE_NAME,
|
ATTR_DEVICE_NAME,
|
||||||
ATTR_MANUFACTURER,
|
ATTR_MANUFACTURER,
|
||||||
ATTR_MODEL,
|
ATTR_MODEL,
|
||||||
|
|
|
@ -23,6 +23,7 @@ from homeassistant.components.frontend import MANIFEST_JSON
|
||||||
from homeassistant.components.sensor import DEVICE_CLASSES as SENSOR_CLASSES
|
from homeassistant.components.sensor import DEVICE_CLASSES as SENSOR_CLASSES
|
||||||
from homeassistant.components.zone.const import DOMAIN as ZONE_DOMAIN
|
from homeassistant.components.zone.const import DOMAIN as ZONE_DOMAIN
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
|
ATTR_DEVICE_ID,
|
||||||
ATTR_DOMAIN,
|
ATTR_DOMAIN,
|
||||||
ATTR_SERVICE,
|
ATTR_SERVICE,
|
||||||
ATTR_SERVICE_DATA,
|
ATTR_SERVICE_DATA,
|
||||||
|
@ -49,7 +50,6 @@ from .const import (
|
||||||
ATTR_APP_VERSION,
|
ATTR_APP_VERSION,
|
||||||
ATTR_CAMERA_ENTITY_ID,
|
ATTR_CAMERA_ENTITY_ID,
|
||||||
ATTR_COURSE,
|
ATTR_COURSE,
|
||||||
ATTR_DEVICE_ID,
|
|
||||||
ATTR_DEVICE_NAME,
|
ATTR_DEVICE_NAME,
|
||||||
ATTR_EVENT_DATA,
|
ATTR_EVENT_DATA,
|
||||||
ATTR_EVENT_TYPE,
|
ATTR_EVENT_TYPE,
|
||||||
|
|
|
@ -72,7 +72,6 @@ DEFAULT_DISCOVERY = True
|
||||||
DEFAULT_WEBHOOKS = False
|
DEFAULT_WEBHOOKS = False
|
||||||
|
|
||||||
ATTR_PSEUDO = "pseudo"
|
ATTR_PSEUDO = "pseudo"
|
||||||
ATTR_NAME = "name"
|
|
||||||
ATTR_EVENT_TYPE = "event_type"
|
ATTR_EVENT_TYPE = "event_type"
|
||||||
ATTR_HEATING_POWER_REQUEST = "heating_power_request"
|
ATTR_HEATING_POWER_REQUEST = "heating_power_request"
|
||||||
ATTR_HOME_ID = "home_id"
|
ATTR_HOME_ID = "home_id"
|
||||||
|
|
|
@ -5,6 +5,7 @@ import pyombi
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
|
ATTR_NAME,
|
||||||
CONF_API_KEY,
|
CONF_API_KEY,
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
CONF_PASSWORD,
|
CONF_PASSWORD,
|
||||||
|
@ -15,7 +16,6 @@ from homeassistant.const import (
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
ATTR_NAME,
|
|
||||||
ATTR_SEASON,
|
ATTR_SEASON,
|
||||||
CONF_URLBASE,
|
CONF_URLBASE,
|
||||||
DEFAULT_PORT,
|
DEFAULT_PORT,
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""Support for Ombi."""
|
"""Support for Ombi."""
|
||||||
ATTR_NAME = "name"
|
|
||||||
ATTR_SEASON = "season"
|
ATTR_SEASON = "season"
|
||||||
|
|
||||||
CONF_URLBASE = "urlbase"
|
CONF_URLBASE = "urlbase"
|
||||||
|
|
|
@ -16,12 +16,12 @@ from homeassistant.components.http import HomeAssistantView
|
||||||
from homeassistant.components.humidifier.const import (
|
from homeassistant.components.humidifier.const import (
|
||||||
ATTR_AVAILABLE_MODES,
|
ATTR_AVAILABLE_MODES,
|
||||||
ATTR_HUMIDITY,
|
ATTR_HUMIDITY,
|
||||||
ATTR_MODE,
|
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_BATTERY_LEVEL,
|
ATTR_BATTERY_LEVEL,
|
||||||
ATTR_DEVICE_CLASS,
|
ATTR_DEVICE_CLASS,
|
||||||
ATTR_FRIENDLY_NAME,
|
ATTR_FRIENDLY_NAME,
|
||||||
|
ATTR_MODE,
|
||||||
ATTR_TEMPERATURE,
|
ATTR_TEMPERATURE,
|
||||||
ATTR_UNIT_OF_MEASUREMENT,
|
ATTR_UNIT_OF_MEASUREMENT,
|
||||||
CONTENT_TYPE_TEXT_PLAIN,
|
CONTENT_TYPE_TEXT_PLAIN,
|
||||||
|
|
|
@ -15,7 +15,7 @@ from homeassistant.components.notify import (
|
||||||
PLATFORM_SCHEMA,
|
PLATFORM_SCHEMA,
|
||||||
BaseNotificationService,
|
BaseNotificationService,
|
||||||
)
|
)
|
||||||
from homeassistant.const import HTTP_OK
|
from homeassistant.const import ATTR_ICON, HTTP_OK
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
@ -28,7 +28,6 @@ CONF_TIMEOUT = 15
|
||||||
# Top level attributes in 'data'
|
# Top level attributes in 'data'
|
||||||
ATTR_SOUND = "sound"
|
ATTR_SOUND = "sound"
|
||||||
ATTR_VIBRATION = "vibration"
|
ATTR_VIBRATION = "vibration"
|
||||||
ATTR_ICON = "icon"
|
|
||||||
ATTR_ICONCOLOR = "iconcolor"
|
ATTR_ICONCOLOR = "iconcolor"
|
||||||
ATTR_URL = "url"
|
ATTR_URL = "url"
|
||||||
ATTR_URLTITLE = "urltitle"
|
ATTR_URLTITLE = "urltitle"
|
||||||
|
|
|
@ -8,6 +8,7 @@ import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
|
ATTR_COMMAND,
|
||||||
SERVICE_TOGGLE,
|
SERVICE_TOGGLE,
|
||||||
SERVICE_TURN_OFF,
|
SERVICE_TURN_OFF,
|
||||||
SERVICE_TURN_ON,
|
SERVICE_TURN_ON,
|
||||||
|
@ -29,7 +30,6 @@ from homeassistant.loader import bind_hass
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
ATTR_ACTIVITY = "activity"
|
ATTR_ACTIVITY = "activity"
|
||||||
ATTR_COMMAND = "command"
|
|
||||||
ATTR_COMMAND_TYPE = "command_type"
|
ATTR_COMMAND_TYPE = "command_type"
|
||||||
ATTR_DEVICE = "device"
|
ATTR_DEVICE = "device"
|
||||||
ATTR_NUM_REPEATS = "num_repeats"
|
ATTR_NUM_REPEATS = "num_repeats"
|
||||||
|
|
|
@ -7,6 +7,7 @@ import voluptuous as vol
|
||||||
from homeassistant.components.lock import PLATFORM_SCHEMA, LockEntity
|
from homeassistant.components.lock import PLATFORM_SCHEMA, LockEntity
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_BATTERY_LEVEL,
|
ATTR_BATTERY_LEVEL,
|
||||||
|
ATTR_DEVICE_ID,
|
||||||
CONF_API_KEY,
|
CONF_API_KEY,
|
||||||
STATE_LOCKED,
|
STATE_LOCKED,
|
||||||
STATE_UNLOCKED,
|
STATE_UNLOCKED,
|
||||||
|
@ -14,7 +15,6 @@ from homeassistant.const import (
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
|
|
||||||
ATTR_DEVICE_ID = "device_id"
|
|
||||||
ATTR_SERIAL_NO = "serial"
|
ATTR_SERIAL_NO = "serial"
|
||||||
|
|
||||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({vol.Required(CONF_API_KEY): cv.string})
|
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({vol.Required(CONF_API_KEY): cv.string})
|
||||||
|
|
|
@ -7,7 +7,6 @@ from homeassistant.components.humidifier.const import (
|
||||||
ATTR_HUMIDITY,
|
ATTR_HUMIDITY,
|
||||||
ATTR_MAX_HUMIDITY,
|
ATTR_MAX_HUMIDITY,
|
||||||
ATTR_MIN_HUMIDITY,
|
ATTR_MIN_HUMIDITY,
|
||||||
ATTR_MODE,
|
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
MODE_AWAY,
|
MODE_AWAY,
|
||||||
MODE_ECO,
|
MODE_ECO,
|
||||||
|
@ -16,6 +15,7 @@ from homeassistant.components.humidifier.const import (
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_ENTITY_ID,
|
ATTR_ENTITY_ID,
|
||||||
|
ATTR_MODE,
|
||||||
SERVICE_TOGGLE,
|
SERVICE_TOGGLE,
|
||||||
SERVICE_TURN_OFF,
|
SERVICE_TURN_OFF,
|
||||||
SERVICE_TURN_ON,
|
SERVICE_TURN_ON,
|
||||||
|
|
|
@ -473,4 +473,4 @@ async def test_execute_request(hass_fixture, assistant_client, auth_header):
|
||||||
assert dehumidifier.attributes.get(humidifier.ATTR_HUMIDITY) == 45
|
assert dehumidifier.attributes.get(humidifier.ATTR_HUMIDITY) == 45
|
||||||
|
|
||||||
hygrostat = hass_fixture.states.get("humidifier.hygrostat")
|
hygrostat = hass_fixture.states.get("humidifier.hygrostat")
|
||||||
assert hygrostat.attributes.get(humidifier.ATTR_MODE) == "eco"
|
assert hygrostat.attributes.get(const.ATTR_MODE) == "eco"
|
||||||
|
|
|
@ -31,6 +31,7 @@ from homeassistant.const import (
|
||||||
ATTR_ASSUMED_STATE,
|
ATTR_ASSUMED_STATE,
|
||||||
ATTR_DEVICE_CLASS,
|
ATTR_DEVICE_CLASS,
|
||||||
ATTR_ENTITY_ID,
|
ATTR_ENTITY_ID,
|
||||||
|
ATTR_MODE,
|
||||||
ATTR_SUPPORTED_FEATURES,
|
ATTR_SUPPORTED_FEATURES,
|
||||||
ATTR_TEMPERATURE,
|
ATTR_TEMPERATURE,
|
||||||
SERVICE_TURN_OFF,
|
SERVICE_TURN_OFF,
|
||||||
|
@ -1778,7 +1779,7 @@ async def test_modes_humidifier(hass):
|
||||||
humidifier.ATTR_MIN_HUMIDITY: 30,
|
humidifier.ATTR_MIN_HUMIDITY: 30,
|
||||||
humidifier.ATTR_MAX_HUMIDITY: 99,
|
humidifier.ATTR_MAX_HUMIDITY: 99,
|
||||||
humidifier.ATTR_HUMIDITY: 50,
|
humidifier.ATTR_HUMIDITY: 50,
|
||||||
humidifier.ATTR_MODE: humidifier.MODE_AUTO,
|
ATTR_MODE: humidifier.MODE_AUTO,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
BASIC_CONFIG,
|
BASIC_CONFIG,
|
||||||
|
|
|
@ -4,7 +4,7 @@ import voluptuous_serialize
|
||||||
|
|
||||||
import homeassistant.components.automation as automation
|
import homeassistant.components.automation as automation
|
||||||
from homeassistant.components.humidifier import DOMAIN, const, device_condition
|
from homeassistant.components.humidifier import DOMAIN, const, device_condition
|
||||||
from homeassistant.const import STATE_OFF, STATE_ON
|
from homeassistant.const import ATTR_MODE, STATE_OFF, STATE_ON
|
||||||
from homeassistant.helpers import config_validation as cv, device_registry
|
from homeassistant.helpers import config_validation as cv, device_registry
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ async def test_get_conditions(hass, device_reg, entity_reg):
|
||||||
f"{DOMAIN}.test_5678",
|
f"{DOMAIN}.test_5678",
|
||||||
STATE_ON,
|
STATE_ON,
|
||||||
{
|
{
|
||||||
const.ATTR_MODE: const.MODE_AWAY,
|
ATTR_MODE: const.MODE_AWAY,
|
||||||
const.ATTR_AVAILABLE_MODES: [const.MODE_HOME, const.MODE_AWAY],
|
const.ATTR_AVAILABLE_MODES: [const.MODE_HOME, const.MODE_AWAY],
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -98,7 +98,7 @@ async def test_get_conditions_toggle_only(hass, device_reg, entity_reg):
|
||||||
f"{DOMAIN}.test_5678",
|
f"{DOMAIN}.test_5678",
|
||||||
STATE_ON,
|
STATE_ON,
|
||||||
{
|
{
|
||||||
const.ATTR_MODE: const.MODE_AWAY,
|
ATTR_MODE: const.MODE_AWAY,
|
||||||
const.ATTR_AVAILABLE_MODES: [const.MODE_HOME, const.MODE_AWAY],
|
const.ATTR_AVAILABLE_MODES: [const.MODE_HOME, const.MODE_AWAY],
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -127,9 +127,7 @@ async def test_get_conditions_toggle_only(hass, device_reg, entity_reg):
|
||||||
|
|
||||||
async def test_if_state(hass, calls):
|
async def test_if_state(hass, calls):
|
||||||
"""Test for turn_on and turn_off conditions."""
|
"""Test for turn_on and turn_off conditions."""
|
||||||
hass.states.async_set(
|
hass.states.async_set("humidifier.entity", STATE_ON, {ATTR_MODE: const.MODE_AWAY})
|
||||||
"humidifier.entity", STATE_ON, {const.ATTR_MODE: const.MODE_AWAY}
|
|
||||||
)
|
|
||||||
|
|
||||||
assert await async_setup_component(
|
assert await async_setup_component(
|
||||||
hass,
|
hass,
|
||||||
|
@ -213,9 +211,7 @@ async def test_if_state(hass, calls):
|
||||||
assert len(calls) == 2
|
assert len(calls) == 2
|
||||||
assert calls[1].data["some"] == "is_off event - test_event2"
|
assert calls[1].data["some"] == "is_off event - test_event2"
|
||||||
|
|
||||||
hass.states.async_set(
|
hass.states.async_set("humidifier.entity", STATE_ON, {ATTR_MODE: const.MODE_AWAY})
|
||||||
"humidifier.entity", STATE_ON, {const.ATTR_MODE: const.MODE_AWAY}
|
|
||||||
)
|
|
||||||
|
|
||||||
hass.bus.async_fire("test_event3")
|
hass.bus.async_fire("test_event3")
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
@ -223,9 +219,7 @@ async def test_if_state(hass, calls):
|
||||||
assert len(calls) == 3
|
assert len(calls) == 3
|
||||||
assert calls[2].data["some"] == "is_mode - event - test_event3"
|
assert calls[2].data["some"] == "is_mode - event - test_event3"
|
||||||
|
|
||||||
hass.states.async_set(
|
hass.states.async_set("humidifier.entity", STATE_ON, {ATTR_MODE: const.MODE_HOME})
|
||||||
"humidifier.entity", STATE_ON, {const.ATTR_MODE: const.MODE_HOME}
|
|
||||||
)
|
|
||||||
|
|
||||||
# Should not fire
|
# Should not fire
|
||||||
hass.bus.async_fire("test_event3")
|
hass.bus.async_fire("test_event3")
|
||||||
|
@ -239,7 +233,7 @@ async def test_capabilities(hass):
|
||||||
"humidifier.entity",
|
"humidifier.entity",
|
||||||
STATE_ON,
|
STATE_ON,
|
||||||
{
|
{
|
||||||
const.ATTR_MODE: const.MODE_AWAY,
|
ATTR_MODE: const.MODE_AWAY,
|
||||||
const.ATTR_AVAILABLE_MODES: [const.MODE_HOME, const.MODE_AWAY],
|
const.ATTR_AVAILABLE_MODES: [const.MODE_HOME, const.MODE_AWAY],
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
@ -6,7 +6,7 @@ import voluptuous_serialize
|
||||||
|
|
||||||
import homeassistant.components.automation as automation
|
import homeassistant.components.automation as automation
|
||||||
from homeassistant.components.humidifier import DOMAIN, const, device_trigger
|
from homeassistant.components.humidifier import DOMAIN, const, device_trigger
|
||||||
from homeassistant.const import ATTR_SUPPORTED_FEATURES, STATE_OFF, STATE_ON
|
from homeassistant.const import ATTR_MODE, ATTR_SUPPORTED_FEATURES, STATE_OFF, STATE_ON
|
||||||
from homeassistant.helpers import config_validation as cv, device_registry
|
from homeassistant.helpers import config_validation as cv, device_registry
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
|
@ -56,7 +56,7 @@ async def test_get_triggers(hass, device_reg, entity_reg):
|
||||||
STATE_ON,
|
STATE_ON,
|
||||||
{
|
{
|
||||||
const.ATTR_HUMIDITY: 23,
|
const.ATTR_HUMIDITY: 23,
|
||||||
const.ATTR_MODE: "home",
|
ATTR_MODE: "home",
|
||||||
const.ATTR_AVAILABLE_MODES: ["home", "away"],
|
const.ATTR_AVAILABLE_MODES: ["home", "away"],
|
||||||
ATTR_SUPPORTED_FEATURES: 1,
|
ATTR_SUPPORTED_FEATURES: 1,
|
||||||
},
|
},
|
||||||
|
@ -95,7 +95,7 @@ async def test_if_fires_on_state_change(hass, calls):
|
||||||
STATE_ON,
|
STATE_ON,
|
||||||
{
|
{
|
||||||
const.ATTR_HUMIDITY: 23,
|
const.ATTR_HUMIDITY: 23,
|
||||||
const.ATTR_MODE: "home",
|
ATTR_MODE: "home",
|
||||||
const.ATTR_AVAILABLE_MODES: ["home", "away"],
|
const.ATTR_AVAILABLE_MODES: ["home", "away"],
|
||||||
ATTR_SUPPORTED_FEATURES: 1,
|
ATTR_SUPPORTED_FEATURES: 1,
|
||||||
},
|
},
|
||||||
|
@ -243,7 +243,7 @@ async def test_invalid_config(hass, calls):
|
||||||
STATE_ON,
|
STATE_ON,
|
||||||
{
|
{
|
||||||
const.ATTR_HUMIDITY: 23,
|
const.ATTR_HUMIDITY: 23,
|
||||||
const.ATTR_MODE: "home",
|
ATTR_MODE: "home",
|
||||||
const.ATTR_AVAILABLE_MODES: ["home", "away"],
|
const.ATTR_AVAILABLE_MODES: ["home", "away"],
|
||||||
ATTR_SUPPORTED_FEATURES: 1,
|
ATTR_SUPPORTED_FEATURES: 1,
|
||||||
},
|
},
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
from homeassistant.components.humidifier import (
|
from homeassistant.components.humidifier import (
|
||||||
ATTR_AVAILABLE_MODES,
|
ATTR_AVAILABLE_MODES,
|
||||||
ATTR_HUMIDITY,
|
ATTR_HUMIDITY,
|
||||||
ATTR_MODE,
|
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
SERVICE_SET_HUMIDITY,
|
SERVICE_SET_HUMIDITY,
|
||||||
SERVICE_SET_MODE,
|
SERVICE_SET_MODE,
|
||||||
|
@ -10,6 +9,7 @@ from homeassistant.components.humidifier import (
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_ENTITY_ID,
|
ATTR_ENTITY_ID,
|
||||||
|
ATTR_MODE,
|
||||||
ATTR_SUPPORTED_FEATURES,
|
ATTR_SUPPORTED_FEATURES,
|
||||||
SERVICE_TURN_ON,
|
SERVICE_TURN_ON,
|
||||||
STATE_OFF,
|
STATE_OFF,
|
||||||
|
|
|
@ -4,7 +4,6 @@ import pytest
|
||||||
|
|
||||||
from homeassistant.components.humidifier.const import (
|
from homeassistant.components.humidifier.const import (
|
||||||
ATTR_HUMIDITY,
|
ATTR_HUMIDITY,
|
||||||
ATTR_MODE,
|
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
MODE_AWAY,
|
MODE_AWAY,
|
||||||
MODE_ECO,
|
MODE_ECO,
|
||||||
|
@ -13,7 +12,13 @@ from homeassistant.components.humidifier.const import (
|
||||||
SERVICE_SET_MODE,
|
SERVICE_SET_MODE,
|
||||||
)
|
)
|
||||||
from homeassistant.components.humidifier.reproduce_state import async_reproduce_states
|
from homeassistant.components.humidifier.reproduce_state import async_reproduce_states
|
||||||
from homeassistant.const import SERVICE_TURN_OFF, SERVICE_TURN_ON, STATE_OFF, STATE_ON
|
from homeassistant.const import (
|
||||||
|
ATTR_MODE,
|
||||||
|
SERVICE_TURN_OFF,
|
||||||
|
SERVICE_TURN_ON,
|
||||||
|
STATE_OFF,
|
||||||
|
STATE_ON,
|
||||||
|
)
|
||||||
from homeassistant.core import Context, State
|
from homeassistant.core import Context, State
|
||||||
|
|
||||||
from tests.common import async_mock_service
|
from tests.common import async_mock_service
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue