Skip to content

Commit 973cf14

Browse files
committed
Refactor cover entity to use updated HA constants.
Replaced deprecated cover-related constants with updated equivalents from Home Assistant's API, such as `CoverDeviceClass` and `CoverEntityFeature`. This change ensures better compatibility with the evolving Home Assistant platform and aligns the integration with current standards.
1 parent c1670f0 commit 973cf14

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

myio/cover.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@
55
from .comm.comms_thread import CommsThread2
66

77
from homeassistant.components.cover import (
8-
DEVICE_CLASS_SHADE,
8+
CoverDeviceClass,
99
STATE_CLOSING,
1010
STATE_OPENING,
11-
SUPPORT_CLOSE,
12-
SUPPORT_OPEN,
13-
SUPPORT_STOP,
11+
CoverEntityFeature,
1412
CoverEntity,
1513
)
1614
from homeassistant.const import CONF_NAME
@@ -21,7 +19,7 @@
2119
_LOGGER = logging.getLogger(__name__)
2220

2321
SCAN_INTERVAL = timedelta(seconds=3)
24-
SUPPORTED_FEATURES = SUPPORT_OPEN | SUPPORT_CLOSE | SUPPORT_STOP
22+
SUPPORTED_FEATURES = CoverEntityFeature.OPEN | CoverEntityFeature.CLOSE | CoverEntityFeature.STOP
2523
COMMS_THREAD = CommsThread2()
2624

2725

@@ -94,7 +92,7 @@ def longest_substring_finder(string1, string2):
9492
self._is_closing = False
9593
self._available = True
9694
self._supported_features = SUPPORTED_FEATURES
97-
self._device_class = DEVICE_CLASS_SHADE
95+
self._device_class = CoverDeviceClass.SHADE
9896
self._position = 50
9997

10098
@property

0 commit comments

Comments
 (0)