Skip to content

Commit

Permalink
Change device_class to BinarySensorDeviceClass (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
ReneNulschDE authored Jan 20, 2024
1 parent 664b47b commit df8218d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions custom_components/gardena_smart_system/binary_sensor.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
"""Support for Gardena Smart System websocket connection status."""
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_CONNECTIVITY,
BinarySensorDeviceClass,
BinarySensorEntity,
)

from custom_components.gardena_smart_system import GARDENA_SYSTEM

from .const import DOMAIN


async def async_setup_entry(hass, config_entry, async_add_entities):
"""Perform the setup for Gardena websocket connection status."""
async_add_entities([SmartSystemWebsocketStatus(hass.data[DOMAIN][GARDENA_SYSTEM].smart_system)], True)
async_add_entities(
[SmartSystemWebsocketStatus(hass.data[DOMAIN][GARDENA_SYSTEM].smart_system)],
True,
)


class SmartSystemWebsocketStatus(BinarySensorEntity):
Expand Down Expand Up @@ -54,4 +58,4 @@ def update_callback(self, status):
@property
def device_class(self):
"""Return the class of this device, from component DEVICE_CLASSES."""
return DEVICE_CLASS_CONNECTIVITY
return BinarySensorDeviceClass.CONNECTIVITY

0 comments on commit df8218d

Please sign in to comment.