Skip to content

Commit 1f29b72

Browse files
authored
Swap Direction enum (#2965)
* Invert use of `Server_to_Client` and `Client_to_Server` * Bump minimum zigpy version
1 parent 97d2734 commit 1f29b72

File tree

9 files changed

+15
-15
lines changed

9 files changed

+15
-15
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ readme = "README.md"
1414
license = {text = "Apache License Version 2.0"}
1515
requires-python = ">=3.8"
1616
dependencies = [
17-
"zigpy>=0.60.3",
17+
"zigpy>=0.62.0",
1818
]
1919

2020
[tool.setuptools.packages.find]

tests/test_tuya_clusters.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def test_tuya_cluster_request(
251251
):
252252
"""Test cluster specific request."""
253253

254-
hdr = zcl_f.ZCLHeader.general(1, cmd_id, direction=zcl_f.Direction.Client_to_Server)
254+
hdr = zcl_f.ZCLHeader.general(1, cmd_id, direction=zcl_f.Direction.Server_to_Client)
255255
hdr.frame_control.disable_default_response = False
256256

257257
with mock.patch.object(TuyaCluster, handler_name) as handler:
@@ -266,7 +266,7 @@ def test_tuya_cluster_request(
266266
def test_tuya_cluster_request_unk_command(default_rsp_mock, TuyaCluster):
267267
"""Test cluster specific request handler -- no handler."""
268268

269-
hdr = zcl_f.ZCLHeader.general(1, 0xFE, direction=zcl_f.Direction.Client_to_Server)
269+
hdr = zcl_f.ZCLHeader.general(1, 0xFE, direction=zcl_f.Direction.Server_to_Client)
270270
hdr.frame_control.disable_default_response = False
271271

272272
TuyaCluster.handle_cluster_request(hdr, (mock.sentinel.args,))
@@ -278,7 +278,7 @@ def test_tuya_cluster_request_unk_command(default_rsp_mock, TuyaCluster):
278278
def test_tuya_cluster_request_no_handler(default_rsp_mock, TuyaCluster):
279279
"""Test cluster specific request handler -- no handler."""
280280

281-
hdr = zcl_f.ZCLHeader.general(1, 0xFE, direction=zcl_f.Direction.Client_to_Server)
281+
hdr = zcl_f.ZCLHeader.general(1, 0xFE, direction=zcl_f.Direction.Server_to_Client)
282282
hdr.frame_control.disable_default_response = False
283283

284284
new_client_commands = TuyaCluster.client_commands.copy()

zhaquirks/adeo/color_controller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class AdeoManufacturerCluster(EventableCluster):
7171
0x00: foundation.ZCLCommandDef(
7272
"preset",
7373
{"param1": t.uint8_t, "param2": t.uint8_t},
74-
direction=foundation.Direction.Server_to_Client,
74+
direction=foundation.Direction.Client_to_Server,
7575
is_manufacturer_specific=True,
7676
)
7777
}

zhaquirks/inovelli/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ class Inovelli_VZM31SN_Cluster(CustomCluster):
163163
0x00: foundation.ZCLCommandDef(
164164
"button_event",
165165
{"button_pressed": t.uint8_t, "press_type": t.uint8_t},
166-
direction=foundation.Direction.Server_to_Client,
166+
direction=foundation.Direction.Client_to_Server,
167167
is_manufacturer_specific=True,
168168
),
169169
0x01: foundation.ZCLCommandDef(
@@ -174,13 +174,13 @@ class Inovelli_VZM31SN_Cluster(CustomCluster):
174174
"led_level": t.uint8_t,
175175
"led_duration": t.uint8_t,
176176
},
177-
direction=foundation.Direction.Server_to_Client,
177+
direction=foundation.Direction.Client_to_Server,
178178
is_manufacturer_specific=True,
179179
),
180180
0x02: foundation.ZCLCommandDef(
181181
"reset_energy_meter",
182182
{},
183-
direction=foundation.Direction.Server_to_Client,
183+
direction=foundation.Direction.Client_to_Server,
184184
is_manufacturer_specific=True,
185185
),
186186
0x03: foundation.ZCLCommandDef(
@@ -192,15 +192,15 @@ class Inovelli_VZM31SN_Cluster(CustomCluster):
192192
"led_level": t.uint8_t,
193193
"led_duration": t.uint8_t,
194194
},
195-
direction=foundation.Direction.Server_to_Client,
195+
direction=foundation.Direction.Client_to_Server,
196196
is_manufacturer_specific=True,
197197
),
198198
0x24: foundation.ZCLCommandDef(
199199
"led_effect_complete",
200200
{
201201
"notification_type": t.uint8_t,
202202
},
203-
direction=foundation.Direction.Server_to_Client,
203+
direction=foundation.Direction.Client_to_Server,
204204
is_manufacturer_specific=True,
205205
),
206206
}

zhaquirks/legrand/cable_outlet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class ServerCommandDefs(BaseCommandDefs):
8484
set_pilot_wire_mode = ZCLCommandDef(
8585
id=0x00,
8686
schema={"mode": PilotWireMode},
87-
direction=Direction.Server_to_Client,
87+
direction=Direction.Client_to_Server,
8888
is_manufacturer_specific=True,
8989
)
9090

zhaquirks/philips/rdm001.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class PhilipsRemoteCluster(CustomCluster):
8484
"param6": t.uint8_t,
8585
},
8686
is_manufacturer_specific=True,
87-
direction=foundation.Direction.Server_to_Client,
87+
direction=foundation.Direction.Client_to_Server,
8888
)
8989
}
9090
BUTTONS = {

zhaquirks/sengled/e1e_g7f.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class SengledE1EG7FManufacturerSpecificCluster(CustomCluster):
7777
"param3": t.uint8_t,
7878
"param4": t.uint8_t,
7979
},
80-
direction=foundation.Direction.Server_to_Client,
80+
direction=foundation.Direction.Client_to_Server,
8181
is_manufacturer_specific=True,
8282
)
8383
}

zhaquirks/siglis/zigfred.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class ZigfredCluster(CustomCluster):
6060
ZIGFRED_CLUSTER_COMMAND_BUTTON_EVENT: foundation.ZCLCommandDef(
6161
"button_event",
6262
{"param1": t.uint32_t},
63-
direction=foundation.Direction.Server_to_Client,
63+
direction=foundation.Direction.Client_to_Server,
6464
is_manufacturer_specific=True,
6565
),
6666
}

zhaquirks/tuya/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1572,7 +1572,7 @@ def handle_cluster_request(
15721572
"""Handle cluster specific request."""
15731573

15741574
try:
1575-
if hdr.direction == foundation.Direction.Client_to_Server:
1575+
if hdr.direction == foundation.Direction.Server_to_Client:
15761576
# server_cluster -> client_cluster cluster specific command
15771577
handler_name = f"handle_{self.client_commands[hdr.command_id].name}"
15781578
else:

0 commit comments

Comments
 (0)