Use TypedDict to avoir using Any
This commit is contained in:
parent
9a295a7569
commit
483d377b6d
2 changed files with 11 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
|||
[logging]
|
||||
level = "DEBUG"
|
||||
# level = "DEBUG"
|
||||
|
||||
[homeassistant]
|
||||
entity = "climate.chaudiere"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import json
|
||||
import logging
|
||||
from collections.abc import Callable
|
||||
from typing import Any
|
||||
from typing import Any, TypedDict
|
||||
|
||||
import paho.mqtt.client as mqtt
|
||||
from paho.mqtt.enums import CallbackAPIVersion, MQTTErrorCode
|
||||
|
@ -12,6 +12,14 @@ from .select import Selector
|
|||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class HAOptions(TypedDict):
|
||||
dev: dict[str, str]
|
||||
o: dict[str, str]
|
||||
availability_topic: str
|
||||
state_topic: str
|
||||
cmps: dict[str, dict[str, str]]
|
||||
|
||||
|
||||
class HAClient:
|
||||
def __init__(
|
||||
self,
|
||||
|
@ -38,7 +46,7 @@ class HAClient:
|
|||
self.selector = Selector(self.send_data)
|
||||
|
||||
@property
|
||||
def ha_options(self) -> dict[str, Any]:
|
||||
def ha_options(self) -> HAOptions:
|
||||
return {
|
||||
"dev": {
|
||||
"ids": "oin",
|
||||
|
|
Loading…
Reference in a new issue