Skip to content

Commit d542e49

Browse files
committed
clean up
1 parent cc2819e commit d542e49

File tree

29 files changed

+117
-117
lines changed

29 files changed

+117
-117
lines changed

tests/websocket/test_client_controller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from zha.application.model import DeviceJoinedEvent, DeviceLeftEvent
2323
from zha.application.platforms import WebSocketClientEntity
2424
from zha.application.platforms.switch import WebSocketClientSwitchEntity
25-
from zha.websocket.const import ControllerEvents
25+
from zha.const import ControllerEvents
2626
from zha.websocket.server.api.model import (
2727
ReadClusterAttributesResponse,
2828
WriteClusterAttributeResponse,

zha/application/gateway.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
create_eager_task,
7979
gather_with_limited_concurrency,
8080
)
81+
from zha.const import ControllerEvents, DeviceEvents
8182
from zha.event import EventBase
8283
from zha.model import BaseEvent
8384
from zha.websocket import ZHAWebSocketException
@@ -102,7 +103,7 @@
102103
SwitchHelper,
103104
UpdateHelper,
104105
)
105-
from zha.websocket.const import WEBSOCKET_API, ControllerEvents, DeviceEvents
106+
from zha.websocket.const import WEBSOCKET_API
106107
from zha.websocket.server.client import ClientManager, load_api as load_client_api
107108
from zha.zigbee.device import BaseDevice, Device, WebSocketClientDevice
108109
from zha.zigbee.endpoint import ATTR_IN_CLUSTERS, ATTR_OUT_CLUSTERS
@@ -1126,7 +1127,7 @@ def handle_zha_event(self, event: ZHAEvent) -> None:
11261127
if device is None:
11271128
_LOGGER.warning("Received zha_event from unknown device: %s", event)
11281129
return
1129-
device.emit("zha_event", event)
1130+
device.emit(DeviceEvents.ZHA_EVENT, event)
11301131

11311132
def handle_device_joined(self, event: DeviceJoinedEvent) -> None:
11321133
"""Handle device joined.

zha/application/model.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@
1717
CONF_DEFAULT_CONSIDER_UNAVAILABLE_BATTERY,
1818
CONF_DEFAULT_CONSIDER_UNAVAILABLE_MAINS,
1919
)
20-
from zha.const import EventTypes
20+
from zha.const import ControllerEvents, DeviceEvents, EventTypes
2121
from zha.model import BaseEvent, BaseModel
22-
from zha.websocket.const import ControllerEvents, DeviceEvents
2322
from zha.zigbee.model import DeviceInfo, ExtendedDeviceInfo, GroupInfo
2423

2524
if TYPE_CHECKING:

zha/application/platforms/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
PlatformEntityIdentifiers,
2222
T as BaseEntityInfoType,
2323
)
24-
from zha.const import STATE_CHANGED
24+
from zha.const import STATE_CHANGED, EntityEvents, EventTypes
2525
from zha.debounce import Debouncer
2626
from zha.event import EventBase
2727
from zha.mixins import LogMixin
@@ -44,8 +44,8 @@
4444
class EntityStateChangedEvent(BaseEvent):
4545
"""Event for when an entity state changes."""
4646

47-
event_type: Literal["entity"] = "entity"
48-
event: Literal["state_changed"] = "state_changed"
47+
event_type: Literal[EventTypes.ENTITY_EVENT] = EventTypes.ENTITY_EVENT
48+
event: Literal[EntityEvents.STATE_CHANGED] = EntityEvents.STATE_CHANGED
4949
platform: Platform
5050
unique_id: str
5151
device_ieee: EUI64 | None = None

zha/application/platforms/alarm_control_panel/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
)
2323
from zha.application.platforms.model import EntityState
2424
from zha.application.registries import PLATFORM_ENTITIES
25-
from zha.websocket.const import MODEL_CLASS_NAME
25+
from zha.const import MODEL_CLASS_NAME
2626
from zha.zigbee.cluster_handlers.const import (
2727
CLUSTER_HANDLER_IAS_ACE,
2828
CLUSTER_HANDLER_STATE_CHANGED,

zha/application/platforms/binary_sensor/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from zha.application.platforms.helpers import validate_device_class
2222
from zha.application.platforms.model import EntityState
2323
from zha.application.registries import PLATFORM_ENTITIES
24-
from zha.websocket.const import MODEL_CLASS_NAME
24+
from zha.const import MODEL_CLASS_NAME
2525
from zha.zigbee.cluster_handlers.const import (
2626
CLUSTER_HANDLER_ACCELEROMETER,
2727
CLUSTER_HANDLER_ATTRIBUTE_UPDATED,

zha/application/platforms/button/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from zha.application.platforms.const import EntityCategory
2222
from zha.application.platforms.model import EntityState
2323
from zha.application.registries import PLATFORM_ENTITIES
24-
from zha.websocket.const import MODEL_CLASS_NAME
24+
from zha.const import MODEL_CLASS_NAME
2525
from zha.zigbee.cluster_handlers.const import CLUSTER_HANDLER_IDENTIFY
2626

2727
if TYPE_CHECKING:

zha/application/platforms/climate/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@
4242
ThermostatState,
4343
)
4444
from zha.application.registries import PLATFORM_ENTITIES
45+
from zha.const import MODEL_CLASS_NAME
4546
from zha.decorators import periodic
4647
from zha.units import UnitOfTemperature
47-
from zha.websocket.const import MODEL_CLASS_NAME
4848
from zha.zigbee.cluster_handlers.const import (
4949
CLUSTER_HANDLER_ATTRIBUTE_UPDATED,
5050
CLUSTER_HANDLER_FAN,

zha/application/platforms/cover/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
ShadeState,
3434
)
3535
from zha.application.registries import PLATFORM_ENTITIES
36+
from zha.const import MODEL_CLASS_NAME
3637
from zha.exceptions import ZHAException
37-
from zha.websocket.const import MODEL_CLASS_NAME
3838
from zha.zigbee.cluster_handlers.closures import WindowCoveringClusterHandler
3939
from zha.zigbee.cluster_handlers.const import (
4040
CLUSTER_HANDLER_ATTRIBUTE_UPDATED,

zha/application/platforms/device_tracker/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
)
1919
from zha.application.platforms.sensor import Battery
2020
from zha.application.registries import PLATFORM_ENTITIES
21+
from zha.const import MODEL_CLASS_NAME
2122
from zha.decorators import periodic
22-
from zha.websocket.const import MODEL_CLASS_NAME
2323
from zha.zigbee.cluster_handlers.const import (
2424
CLUSTER_HANDLER_ATTRIBUTE_UPDATED,
2525
CLUSTER_HANDLER_POWER_CONFIGURATION,

0 commit comments

Comments
 (0)