@@ -0,0 +1,37 @@
1+{ stdenv, python2Packages, fetchFromGitHub }:
2+
3+python2Packages.buildPythonApplication rec {
4+ pname = "broadlink-cli";
5+ inherit (python2Packages.broadlink) version;
6+
7+ # the tools are available as part of the source distribution from GH but
8+ # not pypi, so we have to fetch them here.
9+ src = fetchFromGitHub {
10+ owner = "mjg59";
11+ repo = "python-broadlink";
12+ # this rev is version 0.9
13+ rev = "766b7b00fb1cec868e3d5fca66f1aada208959ce";
14+ sha256 = "0j0idzxmpwkb1lbgvi9df2hbxafm5hxjc6mgg5481lq7z4z1r4nb";
15+ };
16+
17+ format = "other";
18+
19+ propagatedBuildInputs = with python2Packages; [
20+ broadlink
21+ ];
22+
23+ installPhase = ''
24+ runHook preInstall
25+
26+ install -Dm755 -t $out/bin cli/broadlink_{cli,discovery}
27+ install -Dm644 -t $out/share/doc/broadlink cli/README.md
28+
29+ runHook postInstall
30+ '';
31+
32+ meta = with stdenv.lib; {
33+ description = "Tools for interfacing with Broadlink RM2/3 (Pro) remote controls, A1 sensor platforms and SP2/3 smartplugs";
34+ maintainers = with maintainers; [ peterhoeg ];
35+ inherit (python2Packages.broadlink.meta) homepage license;
36+ };
37+}