|
4 | 4 | from collections.abc import Mapping, Callable |
5 | 5 | from typing import Any |
6 | 6 | from homeassistant.components.automation import DOMAIN as AUTOMATION_DOMAIN |
7 | | -from homeassistant.components.camera import DOMAIN as CAMERA_DOMAIN, STATE_IDLE |
| 7 | +from homeassistant.components.camera import DOMAIN as CAMERA_DOMAIN, CameraState |
8 | 8 | from homeassistant.components.group import DOMAIN as GROUP_DOMAIN |
9 | 9 | from homeassistant.components.humidifier import DOMAIN as HUMIDIFIER_DOMAIN |
10 | 10 | from homeassistant.components.input_boolean import DOMAIN as INPUT_BOOLEAN_DOMAIN |
11 | | -from homeassistant.components.lock import DOMAIN as LOCK_DOMAIN |
| 11 | +from homeassistant.components.lock import DOMAIN as LOCK_DOMAIN, LockState |
12 | 12 | from homeassistant.components.media_player import DOMAIN as MEDIA_PLAYER_DOMAIN |
13 | 13 | from homeassistant.components.remote import DOMAIN as REMOTE_DOMAIN |
14 | 14 | from homeassistant.components.scene import DOMAIN as SCENE_DOMAIN |
|
29 | 29 | SERVICE_TURN_ON, |
30 | 30 | SERVICE_UNLOCK, |
31 | 31 | SERVICE_LOCK, |
32 | | - STATE_LOCKED, |
33 | 32 | STATE_ON, |
34 | 33 | STATE_PLAYING, |
35 | 34 | ) |
@@ -120,7 +119,7 @@ def _supported_domain() -> str: |
120 | 119 | def _msg_generator( |
121 | 120 | self, |
122 | 121 | ) -> Callable[[str, ReadOnlyDict[Mapping[str, Any]]], str | int]: |
123 | | - return lambda state, attributes: MSG_OFF if state == STATE_IDLE else MSG_ON |
| 122 | + return lambda state, attributes: MSG_OFF if state == CameraState.IDLE else MSG_ON |
124 | 123 |
|
125 | 124 |
|
126 | 125 | @SYNC_TYPES.register("media_player") |
@@ -148,7 +147,7 @@ def _supported_domain() -> str: |
148 | 147 | def _msg_generator( |
149 | 148 | self, |
150 | 149 | ) -> Callable[[str, ReadOnlyDict[Mapping[str, Any]]], str | int]: |
151 | | - return lambda state, attributes: MSG_OFF if state == STATE_LOCKED else MSG_ON |
| 150 | + return lambda state, attributes: MSG_OFF if state == LockState.LOCKED else MSG_ON |
152 | 151 |
|
153 | 152 | def _service_names(self) -> tuple[str, str]: |
154 | 153 | return (SERVICE_UNLOCK, SERVICE_LOCK) |
|
0 commit comments