added build_device()

This commit is contained in:
Patrick762 committed 2024-02-18 13:29:20 +01:00
1 parent 71bf9b1952
commit 2abcbbb392
4 files changed
+38 -118

No files matched your search

+2 -4
View File
@@ -1,11 +1,11 @@
"""Tools."""
from bluetti_mqtt.bluetooth import build_device as orig_build_device
from .bluetti_bt_lib.utils.device_builder import build_device as orig_build_device
from .const import DEVICE_NAME_RE
from .devices.ep600 import EP600
from .devices.ep760 import EP760
def mac_loggable(mac: str) -> str:
"""Remove parts of the mac address for logging."""
splitted = mac.split(":")
@@ -21,7 +21,5 @@ def build_device(address: str, name: str):
match = DEVICE_NAME_RE.match(name)
if match[1] == 'EP760':
return EP760(address, match[2])
elif match[1] == 'EP600':
return EP600(address, match[2])
else:
return orig_build_device(address, name)