1{
2 lib,
3 bleak,
4 bleak-retry-connector,
5 bluetooth-data-tools,
6 bluetooth-sensor-state-data,
7 buildPythonPackage,
8 cryptography,
9 fetchFromGitHub,
10 home-assistant-bluetooth,
11 poetry-core,
12 pycryptodomex,
13 pytestCheckHook,
14 pythonOlder,
15 pythonRelaxDepsHook,
16 sensor-state-data,
17}:
18
19buildPythonPackage rec {
20 pname = "xiaomi-ble";
21 version = "0.29.0";
22 pyproject = true;
23
24 disabled = pythonOlder "3.9";
25
26 src = fetchFromGitHub {
27 owner = "Bluetooth-Devices";
28 repo = "xiaomi-ble";
29 rev = "refs/tags/v${version}";
30 hash = "sha256-+zMjnLUzI8ctucvxXts7V4lN4Gp0ZQtArhpXUCBvhF0=";
31 };
32
33 postPatch = ''
34 substituteInPlace pyproject.toml \
35 --replace-fail " --cov=xiaomi_ble --cov-report=term-missing:skip-covered" ""
36 '';
37
38 build-system = [ poetry-core ];
39
40 nativeBuildInputs = [ pythonRelaxDepsHook ];
41
42 pythonRelaxDeps = [ "pycryptodomex" ];
43
44 dependencies = [
45 bleak
46 bleak-retry-connector
47 bluetooth-data-tools
48 bluetooth-sensor-state-data
49 cryptography
50 home-assistant-bluetooth
51 pycryptodomex
52 sensor-state-data
53 ];
54
55 nativeCheckInputs = [ pytestCheckHook ];
56
57 pythonImportsCheck = [ "xiaomi_ble" ];
58
59 meta = with lib; {
60 description = "Library for Xiaomi BLE devices";
61 homepage = "https://github.com/Bluetooth-Devices/xiaomi-ble";
62 changelog = "https://github.com/Bluetooth-Devices/xiaomi-ble/releases/tag/v${version}";
63 license = with licenses; [ mit ];
64 maintainers = with maintainers; [ fab ];
65 };
66}