mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
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>
This commit is contained in:
parent
dda4cf4d58
commit
87425d4ab1
@ -1,7 +1,10 @@
|
|||||||
"""Support for Synology DSM binary sensors."""
|
"""Support for Synology DSM binary sensors."""
|
||||||
from typing import Dict
|
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.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_DISKS
|
from homeassistant.const import CONF_DISKS
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.helpers.typing import HomeAssistantType
|
||||||
@ -14,6 +17,8 @@ from .const import (
|
|||||||
SYNO_API,
|
SYNO_API,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
DEFAULT_DEVICE_CLASS = DEVICE_CLASS_SAFETY
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
|
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
|
||||||
@ -71,3 +76,8 @@ class SynoDSMStorageBinarySensor(SynologyDSMDeviceEntity, BinarySensorEntity):
|
|||||||
if attr is None:
|
if attr is None:
|
||||||
return None
|
return None
|
||||||
return attr
|
return attr
|
||||||
|
|
||||||
|
@property
|
||||||
|
def device_class(self):
|
||||||
|
"""Return the device class of this binary sensor."""
|
||||||
|
return DEFAULT_DEVICE_CLASS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user