1{
2 lib,
3 awesomeversion,
4 bellows,
5 buildPythonPackage,
6 fetchFromGitHub,
7 pyserial,
8 pyserial-asyncio,
9 pyserial-asyncio-fast,
10 pytest-asyncio,
11 pytest-timeout,
12 pytest-xdist,
13 pytestCheckHook,
14 python-slugify,
15 pythonOlder,
16 setuptools,
17 universal-silabs-flasher,
18 wheel,
19 zha-quirks,
20 zigpy,
21 zigpy-deconz,
22 zigpy-xbee,
23 zigpy-zigate,
24 zigpy-znp,
25}:
26
27buildPythonPackage rec {
28 pname = "zha";
29 version = "0.0.23";
30 pyproject = true;
31
32 disabled = pythonOlder "3.12";
33
34 src = fetchFromGitHub {
35 owner = "zigpy";
36 repo = "zha";
37 rev = "refs/tags/${version}";
38 hash = "sha256-a0rr8pJCoVtDR3iNCDpLZnapetzNHMj8uCu667lNcGE=";
39 };
40
41 postPatch = ''
42 substituteInPlace pyproject.toml \
43 --replace-fail '"setuptools-git-versioning<3"' "" \
44 --replace-fail 'dynamic = ["version"]' 'version = "${version}"'
45 '';
46
47 pythonRelaxDeps = [
48 "bellows"
49 "pyserial-asyncio-fast"
50 "universal-silabs-flasher"
51 "zha-quirks"
52 "zigpy"
53 ];
54
55
56 build-system = [
57 setuptools
58 wheel
59 ];
60
61 dependencies = [
62 awesomeversion
63 bellows
64 pyserial
65 pyserial-asyncio
66 pyserial-asyncio-fast
67 python-slugify
68 universal-silabs-flasher
69 zha-quirks
70 zigpy
71 zigpy-deconz
72 zigpy-xbee
73 zigpy-zigate
74 zigpy-znp
75 ];
76
77 nativeCheckInputs = [
78 pytest-asyncio
79 pytest-timeout
80 pytest-xdist
81 pytestCheckHook
82 ];
83
84 pythonImportsCheck = [ "zha" ];
85
86 disabledTests = [
87 # Tests are long-running and often keep hanging
88 "test_check_available_no_basic_cluster_handler"
89 "test_check_available_success"
90 "test_check_available_unsuccessful"
91 "test_device_counter_sensors"
92 "test_device_tracker"
93 "test_device_unavailable_skips_entity_polling"
94 "test_elec_measurement_sensor_polling"
95 "test_electrical_measurement_init"
96 "test_group_member_assume_state"
97 "test_light_refresh"
98 "test_light"
99 "test_light"
100 "test_light"
101 "test_pollers_skip"
102 "test_sinope_time"
103 "test_siren_timed_off"
104 "test_zha_group_light_entity"
105 # flaky, either due to race conditions or timeouts
106 "test_zha_group_switch_entity"
107 "test_zha_group_fan_entity"
108 "test_startup_concurrency_limit"
109 "test_fan_ikea"
110 "test_background"
111 ];
112
113 disabledTestPaths = [ "tests/test_cluster_handlers.py" ];
114
115 pytestFlagsArray = [
116 "-v"
117 "--timeout=5"
118 ];
119
120 meta = with lib; {
121 description = "Zigbee Home Automation";
122 homepage = "https://github.com/zigpy/zha";
123 changelog = "https://github.com/zigpy/zha/releases/tag/${version}";
124 license = licenses.asl20;
125 maintainers = with maintainers; [ fab ];
126 };
127}