diff --git a/homeassistant/components/synology_dsm/binary_sensor.py b/homeassistant/components/synology_dsm/binary_sensor.py index a75f57db678..c95b4298f5d 100644 --- a/homeassistant/components/synology_dsm/binary_sensor.py +++ b/homeassistant/components/synology_dsm/binary_sensor.py @@ -1,7 +1,10 @@ """Support for Synology DSM binary sensors.""" from typing import Dict -from homeassistant.components.binary_sensor import BinarySensorEntity +from homeassistant.components.binary_sensor import ( + DEVICE_CLASS_SAFETY, + BinarySensorEntity, +) from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_DISKS from homeassistant.helpers.typing import HomeAssistantType @@ -14,6 +17,8 @@ from .const import ( SYNO_API, ) +DEFAULT_DEVICE_CLASS = DEVICE_CLASS_SAFETY + async def async_setup_entry( hass: HomeAssistantType, entry: ConfigEntry, async_add_entities @@ -71,3 +76,8 @@ class SynoDSMStorageBinarySensor(SynologyDSMDeviceEntity, BinarySensorEntity): if attr is None: return None return attr + + @property + def device_class(self): + """Return the device class of this binary sensor.""" + return DEFAULT_DEVICE_CLASS