1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, aiohttp
5, ciso8601
6, async-timeout
7, kasa-crypt
8, orjson
9, pythonOlder
10, requests
11, websocket-client
12, websockets
13}:
14
15buildPythonPackage rec {
16 pname = "sense-energy";
17 version = "0.12.2";
18 format = "setuptools";
19
20 disabled = pythonOlder "3.7";
21
22 src = fetchFromGitHub {
23 owner = "scottbonline";
24 repo = "sense";
25 rev = "refs/tags/${version}";
26 hash = "sha256-OVFRM31LwHNeJUx+s/TN/1o4wvjMQEKaZEPI+y+S64s=";
27 };
28
29 postPatch = ''
30 substituteInPlace setup.py \
31 --replace "{{VERSION_PLACEHOLDER}}" "${version}"
32 '';
33
34 propagatedBuildInputs = [
35 aiohttp
36 async-timeout
37 kasa-crypt
38 orjson
39 ciso8601
40 requests
41 websocket-client
42 websockets
43 ];
44
45 # no tests implemented
46 doCheck = false;
47
48 pythonImportsCheck = [
49 "sense_energy"
50 ];
51
52 meta = with lib; {
53 description = "API for the Sense Energy Monitor";
54 homepage = "https://github.com/scottbonline/sense";
55 changelog = "https://github.com/scottbonline/sense/releases/tag/${version}";
56 license = licenses.mit;
57 maintainers = with maintainers; [ dotlambda ];
58 };
59}