Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Fujitsu HVAC #14

Merged
merged 30 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
7e64693
Ignore Pipfile and .vscode
crevetor Jan 28, 2024
2e61f3b
Implement FujitsuHVAC device
crevetor Jan 28, 2024
a6d76f7
Add support for FujitsuHVAC device creation
crevetor Jan 28, 2024
f51241b
Add device_name property
crevetor Jan 29, 2024
f687e3c
Export FujitsuHVAC
crevetor Jan 29, 2024
ecdcbf7
Update async_get_devices to match get_devices
crevetor Jan 29, 2024
14de77c
Make has_capability public
crevetor Jan 29, 2024
1f916d6
Add async setters
crevetor Jan 29, 2024
5f4ae59
Don't throw an exception if one of the modes os not in the capabilities
crevetor Jan 29, 2024
8076ced
Fix the previous problem correctly
crevetor Jan 29, 2024
6c2813f
Fix similar problem with listing swing modes
crevetor Jan 29, 2024
2e5c38a
Fix wrong search and replace
crevetor Jan 29, 2024
d4d8ea6
Update async_set_property_value to match the non-async version
crevetor Jan 29, 2024
93b36de
Add SwingMode.Off to supported modes if we support any other swing mode
crevetor Jan 29, 2024
763f722
Implement refreshing of sensed temperature
crevetor Jan 30, 2024
87b398d
Move constants to their own file and make some string constants
crevetor Jan 30, 2024
98b4b74
Remove device_attr method
crevetor Jan 30, 2024
4e7ae7d
Make our own exceptions and use them
crevetor Jan 30, 2024
561ee99
Simplify swing mode handling
crevetor Jan 30, 2024
fffda52
Add temperature range reporting
crevetor Jan 30, 2024
f587d63
Cleanup and formatting
crevetor Jan 30, 2024
70160b4
Fix typo
crevetor Jan 30, 2024
84a7c46
Add missing parameter for async_update
crevetor Jan 30, 2024
90b6179
Fix wrong operator
crevetor Jan 30, 2024
8cc0d51
Don't export FujitsuHVAC
crevetor Jan 30, 2024
0c22c75
Revert "Update async_set_property_value to match the non-async version"
crevetor Feb 1, 2024
12dbef6
Put the fixed async_set_property_value in our own class.
crevetor Feb 1, 2024
caeedb2
Revert "Ignore Pipfile and .vscode"
crevetor Feb 1, 2024
9954159
Remove unused constant SUPPORTED_PROPS_MAP
crevetor Feb 1, 2024
6dec905
Black formatting
crevetor Feb 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/ayla_iot_unofficial/ayla_iot_unofficial.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
)

from .device import Device, Vacuum, Softener
from .fujitsu_hvac import FujitsuHVAC

_session = None

Expand Down Expand Up @@ -257,6 +258,8 @@ def get_devices(self, update: bool = True) -> List[Device]:
devices.append(Vacuum (self, d, europe=self.europe))
elif d["product_name"] in self._softener_devices:
devices.append(Softener(self, d, europe=self.europe))
elif FujitsuHVAC.supports(d):
devices.append(FujitsuHVAC(self, d, europe=self.europe))
else:
devices.append(Device (self, d, europe=self.europe))
# if update:
Expand All @@ -273,6 +276,8 @@ async def async_get_devices(self, update: bool = True) -> List[Device]:
devices.append(Vacuum (self, d, europe=self.europe))
elif d["product_name"] in self._softener_devices:
devices.append(Softener(self, d, europe=self.europe))
elif FujitsuHVAC.supports(d):
devices.append(FujitsuHVAC(self, d, europe=self.europe))
else:
devices.append(Device (self, d, europe=self.europe))
# if update:
Expand Down
121 changes: 121 additions & 0 deletions src/ayla_iot_unofficial/fujitsu_consts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
from enum import IntEnum, unique

OEM_MODEL = "oem_model"
PROP = "prop"
DISPLAY_TEMP = "display_temperature"
DEVICE_NAME = "device_name"
DEVICE_CAPABILITIES = "device_capabilities"
OPERATION_MODE = "operation_mode"
FAN_SPEED = "fan_speed"
ADJUST_TEMPERATURE = "adjust_temperature"
AF_HORIZONTAL_MOVE_STEP1 = "af_horizontal_move_step1"
AF_HORIZONTAL_SWING = "af_horizontal_swing"
AF_VERTICAL_MOVE_STEP1 = "af_vertical_move_step1"
AF_VERTICAL_SWING = "af_vertical_swing"

MIN_TEMP_HEAT = 16.0
MAX_TEMP_HEAT = 30.0

MIN_TEMP_COOL = 18.0
MAX_TEMP_COOL = 30.0

MIN_SENSED_TEMP = 4000
MAX_SENSED_TEMP = 9500
MIN_SENSED_CELSIUS = -10
MAX_SENSED_CELSIUS = 45


@unique
class ModelType(IntEnum):
A = 0
B = 1
F = 2


DEVICE_MAP = {
ModelType.A: [
"AP-WA1E",
"AP-WA2E",
"AP-WA3E",
"AP-WA4E",
"AP-WA5E",
"AP-WA6E",
"AP-WC1E",
"AP-WC2E",
"AP-WC3E",
"AP-WC4E",
"AP-WD1E",
],
ModelType.B: ["AP-WB1E", "AP-WB2E", "AP-WB3E", "AP-WB4E"],
ModelType.F: ["AP-WF1E", "AP-WF2E", "AP-WF3E", "AP-WF4E"],
}

HORIZ_SWING_PARAM_MAP = {
ModelType.B: AF_HORIZONTAL_MOVE_STEP1,
ModelType.A: AF_HORIZONTAL_SWING,
ModelType.F: AF_HORIZONTAL_SWING,
}

VERT_SWING_PARAM_MAP = {
ModelType.B: AF_VERTICAL_MOVE_STEP1,
ModelType.A: AF_VERTICAL_SWING,
ModelType.F: AF_VERTICAL_SWING,
}

SWING_VAL_MAP = {
ModelType.B: {True: 3, False: 0},
ModelType.A: {True: 1, False: 0},
ModelType.F: {True: 1, False: 0},
}


@unique
class FanSpeed(IntEnum):
QUIET = 0
LOW = 1
MEDIUM = 2
HIGH = 3
AUTO = 4


@unique
class OpMode(IntEnum):
OFF = 0
ON = 1
AUTO = 2
COOL = 3
DRY = 4
FAN = 5
HEAT = 6


@unique
class SwingMode(IntEnum):
OFF = 0
SWING_VERTICAL = 1
SWING_HORIZONTAL = 2
SWING_BOTH = 3


@unique
class Capability(IntEnum):
OP_COOL = 1
OP_DRY = 1 << 1
OP_FAN = 1 << 2
OP_HEAT = 1 << 3
OP_AUTO = 1 << 4
OP_MIN_HEAT = 1 << 13

FAN_QUIET = 1 << 9
FAN_LOW = 1 << 8
FAN_MEDIUM = 1 << 7
FAN_HIGH = 1 << 6
FAN_AUTO = 1 << 5

POWERFUL_MODE = 1 << 16
ECO_MODE = 1 << 12
ENERGY_SWING_FAN = 1 << 14
COIL_DRY = 1 << 18
OUTDOOR_LOW_NOISE = 1 << 17
SWING_VERTICAL = 1 << 10
SWING_HORIZONTAL = 1 << 11
Loading
Loading