Use BinarySensorDeviceClass in ffmpeg (#61436)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2021-12-10 14:54:41 +01:00 committed by GitHub
parent f1979f8b68
commit 25838e97e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -3,8 +3,8 @@ import haffmpeg.sensor as ffmpeg_sensor
import voluptuous as vol import voluptuous as vol
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASS_MOTION,
PLATFORM_SCHEMA, PLATFORM_SCHEMA,
BinarySensorDeviceClass,
BinarySensorEntity, BinarySensorEntity,
) )
from homeassistant.components.ffmpeg import ( from homeassistant.components.ffmpeg import (
@ -115,4 +115,4 @@ class FFmpegMotion(FFmpegBinarySensor):
@property @property
def device_class(self): def device_class(self):
"""Return the class of this sensor, from DEVICE_CLASSES.""" """Return the class of this sensor, from DEVICE_CLASSES."""
return DEVICE_CLASS_MOTION return BinarySensorDeviceClass.MOTION

View File

@ -2,7 +2,10 @@
import haffmpeg.sensor as ffmpeg_sensor import haffmpeg.sensor as ffmpeg_sensor
import voluptuous as vol import voluptuous as vol
from homeassistant.components.binary_sensor import DEVICE_CLASS_SOUND, PLATFORM_SCHEMA from homeassistant.components.binary_sensor import (
PLATFORM_SCHEMA,
BinarySensorDeviceClass,
)
from homeassistant.components.ffmpeg import ( from homeassistant.components.ffmpeg import (
CONF_EXTRA_ARGUMENTS, CONF_EXTRA_ARGUMENTS,
CONF_INITIAL_STATE, CONF_INITIAL_STATE,
@ -78,4 +81,4 @@ class FFmpegNoise(FFmpegBinarySensor):
@property @property
def device_class(self): def device_class(self):
"""Return the class of this sensor, from DEVICE_CLASSES.""" """Return the class of this sensor, from DEVICE_CLASSES."""
return DEVICE_CLASS_SOUND return BinarySensorDeviceClass.SOUND