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

Fix BRP069: Add swing_mode support for Alira X devices #23

Merged
merged 9 commits into from
Aug 29, 2024
28 changes: 27 additions & 1 deletion pydaikin/daikin_brp069.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,26 @@ class DaikinBRP069(Appliance):
'filter_sign_info': 'filter dirty',
}

@staticmethod
def parse_response(response_body):
"""Parse response from Daikin

Translate swing mode from 2 parameters to 1 (Special case for certain models e.g Alira X)
"""
_LOGGER.debug("Parsing %s", response_body)
response = super(DaikinBRP069, DaikinBRP069).parse_response(response_body)

if response.get("f_dir_ud") == "0" and response.get("f_dir_lr") == "0":
response["f_dir"] = '0'
elif response.get("f_dir_ud") == "S" and response.get("f_dir_lr") == "0":
response["f_dir"] = '1'
elif response.get("f_dir_ud") == "0" and response.get("f_dir_lr") == "S":
response["f_dir"] = '2'
elif response.get("f_dir_ud") == "S" and response.get("f_dir_lr") == "S":
response["f_dir"] = '3'

return response

async def init(self):
"""Init status."""
await self.auto_set_clock()
Expand Down Expand Up @@ -179,7 +199,13 @@ async def set(self, settings):
if self.support_fan_rate:
params.update({"f_rate": self.values['f_rate']})
if self.support_swing_mode:
params.update({"f_dir": self.values['f_dir']})
if 'f_dir_lr' in self.values and 'f_dir_ud' in self.values:
# Australian Alira X uses 2 separate parameters instead of the combined f_dir
f_dir_ud = 'S' if self.values['f_dir'] in ('1', '3') else '0'
f_dir_lr = 'S' if self.values['f_dir'] in ('2', '3') else '0'
params.update({"f_dir_ud": f_dir_ud, "f_dir_lr": f_dir_lr})
else:
params.update({"f_dir": self.values['f_dir']})

_LOGGER.debug("Sending request to %s with params: %s", path, params)
await self._get_resource(path, params)
Expand Down
Loading