Use new DeviceClass enums in fibaro (#61437)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
172237f4f1
commit
6677dd8507
2 changed files with 15 additions and 18 deletions
|
@ -1,10 +1,7 @@
|
||||||
"""Support for Fibaro binary sensors."""
|
"""Support for Fibaro binary sensors."""
|
||||||
from homeassistant.components.binary_sensor import (
|
from homeassistant.components.binary_sensor import (
|
||||||
DEVICE_CLASS_DOOR,
|
|
||||||
DEVICE_CLASS_MOTION,
|
|
||||||
DEVICE_CLASS_SMOKE,
|
|
||||||
DEVICE_CLASS_WINDOW,
|
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
|
BinarySensorDeviceClass,
|
||||||
BinarySensorEntity,
|
BinarySensorEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_DEVICE_CLASS, CONF_ICON
|
from homeassistant.const import CONF_DEVICE_CLASS, CONF_ICON
|
||||||
|
@ -13,11 +10,15 @@ from . import FIBARO_DEVICES, FibaroDevice
|
||||||
|
|
||||||
SENSOR_TYPES = {
|
SENSOR_TYPES = {
|
||||||
"com.fibaro.floodSensor": ["Flood", "mdi:water", "flood"],
|
"com.fibaro.floodSensor": ["Flood", "mdi:water", "flood"],
|
||||||
"com.fibaro.motionSensor": ["Motion", "mdi:run", DEVICE_CLASS_MOTION],
|
"com.fibaro.motionSensor": ["Motion", "mdi:run", BinarySensorDeviceClass.MOTION],
|
||||||
"com.fibaro.doorSensor": ["Door", "mdi:window-open", DEVICE_CLASS_DOOR],
|
"com.fibaro.doorSensor": ["Door", "mdi:window-open", BinarySensorDeviceClass.DOOR],
|
||||||
"com.fibaro.windowSensor": ["Window", "mdi:window-open", DEVICE_CLASS_WINDOW],
|
"com.fibaro.windowSensor": [
|
||||||
"com.fibaro.smokeSensor": ["Smoke", "mdi:smoking", DEVICE_CLASS_SMOKE],
|
"Window",
|
||||||
"com.fibaro.FGMS001": ["Motion", "mdi:run", DEVICE_CLASS_MOTION],
|
"mdi:window-open",
|
||||||
|
BinarySensorDeviceClass.WINDOW,
|
||||||
|
],
|
||||||
|
"com.fibaro.smokeSensor": ["Smoke", "mdi:smoking", BinarySensorDeviceClass.SMOKE],
|
||||||
|
"com.fibaro.FGMS001": ["Motion", "mdi:run", BinarySensorDeviceClass.MOTION],
|
||||||
"com.fibaro.heatDetector": ["Heat", "mdi:fire", "heat"],
|
"com.fibaro.heatDetector": ["Heat", "mdi:fire", "heat"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,9 @@
|
||||||
"""Support for Fibaro sensors."""
|
"""Support for Fibaro sensors."""
|
||||||
from contextlib import suppress
|
from contextlib import suppress
|
||||||
|
|
||||||
from homeassistant.components.sensor import DOMAIN, SensorEntity
|
from homeassistant.components.sensor import DOMAIN, SensorDeviceClass, SensorEntity
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONCENTRATION_PARTS_PER_MILLION,
|
CONCENTRATION_PARTS_PER_MILLION,
|
||||||
DEVICE_CLASS_CO2,
|
|
||||||
DEVICE_CLASS_HUMIDITY,
|
|
||||||
DEVICE_CLASS_ILLUMINANCE,
|
|
||||||
DEVICE_CLASS_TEMPERATURE,
|
|
||||||
LIGHT_LUX,
|
LIGHT_LUX,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
|
@ -21,7 +17,7 @@ SENSOR_TYPES = {
|
||||||
"Temperature",
|
"Temperature",
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
DEVICE_CLASS_TEMPERATURE,
|
SensorDeviceClass.TEMPERATURE,
|
||||||
],
|
],
|
||||||
"com.fibaro.smokeSensor": [
|
"com.fibaro.smokeSensor": [
|
||||||
"Smoke",
|
"Smoke",
|
||||||
|
@ -34,15 +30,15 @@ SENSOR_TYPES = {
|
||||||
CONCENTRATION_PARTS_PER_MILLION,
|
CONCENTRATION_PARTS_PER_MILLION,
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
DEVICE_CLASS_CO2,
|
SensorDeviceClass.CO2,
|
||||||
],
|
],
|
||||||
"com.fibaro.humiditySensor": [
|
"com.fibaro.humiditySensor": [
|
||||||
"Humidity",
|
"Humidity",
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
None,
|
None,
|
||||||
DEVICE_CLASS_HUMIDITY,
|
SensorDeviceClass.HUMIDITY,
|
||||||
],
|
],
|
||||||
"com.fibaro.lightSensor": ["Light", LIGHT_LUX, None, DEVICE_CLASS_ILLUMINANCE],
|
"com.fibaro.lightSensor": ["Light", LIGHT_LUX, None, SensorDeviceClass.ILLUMINANCE],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue