|
8 | 8 | from aiomqtt.types import PayloadType |
9 | 9 |
|
10 | 10 | from letpot.exceptions import LetPotException |
11 | | -from letpot.models import LetPotDeviceStatus |
| 11 | +from letpot.models import DeviceFeature, LetPotDeviceStatus |
12 | 12 |
|
13 | 13 | _LOGGER = logging.getLogger(__name__) |
14 | 14 |
|
@@ -40,6 +40,10 @@ def supports_type(device_type: str) -> bool: |
40 | 40 | def get_device_model(self) -> tuple[str, str] | None: |
41 | 41 | """Returns the device model name and code.""" |
42 | 42 |
|
| 43 | + @abstractmethod |
| 44 | + def supported_features(self) -> DeviceFeature: |
| 45 | + """Returns the device supported feature(s).""" |
| 46 | + |
43 | 47 | @abstractmethod |
44 | 48 | def get_current_status_message(self) -> list[int]: |
45 | 49 | """Returns the message content for getting the current device status.""" |
@@ -91,6 +95,12 @@ def get_device_model(self) -> tuple[str, str] | None: |
91 | 95 | else: |
92 | 96 | return None |
93 | 97 |
|
| 98 | + def supported_features(self) -> DeviceFeature: |
| 99 | + features = DeviceFeature.PUMP_STATUS |
| 100 | + if self._device_type in ["LPH21", "LPH31"]: |
| 101 | + features |= DeviceFeature.LIGHT_BRIGHTNESS_LOW_HIGH |
| 102 | + return features |
| 103 | + |
94 | 104 | def get_current_status_message(self) -> list[int]: |
95 | 105 | return [97, 1] |
96 | 106 |
|
@@ -157,6 +167,9 @@ def get_device_model(self) -> tuple[str, str] | None: |
157 | 167 | else: |
158 | 168 | return None |
159 | 169 |
|
| 170 | + def supported_features(self) -> DeviceFeature: |
| 171 | + return DeviceFeature(0) |
| 172 | + |
160 | 173 | def get_current_status_message(self) -> list[int]: |
161 | 174 | return [11, 1] |
162 | 175 |
|
@@ -212,6 +225,17 @@ def supports_type(device_type: str) -> bool: |
212 | 225 | def get_device_model(self) -> tuple[str, str] | None: |
213 | 226 | return MODEL_MAX |
214 | 227 |
|
| 228 | + def supported_features(self) -> DeviceFeature: |
| 229 | + features = ( |
| 230 | + DeviceFeature.LIGHT_BRIGHTNESS_LEVELS |
| 231 | + | DeviceFeature.PUMP_AUTO |
| 232 | + | DeviceFeature.TEMPERATURE |
| 233 | + | DeviceFeature.WATER_LEVEL |
| 234 | + ) |
| 235 | + if self._device_type != "LPH60": |
| 236 | + features |= DeviceFeature.NUTRIENT_BUTTON |
| 237 | + return features |
| 238 | + |
215 | 239 | def get_current_status_message(self) -> list[int]: |
216 | 240 | return [13, 1] |
217 | 241 |
|
@@ -278,6 +302,16 @@ def supports_type(device_type: str) -> bool: |
278 | 302 | def get_device_model(self) -> tuple[str, str] | None: |
279 | 303 | return MODEL_MAX |
280 | 304 |
|
| 305 | + def supported_features(self) -> DeviceFeature: |
| 306 | + return ( |
| 307 | + DeviceFeature.LIGHT_BRIGHTNESS_LEVELS |
| 308 | + | DeviceFeature.NUTRIENT_BUTTON |
| 309 | + | DeviceFeature.PUMP_AUTO |
| 310 | + | DeviceFeature.PUMP_STATUS |
| 311 | + | DeviceFeature.TEMPERATURE |
| 312 | + | DeviceFeature.WATER_LEVEL |
| 313 | + ) |
| 314 | + |
281 | 315 | def get_current_status_message(self) -> list[int]: |
282 | 316 | return [101, 1] |
283 | 317 |
|
|
0 commit comments