Merge pull request #1 from matthewpucc/support_ac70_devices
Add support AC70 and AC70P devices
This commit is contained in:
6 files changed
+48
-1
No files matched your search
@@ -17,6 +17,8 @@ After the installation, you can use this button to install the integration:
|
|||||||
### Supported devices:
|
### Supported devices:
|
||||||
|
|
||||||
- AC60
|
- AC60
|
||||||
|
- AC70 (basic data)
|
||||||
|
- AC70P (untested)
|
||||||
- AC180 (basic data)
|
- AC180 (basic data)
|
||||||
- AC180P (basic data)
|
- AC180P (basic data)
|
||||||
- AC200L (untested)
|
- AC200L (untested)
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
"""AC70 fields."""
|
||||||
|
|
||||||
|
from ..base_devices.ProtocolV2Device import ProtocolV2Device
|
||||||
|
|
||||||
|
|
||||||
|
class AC70(ProtocolV2Device):
|
||||||
|
def __init__(self, address: str, sn: str):
|
||||||
|
super().__init__(address, "AC70", sn)
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
"""AC70P fields."""
|
||||||
|
|
||||||
|
from ..base_devices.ProtocolV2Device import ProtocolV2Device
|
||||||
|
|
||||||
|
|
||||||
|
class AC70P(ProtocolV2Device):
|
||||||
|
def __init__(self, address: str, sn: str):
|
||||||
|
super().__init__(address, "AC70P", sn)
|
||||||
@@ -3,6 +3,8 @@
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from ..devices.ac60 import AC60
|
from ..devices.ac60 import AC60
|
||||||
|
from ..devices.ac70 import AC70
|
||||||
|
from ..devices.ac70p import AC70P
|
||||||
from ..devices.ac180 import AC180
|
from ..devices.ac180 import AC180
|
||||||
from ..devices.ac180p import AC180P
|
from ..devices.ac180p import AC180P
|
||||||
from ..devices.ac200l import AC200L
|
from ..devices.ac200l import AC200L
|
||||||
@@ -17,7 +19,7 @@ from ..devices.ep760 import EP760
|
|||||||
from ..devices.ep800 import EP800
|
from ..devices.ep800 import EP800
|
||||||
|
|
||||||
DEVICE_NAME_RE = re.compile(
|
DEVICE_NAME_RE = re.compile(
|
||||||
r"^(AC60|AC180|AC180P|AC200L|AC200M|AC300|AC500|EB3A|EP500|EP500P|EP600|EP760|EP800)(\d+)$"
|
r"^(AC60|AC70|AC70P|AC180|AC180P|AC200L|AC200M|AC300|AC500|EB3A|EP500|EP500P|EP600|EP760|EP800)(\d+)$"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -25,6 +27,10 @@ def build_device(address: str, name: str):
|
|||||||
match = DEVICE_NAME_RE.match(name)
|
match = DEVICE_NAME_RE.match(name)
|
||||||
if match[1] == "AC60":
|
if match[1] == "AC60":
|
||||||
return AC60(address, match[2])
|
return AC60(address, match[2])
|
||||||
|
if match[1] == "AC70":
|
||||||
|
return AC70(address, match[2])
|
||||||
|
if match[1] == "AC70P":
|
||||||
|
return AC70P(address, match[2])
|
||||||
if match[1] == "AC180":
|
if match[1] == "AC180":
|
||||||
return AC180(address, match[2])
|
return AC180(address, match[2])
|
||||||
if match[1] == "AC180P":
|
if match[1] == "AC180P":
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
homeassistant
|
||||||
|
bleak_retry_connector
|
||||||
|
pyserial
|
||||||
|
bluetooth_auto_recovery
|
||||||
|
crcmod
|
||||||
@@ -4,6 +4,8 @@ import unittest
|
|||||||
|
|
||||||
from custom_components.bluetti_bt.bluetti_bt_lib.utils.device_builder import build_device
|
from custom_components.bluetti_bt.bluetti_bt_lib.utils.device_builder import build_device
|
||||||
from custom_components.bluetti_bt.bluetti_bt_lib.devices.ac60 import AC60
|
from custom_components.bluetti_bt.bluetti_bt_lib.devices.ac60 import AC60
|
||||||
|
from custom_components.bluetti_bt.bluetti_bt_lib.devices.ac70 import AC70
|
||||||
|
from custom_components.bluetti_bt.bluetti_bt_lib.devices.ac70p import AC70P
|
||||||
from custom_components.bluetti_bt.bluetti_bt_lib.devices.ac180 import AC180
|
from custom_components.bluetti_bt.bluetti_bt_lib.devices.ac180 import AC180
|
||||||
from custom_components.bluetti_bt.bluetti_bt_lib.devices.ac180p import AC180P
|
from custom_components.bluetti_bt.bluetti_bt_lib.devices.ac180p import AC180P
|
||||||
from custom_components.bluetti_bt.bluetti_bt_lib.devices.ac200m import AC200M
|
from custom_components.bluetti_bt.bluetti_bt_lib.devices.ac200m import AC200M
|
||||||
@@ -32,6 +34,22 @@ class TestDeviceBuilder(unittest.TestCase):
|
|||||||
self.assertIsInstance(built, AC60)
|
self.assertIsInstance(built, AC60)
|
||||||
self.assertEqual(built.address, bt_addr)
|
self.assertEqual(built.address, bt_addr)
|
||||||
|
|
||||||
|
def test_build_ac70(self):
|
||||||
|
bt_addr = "aa:bb:cc:dd:ee:ff"
|
||||||
|
bt_name = "AC7056786746478"
|
||||||
|
built = build_device(bt_addr, bt_name)
|
||||||
|
|
||||||
|
self.assertIsInstance(built, AC70)
|
||||||
|
self.assertEqual(built.address, bt_addr)
|
||||||
|
|
||||||
|
def test_build_ac70p(self):
|
||||||
|
bt_addr = "aa:bb:cc:dd:ee:ff"
|
||||||
|
bt_name = "AC70P56786746478"
|
||||||
|
built = build_device(bt_addr, bt_name)
|
||||||
|
|
||||||
|
self.assertIsInstance(built, AC70P)
|
||||||
|
self.assertEqual(built.address, bt_addr)
|
||||||
|
|
||||||
def test_build_ac180(self):
|
def test_build_ac180(self):
|
||||||
bt_addr = "aa:bb:cc:dd:ee:ff"
|
bt_addr = "aa:bb:cc:dd:ee:ff"
|
||||||
bt_name = "AC18056786746478"
|
bt_name = "AC18056786746478"
|
||||||
|
|||||||
Reference in new issue
Block a user