Compare commits

..
6 Commits
Author SHA1 Message Date
Patrick762 85e50498f6 Merge pull request #64 from Patrick762/ep800
EP800
2024-02-25 15:40:30 +01:00
Patrick762 5fa1c8631f next beta release 2024-02-25 15:37:48 +01:00
Patrick762 9cba466228 basic ep800 support 2024-02-25 15:37:12 +01:00
Patrick762 cc42617bdb Merge pull request #63 from Patrick762/values-fix
Values fix
2024-02-25 15:08:50 +01:00
Patrick762 4d27f108fa fixed negative ac and dc solar values 2024-02-25 15:04:18 +01:00
Patrick762 6412630c85 added new int field 2024-02-25 15:03:27 +01:00
6 changed files with 41 additions and 10 deletions

No files matched your search

+2 -1
View File
@@ -24,7 +24,8 @@ After the installation, you can use this button to install the integration:
- EP500 - EP500
- EP500P - EP500P
- EP600 (tested) - EP600 (tested)
- EP760 (beta, untested) - EP760 (basic data)
- EP800 (basic data)
### Available controls: ### Available controls:
If enabled in the Integration options (you need to reload the integration if you change this option): If enabled in the Integration options (you need to reload the integration if you change this option):
@@ -20,11 +20,11 @@ class EP600(ProtocolV2Device):
# DC Solar # DC Solar
self.struct.add_uint_field("pv_input_power1", 1212) self.struct.add_uint_field("pv_input_power1", 1212)
self.struct.add_uint_field("pv_input_voltage1", 1213) self.struct.add_decimal_field("pv_input_voltage1", 1213, 1)
self.struct.add_uint_field("pv_input_current1", 1214) self.struct.add_decimal_field("pv_input_current1", 1214, 1)
self.struct.add_uint_field("pv_input_power2", 1220) self.struct.add_uint_field("pv_input_power2", 1220)
self.struct.add_uint_field("pv_input_voltage2", 1221) self.struct.add_decimal_field("pv_input_voltage2", 1221, 1)
self.struct.add_uint_field("pv_input_current2", 1222) self.struct.add_decimal_field("pv_input_current2", 1222, 1)
# ADL400 Smart Meter for AC Solar # ADL400 Smart Meter for AC Solar
self.struct.add_uint_field("adl400_ac_input_power_phase1", 1228) self.struct.add_uint_field("adl400_ac_input_power_phase1", 1228)
@@ -52,9 +52,9 @@ class EP600(ProtocolV2Device):
# EP600 AC Output # EP600 AC Output
self.struct.add_decimal_field("ac_output_frequency", 1500, 1) self.struct.add_decimal_field("ac_output_frequency", 1500, 1)
self.struct.add_uint_field("ac_output_power_phase1", 1510) self.struct.add_int_field("ac_output_power_phase1", 1510)
self.struct.add_uint_field("ac_output_power_phase2", 1517) self.struct.add_int_field("ac_output_power_phase2", 1517)
self.struct.add_uint_field("ac_output_power_phase3", 1524) self.struct.add_int_field("ac_output_power_phase3", 1524)
self.struct.add_decimal_field("ac_output_voltage_phase1", 1511, 1) self.struct.add_decimal_field("ac_output_voltage_phase1", 1511, 1)
self.struct.add_decimal_field("ac_output_voltage_phase2", 1518, 1) self.struct.add_decimal_field("ac_output_voltage_phase2", 1518, 1)
self.struct.add_decimal_field("ac_output_voltage_phase3", 1525, 1) self.struct.add_decimal_field("ac_output_voltage_phase3", 1525, 1)
@@ -0,0 +1,8 @@
"""EP800 fields."""
from ..base_devices.ProtocolV2Device import ProtocolV2Device
class EP800(ProtocolV2Device):
def __init__(self, address: str, sn: str):
super().__init__(address, "EP800", sn)
@@ -11,9 +11,10 @@ from ..devices.ep500 import EP500
from ..devices.ep500p import EP500P from ..devices.ep500p import EP500P
from ..devices.ep600 import EP600 from ..devices.ep600 import EP600
from ..devices.ep760 import EP760 from ..devices.ep760 import EP760
from ..devices.ep800 import EP800
DEVICE_NAME_RE = re.compile( DEVICE_NAME_RE = re.compile(
r"^(AC60|AC200M|AC300|AC500|EB3A|EP500|EP500P|EP600|EP760)(\d+)$" r"^(AC60|AC200M|AC300|AC500|EB3A|EP500|EP500P|EP600|EP760|EP800)(\d+)$"
) )
@@ -37,6 +38,8 @@ def build_device(address: str, name: str):
return EP600(address, match[2]) return EP600(address, match[2])
if match[1] == "EP760": if match[1] == "EP760":
return EP760(address, match[2]) return EP760(address, match[2])
if match[1] == "EP800":
return EP800(address, match[2])
def get_type_by_bt_name(bt_name: str): def get_type_by_bt_name(bt_name: str):
@@ -44,6 +44,21 @@ class UintField(DeviceField):
return val >= self.range[0] and val <= self.range[1] return val >= self.range[0] and val <= self.range[1]
class IntField(DeviceField):
def __init__(self, name: str, address: int, range: Optional[Tuple[int, int]]):
self.range = range
super().__init__(name, address, 1)
def parse(self, data: bytes) -> int:
return struct.unpack(">h", data)[0]
def in_range(self, val: int) -> bool:
if self.range is None:
return True
else:
return val >= self.range[0] and val <= self.range[1]
class BoolField(DeviceField): class BoolField(DeviceField):
def __init__(self, name: str, address: int): def __init__(self, name: str, address: int):
super().__init__(name, address, 1) super().__init__(name, address, 1)
@@ -132,6 +147,9 @@ class DeviceStruct:
def add_uint_field(self, name: str, address: int, range: Tuple[int, int] = None): def add_uint_field(self, name: str, address: int, range: Tuple[int, int] = None):
self.fields.append(UintField(name, address, range)) self.fields.append(UintField(name, address, range))
def add_int_field(self, name: str, address: int, range: Tuple[int, int] = None):
self.fields.append(IntField(name, address, range))
def add_bool_field(self, name: str, address: int): def add_bool_field(self, name: str, address: int):
self.fields.append(BoolField(name, address)) self.fields.append(BoolField(name, address))
+2 -1
View File
@@ -10,6 +10,7 @@
{ "local_name": "EP500*" }, { "local_name": "EP500*" },
{ "local_name": "EP600*" }, { "local_name": "EP600*" },
{ "local_name": "EP760*" }, { "local_name": "EP760*" },
{ "local_name": "EP800*" },
{ "local_name": "PBOX*" } { "local_name": "PBOX*" }
], ],
"codeowners": ["@Patrick762"], "codeowners": ["@Patrick762"],
@@ -20,5 +21,5 @@
"iot_class": "local_polling", "iot_class": "local_polling",
"issue_tracker": "https://github.com/Patrick762/hassio-bluetti-bt/issues", "issue_tracker": "https://github.com/Patrick762/hassio-bluetti-bt/issues",
"requirements": [], "requirements": [],
"version": "0.0.17" "version": "0.0.18"
} }