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