Use DEVICE_CLASS_WINDOW constant in various integrations (#39949)
This commit is contained in:
parent
a6d3ee90f0
commit
f93c0c5cd3
7 changed files with 32 additions and 14 deletions
|
@ -7,6 +7,7 @@ import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.cover import (
|
from homeassistant.components.cover import (
|
||||||
ATTR_POSITION,
|
ATTR_POSITION,
|
||||||
|
DEVICE_CLASS_WINDOW,
|
||||||
PLATFORM_SCHEMA,
|
PLATFORM_SCHEMA,
|
||||||
SUPPORT_CLOSE,
|
SUPPORT_CLOSE,
|
||||||
SUPPORT_OPEN,
|
SUPPORT_OPEN,
|
||||||
|
@ -19,7 +20,6 @@ import homeassistant.helpers.config_validation as cv
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
COVER_FEATURES = SUPPORT_OPEN | SUPPORT_CLOSE | SUPPORT_SET_POSITION
|
COVER_FEATURES = SUPPORT_OPEN | SUPPORT_CLOSE | SUPPORT_SET_POSITION
|
||||||
DEVICE_CLASS = "window"
|
|
||||||
|
|
||||||
ATTR_REQUEST_POSITION = "request_position"
|
ATTR_REQUEST_POSITION = "request_position"
|
||||||
NOTIFICATION_ID = "brunt_notification"
|
NOTIFICATION_ID = "brunt_notification"
|
||||||
|
@ -141,7 +141,7 @@ class BruntDevice(CoverEntity):
|
||||||
@property
|
@property
|
||||||
def device_class(self):
|
def device_class(self):
|
||||||
"""Return the class of this device, from component DEVICE_CLASSES."""
|
"""Return the class of this device, from component DEVICE_CLASSES."""
|
||||||
return DEVICE_CLASS
|
return DEVICE_CLASS_WINDOW
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_features(self):
|
def supported_features(self):
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
"""Support for deCONZ covers."""
|
"""Support for deCONZ covers."""
|
||||||
from homeassistant.components.cover import (
|
from homeassistant.components.cover import (
|
||||||
ATTR_POSITION,
|
ATTR_POSITION,
|
||||||
|
DEVICE_CLASS_WINDOW,
|
||||||
SUPPORT_CLOSE,
|
SUPPORT_CLOSE,
|
||||||
SUPPORT_OPEN,
|
SUPPORT_OPEN,
|
||||||
SUPPORT_SET_POSITION,
|
SUPPORT_SET_POSITION,
|
||||||
|
@ -74,7 +75,7 @@ class DeconzCover(DeconzDevice, CoverEntity):
|
||||||
if self._device.type in DAMPERS:
|
if self._device.type in DAMPERS:
|
||||||
return "damper"
|
return "damper"
|
||||||
if self._device.type in WINDOW_COVERS:
|
if self._device.type in WINDOW_COVERS:
|
||||||
return "window"
|
return DEVICE_CLASS_WINDOW
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_features(self):
|
def supported_features(self):
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
"""Support for Fibaro binary sensors."""
|
"""Support for Fibaro binary sensors."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import DOMAIN, BinarySensorEntity
|
from homeassistant.components.binary_sensor import (
|
||||||
|
DEVICE_CLASS_WINDOW,
|
||||||
|
DOMAIN,
|
||||||
|
BinarySensorEntity,
|
||||||
|
)
|
||||||
from homeassistant.const import CONF_DEVICE_CLASS, CONF_ICON
|
from homeassistant.const import CONF_DEVICE_CLASS, CONF_ICON
|
||||||
|
|
||||||
from . import FIBARO_DEVICES, FibaroDevice
|
from . import FIBARO_DEVICES, FibaroDevice
|
||||||
|
@ -12,7 +16,7 @@ SENSOR_TYPES = {
|
||||||
"com.fibaro.floodSensor": ["Flood", "mdi:water", "flood"],
|
"com.fibaro.floodSensor": ["Flood", "mdi:water", "flood"],
|
||||||
"com.fibaro.motionSensor": ["Motion", "mdi:run", "motion"],
|
"com.fibaro.motionSensor": ["Motion", "mdi:run", "motion"],
|
||||||
"com.fibaro.doorSensor": ["Door", "mdi:window-open", "door"],
|
"com.fibaro.doorSensor": ["Door", "mdi:window-open", "door"],
|
||||||
"com.fibaro.windowSensor": ["Window", "mdi:window-open", "window"],
|
"com.fibaro.windowSensor": ["Window", "mdi:window-open", DEVICE_CLASS_WINDOW],
|
||||||
"com.fibaro.smokeSensor": ["Smoke", "mdi:smoking", "smoke"],
|
"com.fibaro.smokeSensor": ["Smoke", "mdi:smoking", "smoke"],
|
||||||
"com.fibaro.FGMS001": ["Motion", "mdi:run", "motion"],
|
"com.fibaro.FGMS001": ["Motion", "mdi:run", "motion"],
|
||||||
"com.fibaro.heatDetector": ["Heat", "mdi:fire", "heat"],
|
"com.fibaro.heatDetector": ["Heat", "mdi:fire", "heat"],
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
"""Support for Fritzbox binary sensors."""
|
"""Support for Fritzbox binary sensors."""
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import BinarySensorEntity
|
from homeassistant.components.binary_sensor import (
|
||||||
|
DEVICE_CLASS_WINDOW,
|
||||||
|
BinarySensorEntity,
|
||||||
|
)
|
||||||
from homeassistant.const import CONF_DEVICES
|
from homeassistant.const import CONF_DEVICES
|
||||||
|
|
||||||
from .const import CONF_CONNECTIONS, DOMAIN as FRITZBOX_DOMAIN, LOGGER
|
from .const import CONF_CONNECTIONS, DOMAIN as FRITZBOX_DOMAIN, LOGGER
|
||||||
|
@ -53,7 +56,7 @@ class FritzboxBinarySensor(BinarySensorEntity):
|
||||||
@property
|
@property
|
||||||
def device_class(self):
|
def device_class(self):
|
||||||
"""Return the class of this sensor."""
|
"""Return the class of this sensor."""
|
||||||
return "window"
|
return DEVICE_CLASS_WINDOW
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self):
|
def is_on(self):
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
"""Support for MAX! binary sensors via MAX! Cube."""
|
"""Support for MAX! binary sensors via MAX! Cube."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import BinarySensorEntity
|
from homeassistant.components.binary_sensor import (
|
||||||
|
DEVICE_CLASS_WINDOW,
|
||||||
|
BinarySensorEntity,
|
||||||
|
)
|
||||||
|
|
||||||
from . import DATA_KEY
|
from . import DATA_KEY
|
||||||
|
|
||||||
|
@ -30,7 +33,7 @@ class MaxCubeShutter(BinarySensorEntity):
|
||||||
def __init__(self, handler, name, rf_address):
|
def __init__(self, handler, name, rf_address):
|
||||||
"""Initialize MAX! Cube BinarySensorEntity."""
|
"""Initialize MAX! Cube BinarySensorEntity."""
|
||||||
self._name = name
|
self._name = name
|
||||||
self._sensor_type = "window"
|
self._sensor_type = DEVICE_CLASS_WINDOW
|
||||||
self._rf_address = rf_address
|
self._rf_address = rf_address
|
||||||
self._cubehandle = handler
|
self._cubehandle = handler
|
||||||
self._state = None
|
self._state = None
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
import logging
|
import logging
|
||||||
from typing import Callable
|
from typing import Callable
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import BinarySensorEntity
|
from homeassistant.components.binary_sensor import (
|
||||||
|
DEVICE_CLASS_WINDOW,
|
||||||
|
BinarySensorEntity,
|
||||||
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
|
|
||||||
|
@ -33,8 +36,8 @@ BINARY_SENSOR_TYPES = {
|
||||||
SENSOR_SAFE: ("Safe", "door"),
|
SENSOR_SAFE: ("Safe", "door"),
|
||||||
SENSOR_SLIDING: ("Sliding Door/Window", "door"),
|
SENSOR_SLIDING: ("Sliding Door/Window", "door"),
|
||||||
SENSOR_SMOKE_CO: ("Smoke/Carbon Monoxide Detector", "smoke"),
|
SENSOR_SMOKE_CO: ("Smoke/Carbon Monoxide Detector", "smoke"),
|
||||||
SENSOR_WINDOW_HINGED_HORIZONTAL: ("Hinged Window", "window"),
|
SENSOR_WINDOW_HINGED_HORIZONTAL: ("Hinged Window", DEVICE_CLASS_WINDOW),
|
||||||
SENSOR_WINDOW_HINGED_VERTICAL: ("Hinged Window", "window"),
|
SENSOR_WINDOW_HINGED_VERTICAL: ("Hinged Window", DEVICE_CLASS_WINDOW),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
"""Cover Platform for the Somfy MyLink component."""
|
"""Cover Platform for the Somfy MyLink component."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.components.cover import ENTITY_ID_FORMAT, CoverEntity
|
from homeassistant.components.cover import (
|
||||||
|
DEVICE_CLASS_WINDOW,
|
||||||
|
ENTITY_ID_FORMAT,
|
||||||
|
CoverEntity,
|
||||||
|
)
|
||||||
from homeassistant.util import slugify
|
from homeassistant.util import slugify
|
||||||
|
|
||||||
from . import CONF_DEFAULT_REVERSE, DATA_SOMFY_MYLINK
|
from . import CONF_DEFAULT_REVERSE, DATA_SOMFY_MYLINK
|
||||||
|
@ -49,7 +53,7 @@ class SomfyShade(CoverEntity):
|
||||||
target_id,
|
target_id,
|
||||||
name="SomfyShade",
|
name="SomfyShade",
|
||||||
reverse=False,
|
reverse=False,
|
||||||
device_class="window",
|
device_class=DEVICE_CLASS_WINDOW,
|
||||||
):
|
):
|
||||||
"""Initialize the cover."""
|
"""Initialize the cover."""
|
||||||
self.somfy_mylink = somfy_mylink
|
self.somfy_mylink = somfy_mylink
|
||||||
|
|
Loading…
Add table
Reference in a new issue