Compare commits
No commits in common. "d232e3f452b1c472a06ec9a081badd5a25f0c8f9" and "88badb0e0f1dd371ddd5775e76f6ed5a617c9a85" have entirely different histories.
d232e3f452
...
88badb0e0f
6 changed files with 1114 additions and 1199 deletions
87
flake.lock
87
flake.lock
|
@ -1,15 +1,30 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"bash": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1678247195,
|
||||||
|
"narHash": "sha256-m/wSwlSket+hob3JED4XUvoWJLtW7yhtOiZrlRDMShs=",
|
||||||
|
"ref": "refs/heads/main",
|
||||||
|
"rev": "e7a00dcc0e75bc3ef6856bdd94d7d809245f5636",
|
||||||
|
"revCount": 1,
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://git.ocjtech.us/jeff/nixos-bash-prompt-builder.git"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://git.ocjtech.us/jeff/nixos-bash-prompt-builder.git"
|
||||||
|
}
|
||||||
|
},
|
||||||
"flake-utils": {
|
"flake-utils": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"systems": "systems"
|
"systems": "systems"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1726560853,
|
"lastModified": 1692799911,
|
||||||
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
|
"narHash": "sha256-3eihraek4qL744EvQXsK1Ha6C3CR7nnT8X2qWap4RNk=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
|
"rev": "f9e7cf818399d17d347f847525c5a5a8032e4e44",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -23,11 +38,11 @@
|
||||||
"systems": "systems_2"
|
"systems": "systems_2"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1726560853,
|
"lastModified": 1689068808,
|
||||||
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
|
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
|
"rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -59,11 +74,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1729742964,
|
"lastModified": 1688870561,
|
||||||
"narHash": "sha256-B4mzTcQ0FZHdpeWcpDYPERtyjJd/NIuaQ9+BV1h+MpA=",
|
"narHash": "sha256-4UYkifnPEw1nAzqqPOTL2MvWtm3sNGw1UTYTalkTcGY=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "nix-github-actions",
|
"repo": "nix-github-actions",
|
||||||
"rev": "e04df33f62cdcf93d73e9a04142464753a16db67",
|
"rev": "165b1650b753316aa7f1787f3005a8d2da0f5301",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -74,16 +89,16 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1730785428,
|
"lastModified": 1693341273,
|
||||||
"narHash": "sha256-Zwl8YgTVJTEum+L+0zVAWvXAGbWAuXHax3KzuejaDyo=",
|
"narHash": "sha256-wrsPjsIx2767909MPGhSIOmkpGELM9eufqLQOPxmZQg=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "4aa36568d413aca0ea84a1684d2d46f55dbabad7",
|
"rev": "2ab91c8d65c00fd22a441c69bbf1bc9b420d5ea1",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"id": "nixpkgs",
|
"id": "nixpkgs",
|
||||||
"ref": "nixos-unstable",
|
"ref": "nixos-23.05",
|
||||||
"type": "indirect"
|
"type": "indirect"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -93,16 +108,14 @@
|
||||||
"nix-github-actions": "nix-github-actions",
|
"nix-github-actions": "nix-github-actions",
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
],
|
]
|
||||||
"systems": "systems_3",
|
|
||||||
"treefmt-nix": "treefmt-nix"
|
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1731025526,
|
"lastModified": 1693051011,
|
||||||
"narHash": "sha256-z0jMgVMXEkn6lmFNu2oSrcOKGwymvthyPWPjxXOi1eA=",
|
"narHash": "sha256-HNbuVCS/Fnl1YZOjBk9/MlIem+wM8fvIzTH0CVQrLSQ=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "poetry2nix",
|
"repo": "poetry2nix",
|
||||||
"rev": "be0cb8b526f05d636a19c466148c458ad18a5660",
|
"rev": "5b3a5151cf212021ff8d424f215fb030e4ff2837",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -113,6 +126,7 @@
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"bash": "bash",
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils",
|
||||||
"make-shell": "make-shell",
|
"make-shell": "make-shell",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
|
@ -148,41 +162,6 @@
|
||||||
"repo": "default",
|
"repo": "default",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"systems_3": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1681028828,
|
|
||||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"id": "systems",
|
|
||||||
"type": "indirect"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"treefmt-nix": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": [
|
|
||||||
"poetry2nix",
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1730120726,
|
|
||||||
"narHash": "sha256-LqHYIxMrl/1p3/kvm2ir925tZ8DkI0KA10djk8wecSk=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "treefmt-nix",
|
|
||||||
"rev": "9ef337e492a5555d8e17a51c911ff1f02635be15",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "treefmt-nix",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": "root",
|
"root": "root",
|
||||||
|
|
50
flake.nix
50
flake.nix
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs = {
|
nixpkgs = {
|
||||||
url = "nixpkgs/nixos-unstable";
|
url = "nixpkgs/nixos-23.05";
|
||||||
};
|
};
|
||||||
poetry2nix = {
|
poetry2nix = {
|
||||||
url = "github:nix-community/poetry2nix";
|
url = "github:nix-community/poetry2nix";
|
||||||
|
@ -12,35 +12,39 @@
|
||||||
flake-utils = {
|
flake-utils = {
|
||||||
url = "github:numtide/flake-utils";
|
url = "github:numtide/flake-utils";
|
||||||
};
|
};
|
||||||
|
bash = {
|
||||||
|
url = "git+https://git.ocjtech.us/jeff/nixos-bash-prompt-builder.git";
|
||||||
|
};
|
||||||
make-shell = {
|
make-shell = {
|
||||||
url = "github:ursi/nix-make-shell";
|
url = "github:ursi/nix-make-shell";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
outputs = {
|
outputs = { self, nixpkgs, poetry2nix, flake-utils, bash, make-shell, ... }@inputs:
|
||||||
self,
|
|
||||||
nixpkgs,
|
|
||||||
poetry2nix,
|
|
||||||
flake-utils,
|
|
||||||
...
|
|
||||||
} @ inputs:
|
|
||||||
flake-utils.lib.eachDefaultSystem
|
flake-utils.lib.eachDefaultSystem
|
||||||
(
|
(system:
|
||||||
system: let
|
let
|
||||||
|
inherit (poetry2nix.legacyPackages.${system}) mkPoetryApplication overrides;
|
||||||
pkgs = import nixpkgs {
|
pkgs = import nixpkgs {
|
||||||
inherit system;
|
inherit system;
|
||||||
};
|
};
|
||||||
inherit (poetry2nix.lib.mkPoetry2Nix {inherit pkgs;}) mkPoetryApplication overrides;
|
python = pkgs.python311.withPackages (ps: with ps; [
|
||||||
python = pkgs.python312.withPackages (ps:
|
|
||||||
with ps; [
|
|
||||||
poetry-core
|
poetry-core
|
||||||
]);
|
]);
|
||||||
in {
|
in
|
||||||
devShells.default = let
|
{
|
||||||
|
devShells.default =
|
||||||
|
let
|
||||||
make-shell = import inputs.make-shell {
|
make-shell = import inputs.make-shell {
|
||||||
inherit system;
|
inherit system;
|
||||||
pkgs = pkgs;
|
pkgs = pkgs;
|
||||||
};
|
};
|
||||||
project = "greendeck";
|
project = "greendeck";
|
||||||
|
prompt = (
|
||||||
|
bash.build_prompt
|
||||||
|
bash.ansi_normal_blue
|
||||||
|
"${project} - ${bash.username}@${bash.hostname_short}: ${bash.current_working_directory}"
|
||||||
|
"${project}:${bash.current_working_directory}"
|
||||||
|
);
|
||||||
in
|
in
|
||||||
make-shell {
|
make-shell {
|
||||||
packages = [
|
packages = [
|
||||||
|
@ -53,7 +57,7 @@
|
||||||
HIDAPI_HOME = pkgs.hidapi;
|
HIDAPI_HOME = pkgs.hidapi;
|
||||||
MAGICK_HOME = pkgs.imagemagickBig;
|
MAGICK_HOME = pkgs.imagemagickBig;
|
||||||
POETRY_VIRTUALENVS_IN_PROJECT = "true";
|
POETRY_VIRTUALENVS_IN_PROJECT = "true";
|
||||||
name = project;
|
PS1 = prompt;
|
||||||
};
|
};
|
||||||
setup = ''
|
setup = ''
|
||||||
export PATH=''$(pwd)/.venv/bin:$PATH
|
export PATH=''$(pwd)/.venv/bin:$PATH
|
||||||
|
@ -63,7 +67,7 @@
|
||||||
greendeck = mkPoetryApplication {
|
greendeck = mkPoetryApplication {
|
||||||
python = pkgs.python311;
|
python = pkgs.python311;
|
||||||
projectDir = ./.;
|
projectDir = ./.;
|
||||||
groups = [];
|
groups = [ ];
|
||||||
propagatedBuildInputs = [
|
propagatedBuildInputs = [
|
||||||
pkgs.hidapi
|
pkgs.hidapi
|
||||||
];
|
];
|
||||||
|
@ -73,12 +77,10 @@
|
||||||
'os.getenv("HIDAPI_LIBRARY")' \
|
'os.getenv("HIDAPI_LIBRARY")' \
|
||||||
'"${pkgs.hidapi}/lib/libhidapi-libusb.so.0"'
|
'"${pkgs.hidapi}/lib/libhidapi-libusb.so.0"'
|
||||||
'';
|
'';
|
||||||
overrides =
|
overrides = overrides.withDefaults
|
||||||
overrides.withDefaults
|
|
||||||
(
|
(
|
||||||
self: super: {
|
self: super: {
|
||||||
wand =
|
wand = super.wand.overridePythonAttrs
|
||||||
super.wand.overridePythonAttrs
|
|
||||||
(
|
(
|
||||||
old: {
|
old: {
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
|
@ -87,7 +89,7 @@
|
||||||
"os.environ.get('MAGICK_HOME')" \
|
"os.environ.get('MAGICK_HOME')" \
|
||||||
"'${pkgs.imagemagickBig}'"
|
"'${pkgs.imagemagickBig}'"
|
||||||
'';
|
'';
|
||||||
propagatedBuildInputs = old.propagatedBuildInputs ++ [pkgs.imagemagickBig];
|
propagatedBuildInputs = old.propagatedBuildInputs ++ [ pkgs.imagemagickBig ];
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
# attrs = super.pydantic-yaml.overridePythonAttrs (
|
# attrs = super.pydantic-yaml.overridePythonAttrs (
|
||||||
|
@ -102,12 +104,12 @@
|
||||||
# );
|
# );
|
||||||
pydantic-yaml = super.pydantic-yaml.overridePythonAttrs (
|
pydantic-yaml = super.pydantic-yaml.overridePythonAttrs (
|
||||||
old: {
|
old: {
|
||||||
buildInputs = old.buildInputs ++ [self.setuptools];
|
buildInputs = old.buildInputs ++ [ self.setuptools ];
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
asyncdbus = super.asyncdbus.overridePythonAttrs (
|
asyncdbus = super.asyncdbus.overridePythonAttrs (
|
||||||
old: {
|
old: {
|
||||||
buildInputs = old.buildInputs ++ [self.setuptools-scm];
|
buildInputs = old.buildInputs ++ [ self.setuptools-scm ];
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
"""Elgato StreamDeck Python Library."""
|
"""Elgato StreamDeck Python Library."""
|
||||||
from enum import IntEnum
|
from enum import IntEnum
|
||||||
import logging
|
|
||||||
|
|
||||||
from greendeck.lib.elgato.streamdeck import StreamDeck
|
from greendeck.lib.elgato.streamdeck import StreamDeck
|
||||||
from greendeck.lib.elgato.streamdeck.original_v2 import StreamDeckOriginalV2
|
from greendeck.lib.elgato.streamdeck.original_v2 import StreamDeckOriginalV2
|
||||||
from greendeck.lib.hidapi.device import enumerate_devices
|
from greendeck.lib.hidapi.device import enumerate_devices
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class VendorIDs(IntEnum):
|
class VendorIDs(IntEnum):
|
||||||
"""Elgato StreamDeck USB Vendor IDs."""
|
"""Elgato StreamDeck USB Vendor IDs."""
|
||||||
|
@ -34,7 +31,6 @@ async def enumerate_streamdecks() -> list[StreamDeck]:
|
||||||
streamdecks: list[StreamDeck] = []
|
streamdecks: list[StreamDeck] = []
|
||||||
|
|
||||||
for device in await enumerate_devices():
|
for device in await enumerate_devices():
|
||||||
logger.info(f"{device.vendor_id:04x} {device.product_id:04x} {device.path}")
|
|
||||||
match (device.vendor_id, device.product_id):
|
match (device.vendor_id, device.product_id):
|
||||||
case (
|
case (
|
||||||
VendorIDs.USB_VID_ELGATO,
|
VendorIDs.USB_VID_ELGATO,
|
||||||
|
|
|
@ -240,7 +240,7 @@ class HomeAssistant:
|
||||||
await self.websocket.send(request.json())
|
await self.websocket.send(request.json())
|
||||||
|
|
||||||
async def get_events_callback(self: Self, response: Response) -> None:
|
async def get_events_callback(self: Self, response: Response) -> None:
|
||||||
logger.info(f"{response.result}")
|
print(response.result)
|
||||||
|
|
||||||
async def websocket_runner(self: Self) -> None:
|
async def websocket_runner(self: Self) -> None:
|
||||||
while True:
|
while True:
|
||||||
|
@ -248,15 +248,16 @@ class HomeAssistant:
|
||||||
async with websockets.client.connect(
|
async with websockets.client.connect(
|
||||||
str(self.websocket_url())
|
str(self.websocket_url())
|
||||||
) as self.websocket:
|
) as self.websocket:
|
||||||
|
|
||||||
async for message in self.websocket:
|
async for message in self.websocket:
|
||||||
try:
|
try:
|
||||||
response = parse_raw_as(Response, message)
|
response = parse_raw_as(Response, message)
|
||||||
# pprint(response)
|
# pprint(response)
|
||||||
match response.type:
|
match response.type:
|
||||||
case "auth_required":
|
case "auth_required":
|
||||||
data = AuthRequest(access_token=self.token).json()
|
await self.websocket.send(
|
||||||
logger.info(f"authentication data {data}")
|
AuthRequest(access_token=self.token).json()
|
||||||
await self.websocket.send(data)
|
)
|
||||||
|
|
||||||
case "auth_ok":
|
case "auth_ok":
|
||||||
t = asyncio.create_task(
|
t = asyncio.create_task(
|
||||||
|
|
2004
poetry.lock
generated
2004
poetry.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -5,19 +5,19 @@ description = ""
|
||||||
authors = ["Jeffrey C. Ollie <jeff@ocjtech.us>"]
|
authors = ["Jeffrey C. Ollie <jeff@ocjtech.us>"]
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = "^3.12"
|
python = "^3.10"
|
||||||
pydantic = "<2"
|
pydantic = "<2"
|
||||||
hyperlink = "^21.0.0"
|
hyperlink = "^21.0.0"
|
||||||
websockets = "^13.1"
|
websockets = "^11.0.3"
|
||||||
Pillow = "^11.0.0"
|
Pillow = "^10.0.0"
|
||||||
Wand = "^0.6.13"
|
Wand = "^0.6.11"
|
||||||
aiohttp = "^3.10.10"
|
aiohttp = "^3.8.5"
|
||||||
pydantic-yaml = "<2"
|
pydantic-yaml = "<2"
|
||||||
xdg = "^6.0.0"
|
xdg = "^6.0.0"
|
||||||
aiopath = "^0.7.7"
|
aiopath = "^0.6.11"
|
||||||
arrow = "^1.3.0"
|
arrow = "^1.2.3"
|
||||||
click = "^8.1.7"
|
click = "^8.1.7"
|
||||||
asyncdbus = "^0.7.0"
|
asyncdbus = "^0.6.1"
|
||||||
|
|
||||||
[tool.poetry.scripts]
|
[tool.poetry.scripts]
|
||||||
greendeck = "greendeck.main:main"
|
greendeck = "greendeck.main:main"
|
||||||
|
@ -36,15 +36,14 @@ requires = ["poetry-core"]
|
||||||
build-backend = "poetry.core.masonry.api"
|
build-backend = "poetry.core.masonry.api"
|
||||||
|
|
||||||
[tool.black]
|
[tool.black]
|
||||||
line_length = 120
|
|
||||||
|
|
||||||
[tool.isort]
|
[tool.isort]
|
||||||
profile = "black"
|
profile = "black"
|
||||||
line_length = 120
|
line_length = 88
|
||||||
force_single_line = true
|
force_single_line = true
|
||||||
force_sort_within_sections = true
|
force_sort_within_sections = true
|
||||||
from_first = false
|
from_first = false
|
||||||
|
|
||||||
[tool.flake8]
|
[tool.flake8]
|
||||||
max-line-length = 120
|
max-line-length = 88
|
||||||
extend-ignore = "E203"
|
extend-ignore = "E203"
|
||||||
|
|
Loading…
Reference in a new issue