Skip to content

Commit

Permalink
Change formatting to make linter happy, update of project file
Browse files Browse the repository at this point in the history
  • Loading branch information
antst committed Dec 12, 2024
1 parent 4a68164 commit 60dae1d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
4 changes: 2 additions & 2 deletions custom_components/qss/event_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ def put_event_to_queue(event: Event, entity_filter: Callable[[str], bool], queue
entity_id = event.data.get(ATTR_ENTITY_ID)
state = event.data.get("new_state")
if state is not None:
if all([entity_id, state, state.state != STATE_UNKNOWN, entity_filter(entity_id)]):
queue.put(event)
if all([entity_id, state, state.state != STATE_UNKNOWN, entity_filter(entity_id)]):
queue.put(event)


def get_event_from_queue(queue: Queue) -> Event:
Expand Down
16 changes: 3 additions & 13 deletions custom_components/qss/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from queue import Queue

from homeassistant.core import Event
from questdb.ingress import IngressError, Sender, Protocol
from questdb.ingress import IngressError, Protocol, Sender
from tenacity import retry, retry_if_exception_type, stop_after_attempt, wait_fixed

from .const import RETRY_ATTEMPTS, RETRY_WAIT_SECONDS
Expand All @@ -13,14 +13,7 @@


def _insert_row_with_auth(host: str, port: int, auth: tuple, event: Event) -> None:
with Sender(
Protocol.Tcps,
host,
port,
username=auth[0],
token=auth[1],
token_x=auth[2],
token_y=auth[3]) as sender:
with Sender(Protocol.Tcps, host, port, username=auth[0], token=auth[1], token_x=auth[2], token_y=auth[3]) as sender:
entity_id = event.data["entity_id"]
state = event.data.get("new_state")
attrs = dict(state.attributes)
Expand All @@ -40,10 +33,7 @@ def _insert_row_with_auth(host: str, port: int, auth: tuple, event: Event) -> No


def _insert_row_without_auth(host: str, port: int, event: Event) -> None:
with Sender(
Protocol.Tcp,
host,
port) as sender:
with Sender(Protocol.Tcp, host, port) as sender:
entity_id = event.data["entity_id"]
state = event.data.get("new_state")
attrs = dict(state.attributes)
Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "qss"
version = "v0.0.10"
version = "v0.0.11"
description = "QuestDB State Storage (QSS) for Home Assistant"
authors = ["CM000n"]
keywords = [
Expand All @@ -17,14 +17,14 @@ readme = "README.md"

[tool.poetry.dependencies]
python = "^3.11"
homeassistant = "^2023.12"
questdb = "^1.2.0"
homeassistant = "^2024.12"
questdb = "^2.0.3"
tenacity = "^8.0.0"


[tool.poetry.dev-dependencies]
voluptuous-stubs = "^0.1"
homeassistant-stubs = "^2023.12"
homeassistant-stubs = "^2024.12"
pre-commit = "^2.21.0"
pre-commit-hooks = "^4.5.0"
codespell = "^2.0.0"
Expand Down

0 comments on commit 60dae1d

Please sign in to comment.