mirror of
https://github.com/fmtr/haco.git
synced 2026-10-25 18:40:15 -04:00
Rename object to DeviceData
This commit is contained in:
parent
d5f49a7729
commit
82a264db35
3 changed files with 5 additions and 5 deletions
|
|
@ -4,7 +4,7 @@ from typing import List
|
|||
|
||||
from haco import tools, constants
|
||||
from haco.control import Control
|
||||
from haco.device_data import DeviceInfo
|
||||
from haco.device_data import DeviceData
|
||||
from haco.tools import log_publish, split_into_chunks, log_subscribe
|
||||
|
||||
|
||||
|
|
@ -105,7 +105,7 @@ class Device:
|
|||
for topic in data.keys():
|
||||
await log_subscribe(client, str(topic))
|
||||
|
||||
async def bind(self, client, data_announce: DeviceInfo):
|
||||
async def bind(self, client, data_announce: DeviceData):
|
||||
msg = f'Found device with matching config {self.config_module.__name__}: Hostname: {data_announce.hostname} MAC:{data_announce.mac}'
|
||||
tools.logger.info(msg)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ from typing import Dict
|
|||
|
||||
|
||||
@dataclass
|
||||
class DeviceInfo:
|
||||
class DeviceData:
|
||||
wifi: Dict[str, any]
|
||||
device_name: str
|
||||
fulltopic: str
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ from pathlib import Path
|
|||
from haco import constants, tools
|
||||
from haco.constants import MQTT_PASSWORD, MQTT_HOST, MQTT_PORT, MQTT_USERNAME
|
||||
from haco.device import Device
|
||||
from haco.device_data import DeviceInfo
|
||||
from haco.device_data import DeviceData
|
||||
from haco.load_configs import load_devices
|
||||
from haco.tools import log_received, logger
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ async def listen(client, devices):
|
|||
continue
|
||||
|
||||
data_announce = json.loads(message.payload)
|
||||
data_announce = DeviceInfo(**data_announce)
|
||||
data_announce = DeviceData(**data_announce)
|
||||
|
||||
for identifier in data_announce.identifiers:
|
||||
device: Device = devices.get(identifier)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue