mirror of
https://github.com/fmtr/haco.git
synced 2026-10-26 19:01:51 -04:00
Pass logfire native logging handler to aiomqtt
This commit is contained in:
parent
70afdf1857
commit
5c08486ef3
2 changed files with 10 additions and 6 deletions
|
|
@ -1,5 +1,5 @@
|
|||
from dataclasses import dataclass
|
||||
from typing import List, Optional, Literal
|
||||
from typing import Literal
|
||||
|
||||
from capabilities import Capability
|
||||
from control import Control
|
||||
|
|
@ -18,10 +18,10 @@ class Climate(Control):
|
|||
humidity_min: float = 0
|
||||
humidity_max: float = 100
|
||||
precision: int = 1
|
||||
modes: Optional[List[str]] = None
|
||||
preset_modes: Optional[List[str]] = None
|
||||
fan_modes: Optional[List[str]] = None
|
||||
swing_modes: Optional[List[str]] = None
|
||||
modes: list[str] | None = None
|
||||
preset_modes: list[str] | None = None
|
||||
fan_modes: list[str] | None = None
|
||||
swing_modes: list[str] | None = None
|
||||
|
||||
|
||||
def temperature_command(self, value):
|
||||
|
|
|
|||
|
|
@ -1,13 +1,17 @@
|
|||
import asyncio
|
||||
import logging
|
||||
|
||||
from haco.button import Button
|
||||
from haco.client import ClientHaco
|
||||
from haco.climate import Climate
|
||||
from haco.constants import MQTT_HOST
|
||||
from haco.device import Device
|
||||
from haco.obs import logger
|
||||
from haco.pulldown import Select
|
||||
from haco.switch import Switch
|
||||
|
||||
handler = logger.LogfireLoggingHandler()
|
||||
logging.basicConfig(handlers=[handler], level=logging.DEBUG)
|
||||
|
||||
async def main():
|
||||
climate_a = Climate(name="Dev Climate A", fan_modes=['a', 'b', 'c'])
|
||||
|
|
@ -19,7 +23,7 @@ async def main():
|
|||
sel1 = Select(name="Dev Select 1", options=['a', 'b', 'c'])
|
||||
device = Device(name="Dev Device", controls=[climate_a, climate_b, b1, s1, sel1])
|
||||
|
||||
client = ClientHaco(hostname=MQTT_HOST, device=device)
|
||||
client = ClientHaco(hostname=MQTT_HOST, device=device, logger=logging.getLogger(__name__))
|
||||
|
||||
await client.start()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue