Skip to content

Commit

Permalink
Merge pull request #71 from Patrick762/bugfixes
Browse files Browse the repository at this point in the history
Bugfixes and improvements
  • Loading branch information
Patrick762 authored Mar 12, 2024
2 parents 98d2a0b + bf86fe1 commit f8ed814
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def polling_commands(self) -> List[ReadHoldingRegisters]:

@property
def writable_ranges(self) -> List[range]:
return [range(3006, 3008)]
return [range(3006, 3009)]

@property
def pack_polling_commands(self) -> List[ReadHoldingRegisters]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def polling_commands(self) -> List[ReadHoldingRegisters]:
def writable_ranges(self) -> List[range]:
return super().writable_ranges + [
range(3001, 3016),
3061,
range(3061),
]

@property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def polling_commands(self) -> List[ReadHoldingRegisters]:
def writable_ranges(self) -> List[range]:
return super().writable_ranges + [
range(3001, 3016),
3061,
range(3061),
]

@property
Expand Down
9 changes: 6 additions & 3 deletions custom_components/bluetti_bt/bluetti_bt_lib/devices/eb3a.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,15 @@ def polling_commands(self) -> List[ReadHoldingRegisters]:
return super().polling_commands + [
ReadHoldingRegisters(77, 1),
ReadHoldingRegisters(86, 1),
ReadHoldingRegisters(3034, 1),
ReadHoldingRegisters(3060, 1),
ReadHoldingRegisters(3063, 5),
]

@property
def writable_ranges(self) -> List[range]:
return super().writable_ranges + [
3034,
3060,
range(3063, 3066),
range(3034, 3035),
range(3060, 3061),
range(3063, 3067),
]
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def polling_commands(self) -> List[ReadHoldingRegisters]:
def writable_ranges(self) -> List[range]:
return super().writable_ranges + [
range(3001, 3016),
3061,
range(3061),
]

@property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def polling_commands(self) -> List[ReadHoldingRegisters]:
def writable_ranges(self) -> List[range]:
return super().writable_ranges + [
range(3001, 3016),
3061,
range(3061),
]

@property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class FieldType(Enum):
NUMERIC = auto()
BOOL = auto()
ENUM = auto()
BUTTON = auto()


class FieldAttributes:
Expand Down Expand Up @@ -220,7 +219,7 @@ def __init__(
"total_grid_feed": EnergyFieldAttributes("Total Grid Feed"),
# Device specific controls
"power_off": FieldAttributes(
type=FieldType.BUTTON,
type=FieldType.BOOL,
setter=True,
name="Power Off",
),
Expand Down Expand Up @@ -294,7 +293,7 @@ def __init__(
),
"power_lifting_on": FieldAttributes(
type=FieldType.BOOL,
setter=False, # Disabled for safety reasons
setter=True,
name="Power Lifting",
),
}
Expand Down
7 changes: 5 additions & 2 deletions custom_components/bluetti_bt/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@
]

CONTROL_FIELDS = [
"ac_output_on",
"dc_output_on",
"ac_output_on_switch",
"dc_output_on_switch",
"power_off",
"eco_on",
"power_lifting_on",
]

DIAGNOSTIC_FIELDS = [
Expand Down
2 changes: 1 addition & 1 deletion custom_components/bluetti_bt/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
"iot_class": "local_polling",
"issue_tracker": "https://github.com/Patrick762/hassio-bluetti-bt/issues",
"requirements": [],
"version": "0.0.19"
"version": "0.0.20"
}

0 comments on commit f8ed814

Please sign in to comment.