Add device_class safety to synology_dsm storage binary_sensors (#39310)
* add device_class: safety to storage binary_sensors * Update binary_sensor.py * Update homeassistant/components/synology_dsm/binary_sensor.py Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Update binary_sensor.py * Import device_class Safety from homeassistant.components.binary_sensor * Update binary_sensor.py Co-authored-by: Martin Hjelmare <marhje52@gmail.com>pull/39404/head
parent
dda4cf4d58
commit
87425d4ab1
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue