From 60cf0a0f1f852a88193b1c0db12626cf342f8eaf Mon Sep 17 00:00:00 2001 From: "D. Scott Boggs" Date: Wed, 19 Jun 2024 19:25:17 -0400 Subject: [PATCH] WIP init --- .gitignore | 4 ++++ default.nix | 14 ++++++++++++++ flake.lock | 27 +++++++++++++++++++++++++++ flake.nix | 19 +++++++++++++++++++ pyproject.toml | 20 ++++++++++++++++++++ src/bulbctl/__init__.py | 1 + src/bulbctl/bulb.py | 2 ++ src/bulbctl/config.py | 6 ++++++ 8 files changed, 93 insertions(+) create mode 100644 default.nix create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 pyproject.toml create mode 100644 src/bulbctl/__init__.py create mode 100644 src/bulbctl/bulb.py create mode 100644 src/bulbctl/config.py diff --git a/.gitignore b/.gitignore index a52cbb0..a0d4ab7 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,5 @@ old/ +env/ +build/ +dist/ +**/*.egg-info/ diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..1fc45ec --- /dev/null +++ b/default.nix @@ -0,0 +1,14 @@ +{ + python3, ... +}: python3.pkgs.buildPythonApplication rec { + pname = "huecontrol"; + version = "0.0.0"; + format = "setuptools"; + + src = ./.; + + propagatedBuildInputs = with python3.pkgs; [ + bleak + rgbxy + ]; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..eecb9ae --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1711523803, + "narHash": "sha256-UKcYiHWHQynzj6CN/vTcix4yd1eCu1uFdsuarupdCQQ=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "2726f127c15a4cc9810843b96cad73c7eb39e443", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..8d56462 --- /dev/null +++ b/flake.nix @@ -0,0 +1,19 @@ +{ + description = "Control Phillips Hue Bulbs"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + sourceCode.url = "path:./src"; + nixPackageFile.url = "path:./default.nix"; + }; + + outputs = { self, nixpkgs }: + let system = "x86_64-linux"; + pkgs = import nixpkgs { inherit system; }; + in { + packages.${system} = { + bulbctl = pkgs.callPackage ./. {}; + default = self.packages.${system}.bulbctl; + }; + }; +} diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..feb6631 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,20 @@ +[build-system] +requires = ["setuptools>=65.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "bulbctl" +version = "0.0.1" +authors = [ + {name="D. Scott Boggs", email="scott@tams.tech"} +] +description = "Control Phillips Hue light bulbs" + +requires-python = ">=3.11" # this can probably be lowered, we'll see +classifiers = [ + "Programming Language :: Python :: 3" +] +dependencies = [ + "bleak", + "rgbxy" +] diff --git a/src/bulbctl/__init__.py b/src/bulbctl/__init__.py new file mode 100644 index 0000000..5bd5ce9 --- /dev/null +++ b/src/bulbctl/__init__.py @@ -0,0 +1 @@ +from bleak import BleakClient \ No newline at end of file diff --git a/src/bulbctl/bulb.py b/src/bulbctl/bulb.py new file mode 100644 index 0000000..1cd9886 --- /dev/null +++ b/src/bulbctl/bulb.py @@ -0,0 +1,2 @@ +from bleak import BleakClient +from rgbxy import Converter, GamutC, get_light_gamut \ No newline at end of file diff --git a/src/bulbctl/config.py b/src/bulbctl/config.py new file mode 100644 index 0000000..16cc74f --- /dev/null +++ b/src/bulbctl/config.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 + +# from libhueble + +class Config: + lamps: Lamp \ No newline at end of file