This commit is contained in:
Jeffrey C. Ollie 2023-12-05 20:25:14 -06:00
parent 88badb0e0f
commit 9913cd0e11
Signed by: jeff
GPG key ID: 6F86035A6D97044E
4 changed files with 20 additions and 16 deletions

View file

@ -20,11 +20,11 @@
"systems": "systems"
},
"locked": {
"lastModified": 1692799911,
"narHash": "sha256-3eihraek4qL744EvQXsK1Ha6C3CR7nnT8X2qWap4RNk=",
"lastModified": 1694529238,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "f9e7cf818399d17d347f847525c5a5a8032e4e44",
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
"type": "github"
},
"original": {
@ -89,11 +89,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1693341273,
"narHash": "sha256-wrsPjsIx2767909MPGhSIOmkpGELM9eufqLQOPxmZQg=",
"lastModified": 1694753796,
"narHash": "sha256-QPE7dqcicQH/nq9aywVXJWWtci4FvxHaM+BSIEbGBvA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2ab91c8d65c00fd22a441c69bbf1bc9b420d5ea1",
"rev": "360a7d31c30abefdc490d203f80e3221b7a24af2",
"type": "github"
},
"original": {
@ -111,11 +111,11 @@
]
},
"locked": {
"lastModified": 1693051011,
"narHash": "sha256-HNbuVCS/Fnl1YZOjBk9/MlIem+wM8fvIzTH0CVQrLSQ=",
"lastModified": 1694165861,
"narHash": "sha256-FMiPKVcNxb9QWATnQrC68nIL2t8Fm4zBH0XyLz9uqko=",
"owner": "nix-community",
"repo": "poetry2nix",
"rev": "5b3a5151cf212021ff8d424f215fb030e4ff2837",
"rev": "c3d3c4a0396b1bcccd72c82551a319229997f6e4",
"type": "github"
},
"original": {

View file

@ -1,10 +1,13 @@
"""Elgato StreamDeck Python Library."""
from enum import IntEnum
import logging
from greendeck.lib.elgato.streamdeck import StreamDeck
from greendeck.lib.elgato.streamdeck.original_v2 import StreamDeckOriginalV2
from greendeck.lib.hidapi.device import enumerate_devices
logger = logging.getLogger(__name__)
class VendorIDs(IntEnum):
"""Elgato StreamDeck USB Vendor IDs."""
@ -31,6 +34,7 @@ async def enumerate_streamdecks() -> list[StreamDeck]:
streamdecks: list[StreamDeck] = []
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):
case (
VendorIDs.USB_VID_ELGATO,

View file

@ -240,7 +240,7 @@ class HomeAssistant:
await self.websocket.send(request.json())
async def get_events_callback(self: Self, response: Response) -> None:
print(response.result)
logger.info(f"{response.result}")
async def websocket_runner(self: Self) -> None:
while True:
@ -248,16 +248,15 @@ class HomeAssistant:
async with websockets.client.connect(
str(self.websocket_url())
) as self.websocket:
async for message in self.websocket:
try:
response = parse_raw_as(Response, message)
# pprint(response)
match response.type:
case "auth_required":
await self.websocket.send(
AuthRequest(access_token=self.token).json()
)
data = AuthRequest(access_token=self.token).json()
logger.info(f"authentication data {data}")
await self.websocket.send(data)
case "auth_ok":
t = asyncio.create_task(

View file

@ -36,14 +36,15 @@ requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.black]
line_length = 120
[tool.isort]
profile = "black"
line_length = 88
line_length = 120
force_single_line = true
force_sort_within_sections = true
from_first = false
[tool.flake8]
max-line-length = 88
max-line-length = 120
extend-ignore = "E203"