Use DEVICE_CLASS_WINDOW constant in various integrations (#39949)

This commit is contained in:
springstan 2020-09-12 04:24:23 +02:00 committed by GitHub
parent a6d3ee90f0
commit f93c0c5cd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 32 additions and 14 deletions

View File

@ -7,6 +7,7 @@ import voluptuous as vol
from homeassistant.components.cover import (
ATTR_POSITION,
DEVICE_CLASS_WINDOW,
PLATFORM_SCHEMA,
SUPPORT_CLOSE,
SUPPORT_OPEN,
@ -19,7 +20,6 @@ import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name__)
COVER_FEATURES = SUPPORT_OPEN | SUPPORT_CLOSE | SUPPORT_SET_POSITION
DEVICE_CLASS = "window"
ATTR_REQUEST_POSITION = "request_position"
NOTIFICATION_ID = "brunt_notification"
@ -141,7 +141,7 @@ class BruntDevice(CoverEntity):
@property
def device_class(self):
"""Return the class of this device, from component DEVICE_CLASSES."""
return DEVICE_CLASS
return DEVICE_CLASS_WINDOW
@property
def supported_features(self):

View File

@ -1,6 +1,7 @@
"""Support for deCONZ covers."""
from homeassistant.components.cover import (
ATTR_POSITION,
DEVICE_CLASS_WINDOW,
SUPPORT_CLOSE,
SUPPORT_OPEN,
SUPPORT_SET_POSITION,
@ -74,7 +75,7 @@ class DeconzCover(DeconzDevice, CoverEntity):
if self._device.type in DAMPERS:
return "damper"
if self._device.type in WINDOW_COVERS:
return "window"
return DEVICE_CLASS_WINDOW
@property
def supported_features(self):

View File

@ -1,7 +1,11 @@
"""Support for Fibaro binary sensors."""
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 . import FIBARO_DEVICES, FibaroDevice
@ -12,7 +16,7 @@ SENSOR_TYPES = {
"com.fibaro.floodSensor": ["Flood", "mdi:water", "flood"],
"com.fibaro.motionSensor": ["Motion", "mdi:run", "motion"],
"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.FGMS001": ["Motion", "mdi:run", "motion"],
"com.fibaro.heatDetector": ["Heat", "mdi:fire", "heat"],

View File

@ -1,7 +1,10 @@
"""Support for Fritzbox binary sensors."""
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 .const import CONF_CONNECTIONS, DOMAIN as FRITZBOX_DOMAIN, LOGGER
@ -53,7 +56,7 @@ class FritzboxBinarySensor(BinarySensorEntity):
@property
def device_class(self):
"""Return the class of this sensor."""
return "window"
return DEVICE_CLASS_WINDOW
@property
def is_on(self):

View File

@ -1,7 +1,10 @@
"""Support for MAX! binary sensors via MAX! Cube."""
import logging
from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_WINDOW,
BinarySensorEntity,
)
from . import DATA_KEY
@ -30,7 +33,7 @@ class MaxCubeShutter(BinarySensorEntity):
def __init__(self, handler, name, rf_address):
"""Initialize MAX! Cube BinarySensorEntity."""
self._name = name
self._sensor_type = "window"
self._sensor_type = DEVICE_CLASS_WINDOW
self._rf_address = rf_address
self._cubehandle = handler
self._state = None

View File

@ -2,7 +2,10 @@
import logging
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.core import HomeAssistant, callback
@ -33,8 +36,8 @@ BINARY_SENSOR_TYPES = {
SENSOR_SAFE: ("Safe", "door"),
SENSOR_SLIDING: ("Sliding Door/Window", "door"),
SENSOR_SMOKE_CO: ("Smoke/Carbon Monoxide Detector", "smoke"),
SENSOR_WINDOW_HINGED_HORIZONTAL: ("Hinged Window", "window"),
SENSOR_WINDOW_HINGED_VERTICAL: ("Hinged Window", "window"),
SENSOR_WINDOW_HINGED_HORIZONTAL: ("Hinged Window", DEVICE_CLASS_WINDOW),
SENSOR_WINDOW_HINGED_VERTICAL: ("Hinged Window", DEVICE_CLASS_WINDOW),
}

View File

@ -1,7 +1,11 @@
"""Cover Platform for the Somfy MyLink component."""
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 . import CONF_DEFAULT_REVERSE, DATA_SOMFY_MYLINK
@ -49,7 +53,7 @@ class SomfyShade(CoverEntity):
target_id,
name="SomfyShade",
reverse=False,
device_class="window",
device_class=DEVICE_CLASS_WINDOW,
):
"""Initialize the cover."""
self.somfy_mylink = somfy_mylink